Skip to content

Commit

Permalink
fix(reporter): change "n/a" phenotype for unknown activity score dipl…
Browse files Browse the repository at this point in the history
…otypes to "Indeterminate"
  • Loading branch information
whaleyr committed Feb 20, 2025
1 parent dae7a76 commit 665eef4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ else if (isUnknownAlleles()) {
// diplotype -> phenotype
diplotype.ifPresentOrElse(
(d) -> m_phenotypes.add(d.getPhenotype()),
// TODO(whaleyr): should this be lookupPhenotypeByActivityScore instead?
() -> m_phenotypes.add(lookupPhenotypesByDiplotype(gp, lookupMap)));
}
}
Expand Down Expand Up @@ -653,7 +654,11 @@ private String lookupPhenotypesByDiplotype(GenePhenotype gp, Map<String, Integer
throw new IllegalStateException("More than one phenotype matched for " + this + ": " +
String.join("; ", keys));
} else if (keys.isEmpty()) {
return TextConstants.NA;
if (isActivityScoreType()) {
return TextConstants.INDETERMINATE;
} else {
return TextConstants.NA;
}
} else {
return keys.iterator().next();
}
Expand Down Expand Up @@ -684,7 +689,7 @@ private SortedSet<String> lookupPhenotypeByActivityScore(GenePhenotype gp, Strin
.map(DiplotypeRecord::getGeneResult)
.collect(Collectors.toCollection(TreeSet::new));
if (rez.isEmpty()) {
rez.add(TextConstants.NA);
rez.add(TextConstants.INDETERMINATE);
}
return rez;
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/pharmgkb/pharmcat/Cyp2d6Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void testCyp2d6AlleleWithNoFunction(TestInfo testInfo) throws Exception {

testWrapper.testPrintCalls(DataSource.CPIC, "CYP2D6", "*1/*XXX");
testWrapper.testPrintCalls(DataSource.DPWG, "CYP2D6", "*1/*XXX");
testWrapper.testSourcePhenotype(DataSource.CPIC, "CYP2D6", "n/a");
testWrapper.testSourcePhenotype(DataSource.CPIC, "CYP2D6", TextConstants.INDETERMINATE);

// this nonsense allele will still match to "Indeterminate" phenotypes in guidelines for CYP2D6
testWrapper.testMatchedAnnotations("atomoxetine", PrescribingGuidanceSource.CPIC_GUIDELINE, 2);
Expand All @@ -132,7 +132,7 @@ void testCyp2d6AlleleWithNoFunction(TestInfo testInfo) throws Exception {
.flatMap((g) -> g.getGenotypes().stream())
.flatMap((g) -> g.getDiplotypes().stream())
.filter((d) -> d.getGene().equals("CYP2D6"))
.allMatch((d) -> d.getPhenotypes().contains(TextConstants.NA)));
.allMatch((d) -> d.getPhenotypes().contains(TextConstants.INDETERMINATE)));

GeneReport geneReport = testWrapper.getContext().getGeneReport(DataSource.CPIC, "CYP2D6");
assertNotNull(geneReport);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/pharmgkb/pharmcat/PipelineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ void testUndocumentedVariationsWithTreatAsReferenceAndCombo(TestInfo testInfo) t
testWrapper.testRecommendedDiplotypes(DataSource.CPIC, "TPMT", expectedCallsToRecommendedDiplotypes(tpmtExpectedCalls));
testWrapper.testSourceDiplotypes(DataSource.CPIC, "RYR1", ryr1ExpectedCalls);
testWrapper.testRecommendedDiplotypes(DataSource.CPIC, "RYR1", expectedCallsToRecommendedDiplotypes(ryr1ExpectedCalls));
testWrapper.testRecommendedPhenotype(DataSource.CPIC, "TPMT", TextConstants.NA);

Document document = readHtmlReport(vcfFile);
assertNull(document.getElementById("gs-undocVarAsRef-TPMT"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void infer_outsideCall_noMatch() {
assertNotNull(dip.getAllele2());
assertEquals("*5", dip.getAllele2().getName());
assertEquals(1, dip.getPhenotypes().size());
Assertions.assertEquals(TextConstants.NA, dip.getPhenotypes().get(0));
Assertions.assertEquals(TextConstants.INDETERMINATE, dip.getPhenotypes().get(0));
}


Expand Down

0 comments on commit 665eef4

Please sign in to comment.