Skip to content

Commit

Permalink
Modified Fragment creation for mutect2 to not fail in the special cas…
Browse files Browse the repository at this point in the history
…e that a Fragment is only supported by supplementary and/or secondary and/or duplicate reads

Fixes #6310
  • Loading branch information
KevinCLydon committed Dec 17, 2019
1 parent 43b6bbc commit 4e44726
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -55,6 +56,11 @@ public static Fragment createAndAvoidFailure(final List<GATKRead> reads) {
logger.warn("More than two reads with the same name found. Using two reads randomly to combine as a fragment.");
return create(nonSupplementaryReads.subList(0,2));
}
//If there are no nonsupplementary reads, try supplementary/secondary/duplicate reads instead
else if(nonSupplementaryReads.isEmpty())
{
return create(reads.subList(0,1));
}
return create(nonSupplementaryReads);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,16 @@ public void testBamWithRepeatedReads() {
runMutect2(bam, outputVcf, "20:10018000-10020000", b37Reference, Optional.empty());
}

// In the rare case that a particular fragment is only supported by supplementary reads, that should not
// result in an exception. This test ensures that Mutect2 does not fail to finish in that case.
@Test
public void testBamWithOnlySupplementaryReads() {
final File bam = new File(toolsTestDir + "mutect/only_supplementary_reads.bam");
final File outputVcf = createTempFile("output", ".vcf");

runMutect2(bam, outputVcf, "20:10018000-10020000", b37Reference, Optional.empty());
}

// basic test on a small chunk of NA12878 mitochondria. This is not a validation, but rather a sanity check
// that M2 makes obvious calls, doesn't trip up on the beginning of the circular chromosome, and can handle high depth
@Test
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 4e44726

Please sign in to comment.