merge_bams.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:NGaDNAP 作者: theboocock 项目源码 文件源码
def get_bam_pairs(bams):
    """
        Function returns pairs of bam files because sample ID relies
        on samples being encoded with a '.'

        @bams  A List of Bam files.
    """
    ### TODO Use the read group to merge the reads, far smarter!
    bam_list = {}
    for bam in bams:
        sam = pysam.AlignmentFile(bam,'rb')
        sample_id = (sam.header['RG'][0]['SM'])
        try:
            bam_list[sample_id].append(bam)
        except KeyError:
            bam_list[sample_id] = [bam]
    return bam_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号