From e3f1029e194344c26d6e0871cb25be27ce9bb607 Mon Sep 17 00:00:00 2001 From: Ryan Whaley Date: Fri, 9 Feb 2024 14:12:47 -0800 Subject: [PATCH] fix(reporter): fix missing phenotype and activity score in drug section of HTML report --- .../model/result/AnnotationReport.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/pharmgkb/pharmcat/reporter/model/result/AnnotationReport.java b/src/main/java/org/pharmgkb/pharmcat/reporter/model/result/AnnotationReport.java index 668ca6221..8867c2856 100644 --- a/src/main/java/org/pharmgkb/pharmcat/reporter/model/result/AnnotationReport.java +++ b/src/main/java/org/pharmgkb/pharmcat/reporter/model/result/AnnotationReport.java @@ -30,7 +30,7 @@ public class AnnotationReport implements Comparable { private String m_classification; @Expose @SerializedName("activityScore") - private final SortedMap m_activityScore = new TreeMap<>(); + private final SortedMap f_activityScores = new TreeMap<>(); @Expose @SerializedName("population") private String m_population = TextConstants.NA; @@ -52,6 +52,9 @@ public class AnnotationReport implements Comparable { @Expose @SerializedName("otherPrescribingGuidance") private boolean m_otherPrescribingGuidance = false; + @Expose + @SerializedName("phenotypes") + private Map f_phenotypes = new TreeMap<>(); /** @@ -110,6 +113,19 @@ public SortedSet getGenotypes() { public void addGenotype(Genotype genotype) { m_genotypes.add(genotype); + + for (Diplotype dip : genotype.getDiplotypes()) { + for (String phenotype : dip.getPhenotypes()) { + f_phenotypes.put(dip.getGene(), phenotype); + } + if (dip.hasActivityScore()) { + f_activityScores.put(dip.getGene(), dip.getActivityScore()); + } + } + } + + public Map getPhenotypes() { + return f_phenotypes; } public String getDrugRecommendation() { @@ -129,7 +145,7 @@ public List getImplications() { } public Map getActivityScores() { - return m_activityScore; + return f_activityScores; } @@ -193,7 +209,7 @@ public int compareTo(@NonNull AnnotationReport o) { .compare(m_genotypes, o.getGenotypes()) .compare(m_population, o.getPopulation()) .compare(m_highlightedVariants, o.getHighlightedVariants()) - .compare(m_activityScore, o.getActivityScores()) + .compare(this.getActivityScores(), o.getActivityScores()) .compare(m_classification, o.getClassification()) .compare(m_drugRecommendation, o.getDrugRecommendation()) .compare(m_implications, o.getImplications())