Search in sources :

Example 36 with Characteristic

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

the class CharacteristicValueObject method characteristic2CharacteristicVO.

public static Collection<CharacteristicValueObject> characteristic2CharacteristicVO(Collection<? extends Characteristic> characteristics) {
    Collection<CharacteristicValueObject> characteristicValueObjects;
    if (characteristics instanceof List)
        characteristicValueObjects = new ArrayList<>();
    else
        characteristicValueObjects = new HashSet<>();
    for (Characteristic characteristic : characteristics) {
        CharacteristicValueObject characteristicValueObject = new CharacteristicValueObject(characteristic);
        characteristicValueObjects.add(characteristicValueObject);
    }
    return characteristicValueObjects;
}
Also used : Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet)

Example 37 with Characteristic

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

the class ExpressionPersister method fillInExperimentalFactorAssociations.

private void fillInExperimentalFactorAssociations(ExperimentalFactor experimentalFactor) {
    if (experimentalFactor == null)
        return;
    if (!this.isTransient(experimentalFactor))
        return;
    Collection<Characteristic> annotations = experimentalFactor.getAnnotations();
    for (Characteristic c : annotations) {
        // in case of retry.
        c.setId(null);
        if (c.getAuditTrail() != null && this.isTransient(c.getAuditTrail())) {
            c.getAuditTrail().setId(null);
        }
    }
    this.persistCollectionElements(annotations);
}
Also used : Characteristic(ubic.gemma.model.common.description.Characteristic)

Example 38 with Characteristic

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

the class FactorValue method toString.

@Override
public String toString() {
    StringBuilder buf = new StringBuilder();
    // this can be null in tests or with half-setup transient objects
    buf.append("FactorValue ").append(this.getId()).append(": ");
    if (this.getExperimentalFactor() != null)
        buf.append(this.getExperimentalFactor().getName()).append(":");
    if (this.getCharacteristics().size() > 0) {
        for (Characteristic c : this.getCharacteristics()) {
            buf.append(c.getValue());
            if (this.getCharacteristics().size() > 1)
                buf.append(" | ");
        }
    } else if (this.getMeasurement() != null) {
        buf.append(this.getMeasurement().getValue());
    } else if (StringUtils.isNotBlank(this.getValue())) {
        buf.append(this.getValue());
    }
    return buf.toString();
}
Also used : Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic)

Example 39 with Characteristic

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

the class GeneDifferentialExpressionServiceImpl method configExperimentalFactorValueObject.

@Override
public ExperimentalFactorValueObject configExperimentalFactorValueObject(ExperimentalFactor ef) {
    ExperimentalFactorValueObject efvo = new ExperimentalFactorValueObject(ef.getId());
    efvo.setName(ef.getName());
    efvo.setDescription(ef.getDescription());
    Characteristic category = ef.getCategory();
    if (category != null) {
        efvo.setCategory(category.getCategory());
        if (category instanceof VocabCharacteristic) {
            efvo.setCategoryUri(category.getCategoryUri());
        }
    }
    Collection<FactorValue> fvs = ef.getFactorValues();
    StringBuilder factorValuesAsString = new StringBuilder(StringUtils.EMPTY);
    for (FactorValue fv : fvs) {
        String fvName = fv.toString();
        if (StringUtils.isNotBlank(fvName)) {
            factorValuesAsString.append(fvName).append(GeneDifferentialExpressionServiceImpl.FV_SEP);
        }
    }
    /* clean up the start and end of the string */
    factorValuesAsString = new StringBuilder(StringUtils.remove(factorValuesAsString.toString(), ef.getName() + ":"));
    factorValuesAsString = new StringBuilder(StringUtils.removeEnd(factorValuesAsString.toString(), GeneDifferentialExpressionServiceImpl.FV_SEP));
    /*
         * Preformat the factor name; due to Ext PropertyGrid limitations we can't do this on the client.
         */
    efvo.setName(ef.getName() + " (" + StringUtils.abbreviate(factorValuesAsString.toString(), 50) + ")");
    efvo.setFactorValues(factorValuesAsString.toString());
    return efvo;
}
Also used : Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic)

Example 40 with Characteristic

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

the class CharacteristicBrowserController method findCharacteristicsCustom.

/**
 * @param searchFVs       Search factor values that lack characteristics -- that is, search the factorValue.value.
 * @param searchCategories Should the Category be searched, not just the Value?
 */
public Collection<AnnotationValueObject> findCharacteristicsCustom(String valuePrefix, boolean searchNos, boolean searchEEs, boolean searchBMs, boolean searchFVs, boolean searchPAs, boolean searchFVVs, boolean searchCategories) {
    List<AnnotationValueObject> results = new ArrayList<>();
    if (StringUtils.isBlank(valuePrefix)) {
        return results;
    }
    Collection<Characteristic> chars = characteristicService.findByValue(valuePrefix);
    if (searchCategories) {
        chars.addAll(characteristicService.findByCategory(valuePrefix));
    }
    Map<Characteristic, Object> charToParent = characteristicService.getParents(chars);
    for (Object o : chars) {
        Characteristic c = (Characteristic) o;
        Object parent = charToParent.get(c);
        if ((searchEEs && parent instanceof ExpressionExperiment) || (searchBMs && parent instanceof BioMaterial) || (searchFVs && (parent instanceof FactorValue || parent instanceof ExperimentalFactor)) || (searchNos && parent == null) || (searchPAs && parent instanceof PhenotypeAssociation)) {
            AnnotationValueObject avo = new AnnotationValueObject();
            avo.setId(c.getId());
            avo.setClassName(c.getCategory());
            avo.setTermName(c.getValue());
            if (c.getEvidenceCode() != null)
                avo.setEvidenceCode(c.getEvidenceCode().toString());
            populateClassValues(c, avo);
            if (parent != null) {
                populateParentInformation(avo, parent);
            }
            results.add(avo);
        }
    }
    if (searchFVVs) {
        // non-characteristics.
        Collection<FactorValue> factorValues = factorValueService.findByValue(valuePrefix);
        for (FactorValue factorValue : factorValues) {
            if (factorValue.getCharacteristics().size() > 0)
                continue;
            if (StringUtils.isBlank(factorValue.getValue()))
                continue;
            AnnotationValueObject avo = new AnnotationValueObject();
            avo.setId(factorValue.getId());
            avo.setTermName(factorValue.getValue());
            avo.setObjectClass(FactorValue.class.getSimpleName());
            populateParentInformation(avo, factorValue);
            results.add(avo);
        }
    }
    log.info("Characteristic search for: '" + valuePrefix + "*': " + results.size() + " results, returning up to " + MAX_RESULTS);
    return results.subList(0, Math.min(results.size(), MAX_RESULTS));
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) FactorValue(ubic.gemma.model.expression.experiment.FactorValue) Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) AnnotationValueObject(ubic.gemma.model.common.description.AnnotationValueObject) ArrayList(java.util.ArrayList) PhenotypeAssociation(ubic.gemma.model.association.phenotype.PhenotypeAssociation) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) AnnotationValueObject(ubic.gemma.model.common.description.AnnotationValueObject)

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