Search in sources :

Example 1 with Investigation

use of ubic.gemma.model.analysis.Investigation in project Gemma by PavlidisLab.

the class CoexpressionAnalysisDaoImpl method findByInvestigations.

@Override
public Map<Investigation, Collection<CoexpressionAnalysis>> findByInvestigations(Collection<Investigation> investigations) {
    Map<Investigation, Collection<CoexpressionAnalysis>> results = new HashMap<>();
    for (Investigation ee : investigations) {
        Collection<CoexpressionAnalysis> ae = this.findByInvestigation(ee);
        results.put(ee, ae);
    }
    return results;
}
Also used : CoexpressionAnalysis(ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis) HashMap(java.util.HashMap) Investigation(ubic.gemma.model.analysis.Investigation) Collection(java.util.Collection)

Example 2 with Investigation

use of ubic.gemma.model.analysis.Investigation in project Gemma by PavlidisLab.

the class PhenotypeAssoManagerServiceHelperImpl method populateModifiedValues.

@Override
public void populateModifiedValues(EvidenceValueObject<? extends PhenotypeAssociation> evidenceValueObject, PhenotypeAssociation phenotypeAssociation) {
    // 1- modify common values to all evidences
    phenotypeAssociation.setDescription(evidenceValueObject.getDescription());
    phenotypeAssociation.setEvidenceCode(GOEvidenceCode.fromString(evidenceValueObject.getEvidenceCode()));
    phenotypeAssociation.setIsNegativeEvidence(evidenceValueObject.getIsNegativeEvidence());
    phenotypeAssociation.setGene(this.geneService.findByNCBIId(evidenceValueObject.getGeneNCBI()));
    this.setScoreInformation(evidenceValueObject, phenotypeAssociation);
    this.updatePhenotypeAssociationPublication(phenotypeAssociation, evidenceValueObject);
    // 2- modify specific values depending on evidence type
    if (phenotypeAssociation instanceof ExperimentalEvidence) {
        ExperimentalEvidenceValueObject experimentalVO = (ExperimentalEvidenceValueObject) evidenceValueObject;
        ExperimentalEvidence experimentalEvidence = (ExperimentalEvidence) phenotypeAssociation;
        Investigation experiment = experimentalEvidence.getExperiment();
        // ***************************************************************
        // 1- take care of the characteristic an investigation can have
        // ***************************************************************
        Collection<Characteristic> finalCharacteristics = new HashSet<>();
        HashMap<Long, CharacteristicValueObject> updatedCharacteristicsMap = new HashMap<>();
        for (CharacteristicValueObject updatedCharacteristic : experimentalVO.getExperimentCharacteristics()) {
            // updated
            if (updatedCharacteristic.getId() != null) {
                // this was != 0.
                updatedCharacteristicsMap.put(updatedCharacteristic.getId(), updatedCharacteristic);
            } else // new one
            {
                Characteristic characteristic = this.ontologyHelper.characteristicValueObject2Characteristic(updatedCharacteristic);
                finalCharacteristics.add(characteristic);
            }
        }
        for (Characteristic cha : experiment.getCharacteristics()) {
            VocabCharacteristic experimentCharacteristic = (VocabCharacteristic) cha;
            CharacteristicValueObject experimentCharacteristicVO = new CharacteristicValueObject(experimentCharacteristic);
            CharacteristicValueObject updatedCharacteristic = updatedCharacteristicsMap.get(experimentCharacteristic.getId());
            // found an update, same database id
            if (updatedCharacteristic != null) {
                // same values as before
                if (updatedCharacteristic.equals(experimentCharacteristicVO)) {
                    finalCharacteristics.add(experimentCharacteristic);
                } else {
                    // different values found
                    VocabCharacteristic vocabCharacteristic = this.ontologyHelper.characteristicValueObject2Characteristic(updatedCharacteristic);
                    experimentCharacteristic.setValueUri(vocabCharacteristic.getValueUri());
                    experimentCharacteristic.setValue(vocabCharacteristic.getValue());
                    experimentCharacteristic.setCategory(vocabCharacteristic.getCategory());
                    experimentCharacteristic.setCategoryUri(vocabCharacteristic.getCategoryUri());
                    finalCharacteristics.add(experimentCharacteristic);
                }
            } else // this experimentCharacteristic was deleted
            {
                this.characteristicService.remove(cha);
            }
        }
        experiment.getCharacteristics().clear();
        experiment.getCharacteristics().addAll(finalCharacteristics);
    }
}
Also used : HashMap(java.util.HashMap) Investigation(ubic.gemma.model.analysis.Investigation) HashSet(java.util.HashSet)

Aggregations

HashMap (java.util.HashMap)2 Investigation (ubic.gemma.model.analysis.Investigation)2 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 CoexpressionAnalysis (ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis)1