def test_make_split_read_bam_file(self):
sorted_bam = path.join(TEST_DATA_DIR, 'sorted.bam')
with pysam.Samfile(sorted_bam, 'rb') as samfile:
for read in samfile:
if not read.cigarstring:
continue
for breakpoint in (10, 50, 100):
if breakpoint >= read.rlen:
continue
for is_left_split in (True, False):
split_read = make_split_read(read, breakpoint, is_left_split)
cigar_items = list(Cigar(split_read.cigarstring).items())
clipped_item = cigar_items[0] if is_left_split else cigar_items[-1]
min_clip_len = breakpoint if is_left_split else read.rlen - breakpoint # Can be longer if adjacent to another clip.
self.assertGreaterEqual(clipped_item[0], min_clip_len)
self.assertIn(clipped_item[1], ('S', 'H')) # Will be soft-clipped unless already hard-clipped.
评论列表
文章目录