From 94a2b3ddc7f9890bbbdaf26bdb105d756d2b137a Mon Sep 17 00:00:00 2001 From: bow <bow@bow.web.id> Date: Fri, 31 Oct 2014 13:41:43 +0100 Subject: [PATCH] Add test for different chromosome overlap --- .../src/test/resources/single05.bam | Bin 0 -> 318 bytes .../src/test/resources/single05.bam.bai | Bin 0 -> 176 bytes .../src/test/resources/single05.sam | 9 +++++++ .../sasc/biopet/tools/WipeReadsUnitTest.scala | 23 ++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 biopet-framework/src/test/resources/single05.bam create mode 100644 biopet-framework/src/test/resources/single05.bam.bai create mode 100644 biopet-framework/src/test/resources/single05.sam 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 GIT binary patch literal 318 zcmb2|=3rp}f&Xj_PR>jWlNgGNzNG4;CnOYnD0s;8d9%?K;|Dz7wtJmBukUs8jJJ;G z(;^POCp_Oad!5tZdh&%)%YcDN<)8u(mHYXNYcn%D`%O<+{pie|FLOffUfCnky6DQ0 zDM{xN;#Yq-({x2aKwV|)jw6;EEv9yJW|(RVH20(n1hf}79gt!0-f%i_F3=_NXin;5 z*qq$J;H;3g@uNsmia^2xrcM8y89mmWIM9*EI3X{D(NQ!s)YP=Jl($#my9Uq!Y}P9{ z=SwE486+4UWXWMV!jPk8uxJP4Y|b{8I|n)*vE}SDV4MBm(IX9w6>RJQ!fPgkY&NLi lU_5&;sY$b$g=0nb0fi8AhNbQnN8A`Oog>Y_3=S|50RRKrZ-M{- literal 0 HcmV?d00001 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 GIT binary patch literal 176 zcmZ>A^kigWU|;}YPay^dMj*|=Fd0m?KxwZ@5P5WQkRD`!tQXllm^mDb5OZPXp^IZP L52glUHUk3yao`KH literal 0 HcmV?d00001 diff --git a/biopet-framework/src/test/resources/single05.sam b/biopet-framework/src/test/resources/single05.sam new file mode 100644 index 000000000..b5fe7ceae --- /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 772ed6295..f05b34219 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, -- GitLab