Example #1
0
 def test_partition_cigar_refNonconsumingOps(self):
     util = cigar.CigarUtil(42, "5M4I1M")
     (c1, c2, c3) = util._partition_cigar(42, 47)
     self.assertEquals(cigar.CigarUtil(42,""), c1)
     self.assertEquals(cigar.CigarUtil(42,"5M"), c2)
     self.assertEquals(cigar.CigarUtil(47,"4I1M"), c3)
     (c1, c2, c3) = util._partition_cigar(47, 48)
     self.assertEquals(cigar.CigarUtil(42,"5M"), c1)
     self.assertEquals(cigar.CigarUtil(47,"4I1M"), c2)
     self.assertEquals(cigar.CigarUtil(48,""), c3)
Example #2
0
 def test_partition_cigar_refNonconsumingOps(self):
     util = cigar.CigarUtil(42, "5M4I1M")
     (c1, c2, c3) = util._partition_cigar(42, 47)
     self.assertEquals(cigar.CigarUtil(42, ""), c1)
     self.assertEquals(cigar.CigarUtil(42, "5M"), c2)
     self.assertEquals(cigar.CigarUtil(47, "4I1M"), c3)
     (c1, c2, c3) = util._partition_cigar(47, 48)
     self.assertEquals(cigar.CigarUtil(42, "5M"), c1)
     self.assertEquals(cigar.CigarUtil(47, "4I1M"), c2)
     self.assertEquals(cigar.CigarUtil(48, ""), c3)
Example #3
0
 def test_partition_cigar_refNonconsumingOpsWithFlankingSoftclips(self):
     util = cigar.CigarUtil(42, "5S" "5M" "4I" "1M" "5S")
     (c1, c2, c3) = util._partition_cigar(42, 47)
     self.assertEquals(cigar.CigarUtil(37, "5S"), c1)
     self.assertEquals(cigar.CigarUtil(42, "5M"), c2)
     self.assertEquals(cigar.CigarUtil(47, "4I1M5S"), c3)
     (c1, c2, c3) = util._partition_cigar(47, 48)
     self.assertEquals(cigar.CigarUtil(37, "5S5M"), c1)
     self.assertEquals(cigar.CigarUtil(47, "4I1M"), c2)
     self.assertEquals(cigar.CigarUtil(48, "5S"), c3)
     (c1, c2, c3) = util._partition_cigar(48, 53)
     self.assertEquals(cigar.CigarUtil(37, "5S5M4I1M"), c1)
     self.assertEquals(cigar.CigarUtil(48, "5S"), c2)
     self.assertEquals(cigar.CigarUtil(53, ""), c3)
Example #4
0
 def test_partition_cigar_refConsumingOps(self):
     util = cigar.CigarUtil(42, "5M5X")
     # | 4444444455
     # | 2345678901
     # | MMMMM
     # |      XXXXX
     (c1, c2, c3) = util._partition_cigar(42, 47)
     self.assertEquals(cigar.CigarUtil(42, ""), c1)
     self.assertEquals(cigar.CigarUtil(42, "5M"), c2)
     self.assertEquals(cigar.CigarUtil(47, "5X"), c3)
     (c1, c2, c3) = util._partition_cigar(47, 52)
     self.assertEquals(cigar.CigarUtil(42, "5M"), c1)
     self.assertEquals(cigar.CigarUtil(47, "5X"), c2)
     self.assertEquals(cigar.CigarUtil(52, ""), c3)
Example #5
0
 def test_partition_cigar_refNonconsumingOpsWithFlankingSoftclips(self):
     util = cigar.CigarUtil(42, "5S" "5M" "4I" "1M" "5S")
     (c1, c2, c3) = util._partition_cigar(42, 47)
     self.assertEquals(cigar.CigarUtil(37,"5S"), c1)
     self.assertEquals(cigar.CigarUtil(42,"5M"), c2)
     self.assertEquals(cigar.CigarUtil(47,"4I1M5S"), c3)
     (c1, c2, c3) = util._partition_cigar(47, 48)
     self.assertEquals(cigar.CigarUtil(37,"5S5M"), c1)
     self.assertEquals(cigar.CigarUtil(47,"4I1M"), c2)
     self.assertEquals(cigar.CigarUtil(48,"5S"), c3)
     (c1, c2, c3) = util._partition_cigar(48, 53)
     self.assertEquals(cigar.CigarUtil(37,"5S5M4I1M"), c1)
     self.assertEquals(cigar.CigarUtil(48,"5S"), c2)
     self.assertEquals(cigar.CigarUtil(53,""), c3)
Example #6
0
 def test_partition_cigar_refConsumingOps(self):
     util = cigar.CigarUtil(42, "5M5X")
     # | 4444444455
     # | 2345678901
     # | MMMMM
     # |      XXXXX
     (c1, c2, c3) = util._partition_cigar(42, 47)
     self.assertEquals(cigar.CigarUtil(42,""), c1)
     self.assertEquals(cigar.CigarUtil(42,"5M"), c2)
     self.assertEquals(cigar.CigarUtil(47,"5X"), c3)
     (c1, c2, c3) = util._partition_cigar(47, 52)
     self.assertEquals(cigar.CigarUtil(42,"5M"), c1)
     self.assertEquals(cigar.CigarUtil(47,"5X"), c2)
     self.assertEquals(cigar.CigarUtil(52,""), c3)
Example #7
0
 def test_partition_cigar_targetRegionBoundedByShortReverseRead(self):
     util = cigar.CigarUtil(100, "20M")
     (c1, c2, c3) = util._partition_cigar(90, 120)
     self.assertEquals(100, c1.reference_start)
     self.assertEquals("", c1.cigar)
     self.assertEquals(100, c2.reference_start)
     self.assertEquals("20M", c2.cigar)
     self.assertEquals(120, c3.reference_start)
     self.assertEquals("", c3.cigar)
Example #8
0
 def test_partition_cigar_targetRegionBoundedByShortReverseRead(self):
     util = cigar.CigarUtil(100, "20M")
     (c1, c2, c3) = util._partition_cigar(90, 120)
     self.assertEquals(100, c1.reference_start)
     self.assertEquals("", c1.cigar)
     self.assertEquals(100, c2.reference_start)
     self.assertEquals("20M", c2.cigar)
     self.assertEquals(120, c3.reference_start)
     self.assertEquals("", c3.cigar)
Example #9
0
 def test_partition_outOfBounds(self):
     # ref   | 4444444444
     #       | 0123456789
     # read  | SSMMMMMXX
     # index | 210123456
     util = cigar.CigarUtil(42, "2S" "6M" "2X")
     (c1, c2, c3) = util._partition_cigar(30, 42)
     self.assertEquals(cigar.CigarUtil(40, ""), c1)
     self.assertEquals(cigar.CigarUtil(40, "2S"), c2)
     self.assertEquals(cigar.CigarUtil(42, "6M2X"), c3)
     (c1, c2, c3) = util._partition_cigar(48, 60)
     self.assertEquals(cigar.CigarUtil(40, "2S6M"), c1)
     self.assertEquals(cigar.CigarUtil(48, "2X"), c2)
     self.assertEquals(cigar.CigarUtil(50, ""), c3)
     (c1, c2, c3) = util._partition_cigar(20, 30)
     self.assertEquals(cigar.CigarUtil(40, ""), c1)
     self.assertEquals(cigar.CigarUtil(40, ""), c2)
     self.assertEquals(cigar.CigarUtil(40, "2S6M2X"), c3)
     (c1, c2, c3) = util._partition_cigar(100, 110)
     self.assertEquals(cigar.CigarUtil(40, "2S6M2X"), c1)
     self.assertEquals(cigar.CigarUtil(50, ""), c2)
     self.assertEquals(cigar.CigarUtil(50, ""), c3)
Example #10
0
 def test_partition_outOfBounds(self):
     # ref   | 4444444444
     #       | 0123456789
     # read  | SSMMMMMXX
     # index | 210123456
     util = cigar.CigarUtil(42, "2S" "6M" "2X")
     (c1, c2, c3) = util._partition_cigar(30, 42)
     self.assertEquals(cigar.CigarUtil(40,""), c1)
     self.assertEquals(cigar.CigarUtil(40,"2S"), c2)
     self.assertEquals(cigar.CigarUtil(42,"6M2X"), c3)
     (c1, c2, c3) = util._partition_cigar(48, 60)
     self.assertEquals(cigar.CigarUtil(40,"2S6M"), c1)
     self.assertEquals(cigar.CigarUtil(48,"2X"), c2)
     self.assertEquals(cigar.CigarUtil(50,""), c3)
     (c1, c2, c3) = util._partition_cigar(20, 30)
     self.assertEquals(cigar.CigarUtil(40,""), c1)
     self.assertEquals(cigar.CigarUtil(40,""), c2)
     self.assertEquals(cigar.CigarUtil(40,"2S6M2X"), c3)
     (c1, c2, c3) = util._partition_cigar(100, 110)
     self.assertEquals(cigar.CigarUtil(40,"2S6M2X"), c1)
     self.assertEquals(cigar.CigarUtil(50,""), c2)
     self.assertEquals(cigar.CigarUtil(50,""), c3)
Example #11
0
 def test_partition_cigar(self):
     util = cigar.CigarUtil(42, "2S" "6M" "2S")
     (c1, c2, c3) = util._partition_cigar(42, 48)
     self.assertEquals(cigar.CigarUtil(40, "2S"), c1)
     self.assertEquals(cigar.CigarUtil(42, "6M"), c2)
     self.assertEquals(cigar.CigarUtil(48, "2S"), c3)
Example #12
0
 def test_partition_cigar(self):
     util = cigar.CigarUtil(42, "2S" "6M" "2S")
     (c1, c2, c3) = util._partition_cigar(42, 48)
     self.assertEquals(cigar.CigarUtil(40,"2S"), c1)
     self.assertEquals(cigar.CigarUtil(42,"6M"), c2)
     self.assertEquals(cigar.CigarUtil(48,"2S"), c3)