Search in sources :

Example 21 with Characteristic

use of ubic.gemma.model.common.description.Characteristic in project Gemma by PavlidisLab.

the class ExpressionPersister method persistBioMaterial.

private BioMaterial persistBioMaterial(BioMaterial entity) {
    if (entity == null)
        return null;
    AbstractPersister.log.debug("Persisting " + entity);
    if (!this.isTransient(entity))
        return entity;
    assert entity.getSourceTaxon() != null;
    AbstractPersister.log.debug("Persisting " + entity);
    this.fillInDatabaseEntry(entity.getExternalAccession());
    AbstractPersister.log.debug("db entry done");
    entity.setSourceTaxon(this.persistTaxon(entity.getSourceTaxon()));
    AbstractPersister.log.debug("taxon done");
    for (Treatment treatment : entity.getTreatments()) {
        Characteristic action = treatment.getAction();
        AbstractPersister.log.debug(treatment + " action: " + action);
        AbstractPersister.log.debug("treatment done");
    }
    AbstractPersister.log.debug("start save");
    BioMaterial bm = bioMaterialDao.findOrCreate(entity);
    AbstractPersister.log.debug("save biomaterial done");
    return bm;
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) Treatment(ubic.gemma.model.expression.biomaterial.Treatment) Characteristic(ubic.gemma.model.common.description.Characteristic)

Example 22 with Characteristic

use of ubic.gemma.model.common.description.Characteristic in project Gemma by PavlidisLab.

the class FactorValueValueObject method getSummaryString.

static String getSummaryString(FactorValue fv) {
    StringBuilder buf = new StringBuilder();
    if (fv.getCharacteristics().size() > 0) {
        for (Iterator<Characteristic> iter = fv.getCharacteristics().iterator(); iter.hasNext(); ) {
            Characteristic c = iter.next();
            buf.append(c.getValue() == null ? "[Unassigned]" : c.getValue());
            if (iter.hasNext())
                buf.append(", ");
        }
    } else if (fv.getMeasurement() != null) {
        buf.append(fv.getMeasurement().getValue());
    } else if (StringUtils.isNotBlank(fv.getValue())) {
        buf.append(fv.getValue());
    } else {
        buf.append("?");
    }
    return buf.toString();
}
Also used : Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic)

Example 23 with Characteristic

use of ubic.gemma.model.common.description.Characteristic in project Gemma by PavlidisLab.

the class FactorValueValueObject method init.

private void init(FactorValue val, Characteristic c) {
    this.setFactorValue(FactorValueValueObject.getSummaryString(val));
    this.setFactorId(val.getExperimentalFactor().getId());
    this.isBaseline = val.getIsBaseline() != null ? val.getIsBaseline() : this.isBaseline;
    if (val.getMeasurement() != null) {
        this.setMeasurement(true);
        this.value = val.getMeasurement().getValue();
        this.setCharId(val.getMeasurement().getId());
    } else if (c != null && c.getId() != null) {
        this.setCharId(c.getId());
    } else {
        this.value = val.getValue();
    }
    if (c != null) {
        this.setCategory(c.getCategory());
        // clobbers if we set it already
        this.setValue(c.getValue());
        if (c instanceof VocabCharacteristic) {
            VocabCharacteristic vc = (VocabCharacteristic) c;
            this.setCategoryUri(vc.getCategoryUri());
            this.setValueUri(vc.getValueUri());
        }
    }
    /*
         * Make sure we fill in the Category for this.
         */
    Characteristic factorCategory = val.getExperimentalFactor().getCategory();
    if (this.getCategory() == null && factorCategory != null) {
        this.setCategory(factorCategory.getCategory());
        if (factorCategory instanceof VocabCharacteristic) {
            VocabCharacteristic vc = (VocabCharacteristic) factorCategory;
            this.setCategoryUri(vc.getCategoryUri());
        }
    }
}
Also used : Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic)

Example 24 with Characteristic

use of ubic.gemma.model.common.description.Characteristic in project Gemma by PavlidisLab.

the class BioMaterialController method getAnnotation.

public Collection<AnnotationValueObject> getAnnotation(EntityDelegator bm) {
    if (bm == null || bm.getId() == null)
        return null;
    BioMaterial bioM = bioMaterialService.load(bm.getId());
    Collection<AnnotationValueObject> annotation = new ArrayList<>();
    for (Characteristic c : bioM.getCharacteristics()) {
        AnnotationValueObject annotationValue = new AnnotationValueObject();
        annotationValue.setId(c.getId());
        annotationValue.setClassName(c.getCategory());
        annotationValue.setTermName(c.getValue());
        annotationValue.setObjectClass(BioMaterial.class.getSimpleName());
        if (c.getEvidenceCode() != null) {
            annotationValue.setEvidenceCode(c.getEvidenceCode().toString());
        }
        if (c instanceof VocabCharacteristic) {
            VocabCharacteristic vc = (VocabCharacteristic) c;
            annotationValue.setClassUri(vc.getCategoryUri());
            String className = getLabelFromUri(vc.getCategoryUri());
            if (className != null)
                annotationValue.setClassName(className);
            annotationValue.setTermUri(vc.getValueUri());
            String termName = getLabelFromUri(vc.getValueUri());
            if (termName != null)
                annotationValue.setTermName(termName);
        }
        annotation.add(annotationValue);
    }
    return annotation;
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) AnnotationValueObject(ubic.gemma.model.common.description.AnnotationValueObject) ArrayList(java.util.ArrayList) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic)

Example 25 with Characteristic

use of ubic.gemma.model.common.description.Characteristic in project Gemma by PavlidisLab.

the class AnnotationController method removeExperimentTag.

public void removeExperimentTag(Collection<Long> characterIds, Long eeId) {
    ExpressionExperiment ee = expressionExperimentService.load(eeId);
    if (ee == null) {
        return;
    }
    ee = expressionExperimentService.thawLite(ee);
    Collection<Characteristic> current = ee.getCharacteristics();
    Collection<Characteristic> found = new HashSet<>();
    for (Characteristic characteristic : current) {
        if (characterIds.contains(characteristic.getId()))
            found.add(characteristic);
    }
    for (Characteristic characteristic : found) {
        log.info("Removing characteristic  from " + ee + " : " + characteristic);
    }
    current.removeAll(found);
    ee.setCharacteristics(current);
    expressionExperimentService.update(ee);
    for (Long id : characterIds) {
        characteristicService.remove(id);
    }
}
Also used : Characteristic(ubic.gemma.model.common.description.Characteristic) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) HashSet(java.util.HashSet)

Aggregations

Characteristic (ubic.gemma.model.common.description.Characteristic)46 VocabCharacteristic (ubic.gemma.model.common.description.VocabCharacteristic)32 StopWatch (org.apache.commons.lang3.time.StopWatch)7 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)7 CharacteristicValueObject (ubic.gemma.model.genome.gene.phenotype.valueObject.CharacteristicValueObject)7 AnnotationValueObject (ubic.gemma.model.common.description.AnnotationValueObject)6 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)6 FactorValue (ubic.gemma.model.expression.experiment.FactorValue)6 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 SearchSettingsValueObject (ubic.gemma.model.common.search.SearchSettingsValueObject)4 BioSequenceValueObject (ubic.gemma.model.genome.sequenceAnalysis.BioSequenceValueObject)4 OntologyTerm (ubic.basecode.ontology.model.OntologyTerm)3 BibliographicReferenceValueObject (ubic.gemma.model.common.description.BibliographicReferenceValueObject)3 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)3 GeneEvidenceValueObject (ubic.gemma.model.genome.gene.phenotype.valueObject.GeneEvidenceValueObject)3 ConcurrentHashSet (org.compass.core.util.concurrent.ConcurrentHashSet)2 TaskResult (ubic.gemma.core.job.TaskResult)2 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)2 Treatment (ubic.gemma.model.expression.biomaterial.Treatment)2