Example #1
0
 def test_fetch_seq_bound_larger_than_chr_length_coordinate_by_chr_length(
         self):
     chrm = 'GL000192.1'  # len: 547496
     clv = 547493
     beg, end = gen_coords(clv, '-', window=6)
     calc_beg = 547493
     calc_end = 547499
     self.assertEqual((beg, end), (calc_beg, calc_end))
     expected = 'ttc'  # the last 3 bases of GL000192.1
Example #2
0
        def test_fetch_seq_based_on_KLEAT_clv_minus_strand_chr9_GNAQ(self):
            chrm = '9'
            # reported by KLEAT, converted to 0-based, corresponding to a T, the
            # last base of its 3'UTR
            clv = 80335189 - 1
            self.assertEqual(fetch_seq(self.refseq, chrm, clv, clv + 1), 'T')

            beg, end = gen_coords(clv, '-', window=6)
            self.assertEqual((beg, end), (clv, clv + 6))
            self.assertEqual(fetch_seq(self.refseq, chrm, beg, end), 'TTTTAT')
Example #3
0
        def test_fetch_seq_based_on_KLEAT_clv_minus_strand_chr2_NFE2L2(self):
            chrm = '2'
            # reported by KLEAT, converted to 0-based, corresponding to a T, the
            # last base of its 3'UTR
            clv = 178095802 - 1

            self.assertEqual(fetch_seq(self.refseq, chrm, clv, clv + 1), 'G')
            beg, end = gen_coords(clv, '-', window=10)
            self.assertEqual((beg, end), (clv, clv + 10))
            self.assertEqual(fetch_seq(self.refseq, chrm, beg, end),
                             'GCCACTTTAT')
Example #4
0
 def test_fetch_seq_based_on_KLEAT_clv_plus_strand_chr12_DRAM1(self):
     """based on hg19"""
     chrm = '12'
     # this is a coord reported by KLEAT, it's 1-based, so -1 to make it
     # 0-based, and it points to the end of 3'UTR, where there is a hexamer
     # right to the upstream of it, see included screenshot in the repo
     clv = 102316878 - 1
     # 'a' is the last base on 3'UTR
     self.assertEqual(fetch_seq(self.refseq, chrm, clv, clv + 1), 'a')
     beg, end = gen_coords(clv, '+', window=6)
     self.assertEqual((beg, end), (clv - 6 + 1, clv + 1))
     self.assertEqual(fetch_seq(self.refseq, chrm, beg, end), 'aataaa')
Example #5
0
        def test_fetch_seq_bound_negative_coordinate_by_0(self):
            chrm = 'GL000192.1'
            clv = 3
            beg, end = gen_coords(clv, '+', window=6)
            calc_beg = -2  # clv - 6 + 1
            calc_end = 4  # clv + 1
            self.assertEqual((beg, end), (calc_beg, calc_end))
            expected = 'GAAT'  # the first 4 bases of GL000192.1
            self.assertEqual(fetch_seq(self.refseq, chrm, beg, end), expected)

            # assert beginning is bound by 0
            self.assertEqual(fetch_seq(self.refseq, chrm, 0, end), expected)