diff --git a/biopet-framework/src/test/resources/single05.bam b/biopet-framework/src/test/resources/single05.bam new file mode 100644 index 0000000000000000000000000000000000000000..e9fab38e6a945bf942921353d4a443cee881de2e Binary files /dev/null and b/biopet-framework/src/test/resources/single05.bam differ diff --git a/biopet-framework/src/test/resources/single05.bam.bai b/biopet-framework/src/test/resources/single05.bam.bai new file mode 100644 index 0000000000000000000000000000000000000000..7a081f4700900bd7f3da6634d39b676b5547130a Binary files /dev/null and b/biopet-framework/src/test/resources/single05.bam.bai differ diff --git a/biopet-framework/src/test/resources/single05.sam b/biopet-framework/src/test/resources/single05.sam new file mode 100644 index 0000000000000000000000000000000000000000..b5fe7ceae436ea67e0a7eb44b5f2b7b051cf72bf --- /dev/null +++ b/biopet-framework/src/test/resources/single05.sam @@ -0,0 +1,9 @@ +@HD VN:1.0 SO:coordinate +@SQ SN:chrQ LN:10000 +@SQ SN:chrR LN:10000 +@RG ID:001 DS:single-end reads SM:WipeReadsTestCase +r02 16 chrQ 50 60 10M * 0 0 TACGTACGTA EEFFGGHHII RG:Z:001 +r04 0 chrQ 500 60 10M * 0 0 CGTACGTACG EEFFGGHHII RG:Z:001 +r01 0 chrR 50 60 10M * 0 0 TACGTACGTA EEFFGGHHII RG:Z:001 +r03 16 chrR 500 60 10M * 0 0 GGGGGAAAAA GGGGGGGGGG RG:Z:001 +r05 4 * 0 0 * * 0 0 ATATATATAT HIHIHIHIHI RG:Z:001 diff --git a/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/WipeReadsUnitTest.scala b/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/WipeReadsUnitTest.scala index 772ed62950b4d08074ce535db339a4865fb69db3..f05b34219fa9494c5cbf2778c733bd5b170b46d9 100644 --- a/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/WipeReadsUnitTest.scala +++ b/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/WipeReadsUnitTest.scala @@ -35,6 +35,7 @@ class WipeReadsUnitTest extends TestNGSuite with MockitoSugar with Matchers { private val samP: SAMLineParser = { val samh = new SAMFileHeader samh.addSequence(new SAMSequenceRecord("chrQ", 10000)) + samh.addSequence(new SAMSequenceRecord("chrR", 10000)) samh.addReadGroup(new SAMReadGroupRecord("001")) samh.addReadGroup(new SAMReadGroupRecord("002")) new SAMLineParser(samh) @@ -83,6 +84,15 @@ class WipeReadsUnitTest extends TestNGSuite with MockitoSugar with Matchers { val sBamFile3 = new File(resourcePath("/single03.bam")) val sBamFile4 = new File(resourcePath("/single04.bam")) + val sBamFile5 = new File(resourcePath("/single05.bam")) + val sBamRecs5 = makeSams( + "r02\t16\tchrR\t50\t60\t10M\t*\t0\t0\tTACGTACGTA\tEEFFGGHHII\tRG:Z:001", + "r04\t0\tchrQ\t500\t60\t10M\t*\t0\t0\tCGTACGTACG\tEEFFGGHHII\tRG:Z:001", + "r01\t0\tchrR\t50\t60\t10M\t*\t0\t0\tTACGTACGTA\tEEFFGGHHII\tRG:Z:001", + "r03\t16\tchrQ\t500\t60\t10M\t*\t0\t0\tGGGGGAAAAA\tGGGGGGGGGG\tRG:Z:001", + "r05\t4\t*\t0\t0\t*\t*\t0\t0\tATATATATAT\tHIHIHIHIHI\tRG:Z:001" + ) + val pBamFile1 = new File(resourcePath("/paired01.bam")) val pBamRecs1 = makeSams( "r02\t99\tchrQ\t50\t60\t10M\t=\t90\t50\tTACGTACGTA\tEEFFGGHHII\tRG:Z:001", @@ -196,6 +206,19 @@ class WipeReadsUnitTest extends TestNGSuite with MockitoSugar with Matchers { filterNotFunc(sBamRecs1(6)) shouldBe false } + @Test def testSingleBamDifferentChromosomes() = { + val intervals: List[Interval] = List( + new Interval("chrQ", 50, 55), + new Interval("chrR", 500, 505) + ) + val filterNotFunc = makeFilterNotFunction(intervals, sBamFile5, bloomSize = bloomSize, bloomFp = bloomFp) + filterNotFunc(sBamRecs5(0)) shouldBe true + filterNotFunc(sBamRecs5(1)) shouldBe false + filterNotFunc(sBamRecs5(2)) shouldBe false + filterNotFunc(sBamRecs5(3)) shouldBe true + filterNotFunc(sBamRecs5(4)) shouldBe false + } + @Test def testSingleBamFilterOutMultiNotSet() = { val intervals: List[Interval] = List( new Interval("chrQ", 291, 320), // overlaps r01, second hit,