Skip to content

Commit

Permalink
test(reporter): update unit tests for new RYR1/CACNA1S guideline stru…
Browse files Browse the repository at this point in the history
…cture
  • Loading branch information
whaleyr committed Dec 23, 2023
1 parent f5df05a commit da43730
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/test/java/org/pharmgkb/pharmcat/PipelineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static void htmlChecks(Document document, Map<String, List<String>> expec
}
}

private static void htmlCheckGene(Document document, String gene, List<String> expectedCalls) {
static void htmlCheckGene(Document document, String gene, List<String> expectedCalls) {
Preconditions.checkNotNull(expectedCalls);
if (expectedCalls == NO_DATA) {
expectedCalls = null;
Expand All @@ -151,7 +151,7 @@ private static void htmlCheckGene(Document document, String gene, List<String> e
} else {
// check section i
Elements gsDips = document.select(".gs-" + gene + " .gs-dip");
assertEquals(expectedCalls.size(), gsDips.size());
assertEquals(expectedCalls.size(), gsDips.size(), "diplotype count mismatched for " + gene);
assertEquals(expectedCalls,
gsDips.stream()
.map(e -> e.child(0).text())
Expand Down Expand Up @@ -546,7 +546,6 @@ void testRyr6(TestInfo testInfo) throws Exception {
.variation("RYR1", "rs137933390", "A", "G")
.variation("RYR1", "rs145573319", "A", "G")
;
Path vcfFile = testWrapper.execute(null);

testWrapper.testCalledByMatcher("CACNA1S");
testWrapper.testNotCalledByMatcher("RYR1");
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/org/pharmgkb/pharmcat/ToxicGenesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ void testUncallable_partial_haplotype(TestInfo testInfo) throws Exception {
void testCacna1sHomoRef(TestInfo testInfo) throws Exception {
PipelineWrapper testWrapper = new PipelineWrapper(testInfo, false);
testWrapper.getVcfBuilder()
.reference("CACNA1S");
.reference("CACNA1S")
.reference("RYR1");
Path vcfFile = testWrapper.execute(null);

List<String> expectedCalls = List.of(TextConstants.HOMOZYGOUS_REFERENCE);
Expand All @@ -88,6 +89,7 @@ void testCacna1sHomoRef(TestInfo testInfo) throws Exception {
Document document = readHtmlReport(vcfFile);
htmlChecks(document, new ImmutableMap.Builder<String, List<String>>()
.put("CACNA1S", expectedCalls)
.put("RYR1", expectedCalls)
.build(),
"desflurane", RecPresence.YES, RecPresence.NO);
}
Expand Down Expand Up @@ -508,7 +510,7 @@ void testRyr1HomoRefCacna1sRef(TestInfo testInfo) throws Exception {
testWrapper.testPrintCalls(DataSource.CPIC, "RYR1", expectedCalls);

// each gene has its own annotation so 2 CPIC annotations match, one for each gene
testWrapper.testMatchedAnnotations("desflurane", DataSource.CPIC, 2);
testWrapper.testMatchedAnnotations("desflurane", DataSource.CPIC, 1);
testWrapper.testNoMatchFromSource("desflurane", DataSource.DPWG);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void testCypc2c9VariantPassthrough() throws Exception {

// test the CYP2C9 data
GeneReport geneReport = reportContext.getGeneReport(DataSource.CPIC, "CYP2C9");
assertNotNull(geneReport);
assertTrue(geneReport.isReportable());
assertTrue(geneReport.isCalled());
assertFalse(geneReport.isOutsideCall());
Expand All @@ -51,7 +52,6 @@ void testCypc2c9VariantPassthrough() throws Exception {
DrugReport desfluraneReport = reportContext.getDrugReports().get(DataSource.CPIC).values().stream()
.filter(d -> d.getName().equals("desflurane")).findFirst()
.orElseThrow(() -> new RuntimeException("No desflurane drug report found"));
// desflurane has been split in two, one for each gene
assertEquals(2, desfluraneReport.getGuidelines().stream().filter(GuidelineReport::isMatched).count());
assertEquals(1, desfluraneReport.getGuidelines().stream().filter(GuidelineReport::isMatched).count());
}
}

0 comments on commit da43730

Please sign in to comment.