def test_stop_without_start(self): seq = "NNNTAGNNN" for offset in [0, 6, 305]: if offset == 0: orfs = scan_orfs(seq, 1) else: orfs = scan_orfs(seq, 1, offset=offset) assert len(orfs) == 1 orf = orfs[0] assert isinstance(orf.start, BeforePosition) assert isinstance(orf.end, ExactPosition) assert orf.end == 6 + offset
def test_start_without_end(self): seq = "NNNATGNNN" for offset in [0, 6, 305]: if offset == 0: orfs = scan_orfs(seq, 1) else: orfs = scan_orfs(seq, 1, offset=offset) assert len(orfs) == 1 orf = orfs[0] assert isinstance(orf.start, ExactPosition) assert isinstance(orf.end, AfterPosition) assert orf.start == 3 + offset
def test_contained(self): seq = "ATG" + "X" * 60 + "TAG" for offset in [0, 6, 305]: if offset == 0: orfs = scan_orfs(seq, 1) else: orfs = scan_orfs(seq, 1, offset=offset) assert len(orfs) == 1 orf = orfs[0] assert isinstance(orf.start, ExactPosition) assert isinstance(orf.end, ExactPosition) assert orf.start == 0 + offset assert orf.end == 66 + offset
def test_multiframe(self): starts = [3, 25, 72, 77] seq = ["X"] * 200 for start in starts: seq[start:start + 3] = "ATG" seq[start + 63:start + 66] = "TAA" assert len(seq) == 200 result = scan_orfs("".join(seq), direction=1) assert sorted([orf.start for orf in result]) == starts assert len(result) == 4