如何使用Python处理BAM - 知乎
https://zhuanlan.zhihu.com/p/31625187import pysam bf = pysam.AlignmentFile('in.bam', 'rb') for r in bf: print r.reference_name, r.pos, r.mapq, r.isize 是不是很简单! 打开in.bam文件之后,用for循环对其从头到尾地遍历,并把每个值都赋给r,r在这里代表的就是比对的read信息,它是一个对象(在Pysam由AlignedSegment定义),通过它就可以获取所有的比对信息,比如 ...
FAQ — pysam 0.18.0 documentation
https://pysam.readthedocs.io/en/latest/faq.htmlpysam coordinates are wrong¶ pysam uses 0-based coordinates and the half-open notation for ranges as does python. Coordinates and intervals reported from pysam always follow that convention. Confusion might arise as different file formats might have different conventions. For example, the SAM format is 1-based while the BAM format is 0-based.