def test_duplication(self): b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.POS, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.POS, orient=ORIENT.LEFT)) self.assertEqual({SVTYPE.DUP}, BreakpointPair.classify(b)) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.POS, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.POS, orient=ORIENT.LEFT)) self.assertEqual({SVTYPE.DUP}, BreakpointPair.classify(b)) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NEG, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.NEG, orient=ORIENT.LEFT)) self.assertEqual({SVTYPE.DUP}, BreakpointPair.classify(b)) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.POS, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.POS, orient=ORIENT.NS)) self.assertEqual({SVTYPE.DUP}, BreakpointPair.classify(b)) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NEG, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.NEG, orient=ORIENT.NS)) self.assertEqual({SVTYPE.DUP}, BreakpointPair.classify(b))
def test_translocation(self): b = BreakpointPair( Breakpoint(1, 1, 2, ORIENT.RIGHT), Breakpoint(2, 1, 2, ORIENT.LEFT), opposing_strands=False, ) BreakpointPair.classify(b)
def test_inverted_translocation(self): b = BreakpointPair( Breakpoint(1, 1, 2, ORIENT.LEFT), Breakpoint(2, 1, 2, ORIENT.LEFT), opposing_strands=True, ) BreakpointPair.classify(b)
def test_deletion_with_useq(self): bpp = BreakpointPair(Breakpoint('1', 6964, orient='L'), Breakpoint('1', 7040, orient='R'), opposing=False, untemplated_seq='CCCT') self.assertEqual(sorted([SVTYPE.DEL, SVTYPE.INS]), sorted(BreakpointPair.classify(bpp))) def distance(x, y): return Interval(abs(x - y)) net_size = BreakpointPair.net_size(bpp, distance) self.assertEqual(Interval(-71), net_size) self.assertEqual(sorted([SVTYPE.DEL]), sorted(BreakpointPair.classify(bpp, distance)))
def test_insertion(self): b = BreakpointPair( Breakpoint(1, 1, 1, strand=STRAND.NS, orient=ORIENT.LEFT), Breakpoint(1, 2, 2, strand=STRAND.NS, orient=ORIENT.RIGHT), opposing_strands=False, ) self.assertEqual(sorted([SVTYPE.INS]), sorted(BreakpointPair.classify(b)))
def test_deletion(self): b = BreakpointPair( Breakpoint(1, 1, 1, strand=STRAND.NS, orient=ORIENT.LEFT), Breakpoint(1, 3, 3, strand=STRAND.NS, orient=ORIENT.RIGHT), opposing_strands=False, untemplated_seq='', ) self.assertEqual(sorted([SVTYPE.DEL]), sorted(BreakpointPair.classify(b)))
def test_no_type(self): b = BreakpointPair( Breakpoint(1, 1, 1, strand=STRAND.NS, orient=ORIENT.LEFT), Breakpoint(1, 2, 2, strand=STRAND.NS, orient=ORIENT.RIGHT), opposing_strands=False, untemplated_seq='', ) self.assertEqual(set(), BreakpointPair.classify(b))
def test_deletion_or_insertion(self): b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.POS, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.POS, orient=ORIENT.RIGHT), ) assert sorted(BreakpointPair.classify(b)) == sorted([SVTYPE.DEL, SVTYPE.INS]) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.POS, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.NS, orient=ORIENT.RIGHT), opposing_strands=False, ) assert sorted(BreakpointPair.classify(b)) == sorted([SVTYPE.DEL, SVTYPE.INS]) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NEG, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.NEG, orient=ORIENT.RIGHT), ) assert sorted(BreakpointPair.classify(b)) == sorted([SVTYPE.DEL, SVTYPE.INS]) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NEG, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.NS, orient=ORIENT.RIGHT), opposing_strands=False, ) assert sorted(BreakpointPair.classify(b)) == sorted([SVTYPE.DEL, SVTYPE.INS]) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NS, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.POS, orient=ORIENT.RIGHT), opposing_strands=False, ) assert sorted(BreakpointPair.classify(b)) == sorted([SVTYPE.DEL, SVTYPE.INS]) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NS, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.NEG, orient=ORIENT.RIGHT), opposing_strands=False, ) assert sorted(BreakpointPair.classify(b)) == sorted([SVTYPE.DEL, SVTYPE.INS]) b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NS, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.NS, orient=ORIENT.RIGHT), opposing_strands=False, ) assert sorted(BreakpointPair.classify(b)) == sorted([SVTYPE.DEL, SVTYPE.INS])
def test_inversion(self): b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.POS, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.NEG, orient=ORIENT.RIGHT), ) assert BreakpointPair.classify(b) == {SVTYPE.INV} b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NEG, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.POS, orient=ORIENT.RIGHT), ) assert BreakpointPair.classify(b) == {SVTYPE.INV} b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.POS, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.NEG, orient=ORIENT.NS), ) assert BreakpointPair.classify(b) == {SVTYPE.INV} b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NEG, orient=ORIENT.RIGHT), Breakpoint(1, 10, 11, strand=STRAND.POS, orient=ORIENT.NS), ) assert BreakpointPair.classify(b) == {SVTYPE.INV} b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.POS, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.NEG, orient=ORIENT.LEFT), ) assert BreakpointPair.classify(b) == {SVTYPE.INV} b = BreakpointPair( Breakpoint(1, 1, 2, strand=STRAND.NEG, orient=ORIENT.LEFT), Breakpoint(1, 10, 11, strand=STRAND.POS, orient=ORIENT.LEFT), ) assert BreakpointPair.classify(b) == {SVTYPE.INV}
def test_deletion_no_distance_error(self): bpp = BreakpointPair(Breakpoint('1', 7039, orient='L'), Breakpoint('1', 7040, orient='R'), opposing=False) self.assertEqual(sorted([SVTYPE.INS]), sorted(BreakpointPair.classify(bpp)))