Skip to content

Commit

Permalink
fix(namedallelematcher): avoid exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
markwoon committed Jul 26, 2024
1 parent a57b955 commit f4fe35a
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ public SortedSet<DiplotypeMatch> mergePhasedDiplotypeMatch(MatchData matchData,
BaseMatch h2 = dm.getHaplotype2();

boolean isHapB3homozygous = m_numHapB3Called == 2 && (
m_hapB3Call.stream().filter(c -> c.equals("1")).count() == 2 ||
m_hapB3IntronCall.stream().filter(c -> c.equals("1")).count() == 2
(m_hapB3Call == null || m_hapB3Call.stream().filter(c -> c.equals("1")).count() == 2) ||
(m_hapB3IntronCall == null || m_hapB3IntronCall.stream().filter(c -> c.equals("1")).count() == 2)
);

if (dm.getHaplotype1().getName().equals(dm.getHaplotype2().getName()) || isHapB3homozygous) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @author Mark Woon
*/
public abstract class BaseMatch implements Comparable<BaseMatch> {
public class BaseMatch implements Comparable<BaseMatch> {
@Expose
@SerializedName("name")
private String m_name;
Expand Down
61 changes: 61 additions & 0 deletions src/test/java/org/pharmgkb/pharmcat/DpydTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,67 @@ void testFindCombinations(TestInfo testInfo) throws Exception {
}


@Test
void hapB3AndIntronicC(TestInfo testInfo) throws Exception {

PipelineWrapper testWrapper = new PipelineWrapper(testInfo, true, false, false);
testWrapper.getVcfBuilder()
.phased()
// hapB3 exon C>T
.variation("DPYD", "rs56038477", "C", "T")
// hapB3 intron G>C
.variation("DPYD", "rs75017182", "C", "C")
;

Path vcfFile = testWrapper.execute();

List<String> expectedCalls = List.of(
"c.1129-5923C>G/c.1129-5923C>G, c.1236G>A (HapB3)"
);
RecPresence hasDpwgAnnotations = RecPresence.YES;

testWrapper.testCalledByMatcher("DPYD");
testWrapper.testSourceDiplotypes(DataSource.CPIC, "DPYD", expectedCalls);
testWrapper.testRecommendedDiplotypes(DataSource.CPIC, "DPYD", List.of("c.1129-5923C>G, c.1236G>A (HapB3)", "c.1129-5923C>G"));
testWrapper.testPrintCalls(DataSource.CPIC, "DPYD", expectedCalls);

dpydHasReports(testWrapper, hasDpwgAnnotations);

Document document = readHtmlReport(vcfFile);
dpydHtmlChecks(document, expectedCalls, false, hasDpwgAnnotations);
}

@Test
void hapB3AndIntronicD(TestInfo testInfo) throws Exception {

PipelineWrapper testWrapper = new PipelineWrapper(testInfo, true, false, false);
testWrapper.getVcfBuilder()
.phased()
// hapB3 exon C>T
.variation("DPYD", "rs56038477", "T", "C")
// hapB3 intron G>C
.variation("DPYD", "rs75017182", "C", "C")
;

Path vcfFile = testWrapper.execute();

List<String> expectedCalls = List.of(
"c.1129-5923C>G/c.1129-5923C>G, c.1236G>A (HapB3)"
);
RecPresence hasDpwgAnnotations = RecPresence.YES;

testWrapper.testCalledByMatcher("DPYD");
testWrapper.testSourceDiplotypes(DataSource.CPIC, "DPYD", expectedCalls);
testWrapper.testRecommendedDiplotypes(DataSource.CPIC, "DPYD", List.of("c.1129-5923C>G, c.1236G>A (HapB3)", "c.1129-5923C>G"));
testWrapper.testPrintCalls(DataSource.CPIC, "DPYD", expectedCalls);

dpydHasReports(testWrapper, hasDpwgAnnotations);

Document document = readHtmlReport(vcfFile);
dpydHtmlChecks(document, expectedCalls, false, hasDpwgAnnotations);
}


@Test
void hapB3(TestInfo testInfo) throws Exception {

Expand Down

0 comments on commit f4fe35a

Please sign in to comment.