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;
}
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);
}
}
Aggregations