def test_second_start_segmentation(self): segmentation = { 'G001': { 'gene_segment': [], 'T0001': [ pybedtools.create_interval_from_list( ['1', '.', 'exon', '100', '200', '.', '+', '.', 'gene_id: "G001"', 'transcript_id: "T0001"']), ], }, 'G002': { 'gene_segment': [], 'T0002': [ pybedtools.create_interval_from_list( ['1', '.', 'exon', '50', '100', '.', '-', '.', 'gene_id: "G001"', 'transcript_id: "T0001"']), ], }, } second_start, _ = xlsites._second_start( read=0, poss=(1, 2, 99, 100), strand='+', chrom=1, segmentation=segmentation, holesize_th=4) self.assertEqual(second_start, 99) second_start, _ = xlsites._second_start( read=0, poss=(99, 100, 199, 200), strand='-', chrom=1, segmentation=segmentation, holesize_th=4) self.assertEqual(second_start, 100) second_start, _ = xlsites._second_start( read=0, poss=(1, 2, 4, 5), strand='-', chrom=1, segmentation=segmentation, holesize_th=4) self.assertEqual(second_start, 2)
def test_second_start_no_seg(self): # If hole size is lower than holesize_th, strange should be empty: _, is_strange = xlsites._second_start( read='the_read', poss=(1, 2, 5, 6), strand='+', chrom=1, segmentation=None, holesize_th=1) self.assertTrue(is_strange) # If hole size is lower than holesize_th, strange should be empty: _, is_strange = xlsites._second_start( read='the_read', poss=(1, 2, 5, 6), strand='+', chrom=1, segmentation=None, holesize_th=2) self.assertFalse(is_strange)
def test_second_start_no_annotation(self): # If hole size is lower than holesize_th, strange should be empty: strange = [] xlsites._second_start(read='the_read', poss=(1, 2, 5, 6), strange=strange, strand='+', chrom=1, annotation=None, holesize_th=1) self.assertEqual(strange, ['the_read']) # If hole size is lower than holesize_th, strange should be empty: strange = [] xlsites._second_start(read='the_read', poss=(1, 2, 5, 6), strange=strange, strand='+', chrom=1, annotation=None, holesize_th=2) self.assertEqual(strange, [])