From 072660ed05c25cb7f9be435a03f801cd116a3a06 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 19 Nov 2024 14:14:25 -0600 Subject: [PATCH] Fix for experimental conditions --- .../tdf/DiseaseAnnotationToTdfTranslator.java | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/agr_api/src/main/java/org/alliancegenome/api/translators/tdf/DiseaseAnnotationToTdfTranslator.java b/agr_api/src/main/java/org/alliancegenome/api/translators/tdf/DiseaseAnnotationToTdfTranslator.java index 20c872eb3..d2b00ea27 100644 --- a/agr_api/src/main/java/org/alliancegenome/api/translators/tdf/DiseaseAnnotationToTdfTranslator.java +++ b/agr_api/src/main/java/org/alliancegenome/api/translators/tdf/DiseaseAnnotationToTdfTranslator.java @@ -235,6 +235,21 @@ private static void extracted(DiseaseAnnotationDocument annotation, org.alliance row.setGeneticEntityType("Allele"); } } + if (annotation.getCategory().equals("gene_disease_annotation") || annotation.getCategory().equals("allele_disease_annotation")) { + if (CollectionUtils.isNotEmpty(primaryAnnotation.getConditionRelations())) { + List conditionModifiers = primaryAnnotation.getConditionRelations().stream() + .filter(conditionRelation -> conditionRelation.getConditionRelationType() != null) + .filter(conditionRelation -> conditionRelation.getConditionRelationType().getName().contains("has_condition") + || conditionRelation.getConditionRelationType().getName().contains("induced") + || conditionRelation.getConditionRelationType().getName().contains("ameliorated") + || conditionRelation.getConditionRelationType().getName().contains("exacerbated")).toList(); + List experimentalConditionComponents = new ArrayList<>(conditionModifiers.stream().map(conditionRelation -> conditionRelation.getConditionRelationType().getName()).toList()); + conditionModifiers.forEach(conditionRelation -> conditionRelation.getConditions().forEach(experimentalCondition -> { + experimentalConditionComponents.add(experimentalCondition.getConditionSummary()); + })); + row.setExperimentalCondition(String.join(",", experimentalConditionComponents)); + } + } if (primaryAnnotation.getDiseaseGeneticModifierRelation() != null) { row.setDiseaseGeneticModifierRelation(primaryAnnotation.getDiseaseGeneticModifierRelation().getName()); } @@ -349,24 +364,6 @@ private DiseaseDownloadRow getBaseDiseaseDownloadRow(DiseaseAnnotationDocument a row.setSource(sourceProvider); } */ - if (annotation.getCategory().equals("gene_disease_annotation") || annotation.getCategory().equals("allele_disease_annotation")) { - if (annotation.getPrimaryAnnotations() != null) { - for (org.alliancegenome.curation_api.model.entities.DiseaseAnnotation da : annotation.getPrimaryAnnotations()) { - if (CollectionUtils.isNotEmpty(da.getConditionRelations())) { - List conditionModifiers = da.getConditionRelations().stream().filter(conditionRelation -> conditionRelation.getConditionRelationType() != null) - .filter(conditionRelation -> conditionRelation.getConditionRelationType().getName().contains("has_condition") - || conditionRelation.getConditionRelationType().getName().contains("induced") - || conditionRelation.getConditionRelationType().getName().contains("ameliorated") - || conditionRelation.getConditionRelationType().getName().contains("exacerbated")).toList(); - List experimentalConditionComponents = new ArrayList<>(conditionModifiers.stream().map(conditionRelation -> conditionRelation.getConditionRelationType().getName()).toList()); - conditionModifiers.forEach(conditionRelation -> conditionRelation.getConditions().forEach(experimentalCondition -> { - experimentalConditionComponents.add(experimentalCondition.getConditionSummary()); - })); - row.setExperimentalCondition(String.join(",", experimentalConditionComponents)); - } - } - } - } StringJoiner evidenceJoiner = getStringJoiner(primaryAnnotation, org.alliancegenome.curation_api.model.entities.ontology.ECOTerm::getCurie); row.setEvidenceCode(evidenceJoiner.toString());