def test_cds_start_on_transcript_start_reverse(): """ Upstream correction (reverse) for CDS start at the start of transcript. """ rna = [23777833, 23778028, 23808749, 23808851, 23824768, 23824856, 23853497, 23853617, 23869553, 23869626, 23894775, 23894899, 23898506, 23899304] cds = [23777833, 23899304] cm = Crossmap(rna, cds, -1) assert cm.x2g(-1, 0) == cm.x2g(1, -1)
def test_x2g_noncoding_reverse(): """ Do some n. to g. conversion checking for the gene on the reverse strand. """ rna = [2000, 2797, 6405, 6528, 31678, 31750, 47687, 47806, 76448, 76535, 92453, 92554, 123276, 123470, 146090, 146213] cm = Crossmap(rna, [], -1) assert cm.x2g(1, -1) == 146214 assert cm.x2g(1, 0) == 146213 assert cm.x2g(124, 1) == 146089 assert cm.x2g(1624, 1) == 1999
def test_x2g_noncoding(): """ Do some n. to g. conversion checking for the gene on the forward strand. """ rna = [5002, 5125, 27745, 27939, 58661, 58762, 74680, 74767, 103409, 103528, 119465, 119537, 144687, 144810, 148418, 149215] cm = Crossmap(rna, [], 1) assert cm.x2g(1, -1) == 5001 assert cm.x2g(1, 0) == 5002 assert cm.x2g(124, 1) == 5126 assert cm.x2g(1624, 1) == 149216
def test_cds_one_exon(): """ Test a gene that has a CDS that lies entirely in one exon. """ rna = [1, 80, 81, 3719] cds = [162, 2123] cm = Crossmap(rna, cds, 1) assert cm._Crossmap__crossmapping == [-161, -82, -81, 3558] assert cm.x2g(1, 0) == 162 assert cm.tuple2string(cm.g2x(2123)) == '1962' assert cm.tuple2string(cm.g2x(2124)) == '*1'
def test_x2g_more(): """ Do some c. to g. conversion checking for the gene on the forward strand. """ rna = [5002, 5125, 27745, 27939, 58661, 58762, 74680, 74767, 103409, 103528, 119465, 119537, 144687, 144810, 148418, 149215] cds = [27925, 74736] cm = Crossmap(rna, cds, 1) assert cm.x2g(-304, -1) == 5001 assert cm.x2g(-182, 0) == 5124 assert cm.x2g(-181, 1) == 5126 assert cm.x2g(-1, 0) == 27924 assert cm.x2g(1, 0) == 27925 assert cm.x2g(16, -1) == 58660 assert cm.x2g(174, 0) == 74736 assert cm.x2g(cm.main2int('*1'), 0) == 74737 assert cm.x2g(cm.main2int('*32'), -1) == 103408 assert cm.x2g(cm.main2int('*33'), 0) == 103410 assert cm.x2g(cm.main2int('*1146'), 1) == 149216
def test_x2g_more_reverse(): """ Do some c. to g. conversion checking for the gene on the reverse strand. """ rna = [2000, 2797, 6405, 6528, 31678, 31750, 47687, 47806, 76448, 76535, 92453, 92554, 123276, 123470, 146090, 146213] cds = [76479, 123290] cm = Crossmap(rna, cds, -1) assert cm.x2g(-304, -1) == 146214 assert cm.x2g(-182, 0) == 146091 assert cm.x2g(-181, 1) == 146089 assert cm.x2g(-1, 0) == 123291 assert cm.x2g(1, 0) == 123290 assert cm.x2g(16, -1) == 92555 assert cm.x2g(174, 0) == 76479 assert cm.x2g(cm.main2int('*1'), 0) == 76478 assert cm.x2g(cm.main2int('*32'), -1) == 47807 assert cm.x2g(cm.main2int('*33'), 0) == 47805 assert cm.x2g(cm.main2int('*1146'), 1) == 1999
def test_cds_start_on_splice_site(): """ Test a gene that has a CDS that starts on an exon splice site. """ rna = [23755059, 23755214, 23777833, 23778028, 23808749, 23808851, 23824768, 23824856, 23853497, 23853617, 23869553, 23869626, 23894775, 23894899, 23898506, 23899304] cds = [23777833, 23898680] cm = Crossmap(rna, cds, 1) assert (cm._Crossmap__crossmapping == [-156, -1, 1, 196, 197, 299, 300, 388, 389, 509, 510, 583, 584, 708, 709, 1507]) assert cm.x2g(1, 0) == 23777833 # Fix for r536: disable the -u and +d convention. # assert cm.tuple2string(cm.g2x(2123)) == '-156-u23752936' # assert cm.tuple2string(cm.g2x(2124)) == '-156-u23752935' assert cm.tuple2string(cm.g2x(2123)) == '-23753092' assert cm.tuple2string(cm.g2x(2124)) == '-23753091'