def test_region_subject_to_query_no_endgaps(self): a = AlignedPair( ("a", "ABCDEF"), ("b", "HIJKLM")) # In an alignment with no gaps, the query sequence coordinates should # always match the subject sequence coordinates r = AlignedRegion.from_subject(a, 0, 3) self.assertEqual(r.in_alignment(), (0, 3)) rq = AlignedRegion.from_query(a, 0, 3) self.assertEqual(r.in_alignment(), (0, 3)) r = AlignedRegion.from_subject(a, 1, 5) self.assertEqual(r.in_alignment(), (1, 5)) rq = AlignedRegion.from_query(a, 1, 5) self.assertEqual(r.in_alignment(), (1, 5)) r = AlignedRegion.from_subject(a) self.assertEqual(r.in_alignment(), (0, 6)) rq = AlignedRegion.from_query(a) self.assertEqual(r.in_alignment(), (0, 6))
def test_from_query_with_endgaps(self): a = AlignedPair( ("a", "--ABC-EF---"), ("b", "HIJKLMNOPQR")) r = AlignedRegion.from_query(a, 1, 4) self.assertEqual(r.start_idx, 3) self.assertEqual(r.end_idx, 7) self.assertEqual(r.in_query(), (1, 4)) self.assertEqual(r.in_subject(), (3, 7)) self.assertEqual(r.query_offset(), 0) self.assertEqual(r.subject_offset(), 0)
def test_from_query_region_crazy(self): a = AlignedPair( ("a", "-A-BC-EF---"), # |||| (1, 5) ("b", "--HI-JK-LMN")) r = AlignedRegion.from_query(a, 0, 3) self.assertEqual(r.in_alignment(), (1, 5)) self.assertEqual(r.in_query(), (0, 3)) self.assertEqual(r.in_subject(), (0, 2)) self.assertEqual(r.query_offset(), 0) self.assertEqual(r.subject_offset(), 0)
def test_from_query_no_endgaps(self): a = AlignedPair( ("a", "ABCDEF"), ("b", "HIJKLM")) r = AlignedRegion.from_query(a, 2, 5) self.assertEqual(r.start_idx, 2) self.assertEqual(r.end_idx, 5) self.assertEqual(r.in_query(), (2, 5)) self.assertEqual(r.in_subject(), (2, 5)) self.assertEqual(r.query_offset(), 0) self.assertEqual(r.subject_offset(), 0)