def bam_is_paired(bam_path, num_reads=20000, paired_cutoff=0.75):
"""
Infers the paired-ness of a bam file.
"""
sam = pysam.Samfile(bam_path)
count = 0
for rec in itertools.islice(sam, num_reads):
if rec.is_paired:
count += 1
if tools.mathOps.format_ratio(count, num_reads) > 0.75:
return True
elif tools.mathOps.format_ratio(count, num_reads) < 1 - paired_cutoff:
return False
else:
raise UserException("Unable to infer pairing from bamfile {}".format(bam_path))
hints_db.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录