common.py 文件源码

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

项目:wub 作者: nanoporetech 项目源码 文件源码
def pysam_open(alignment_file, in_format='BAM'):
    """Open SAM/BAM file using pysam.

    :param alignment_file: Input file.
    :param in_format: Format (SAM or BAM).
    :returns: pysam.AlignmentFile
    :rtype: pysam.AlignmentFile
    """
    if in_format == 'BAM':
        mode = "rb"
    elif in_format == 'SAM':
        mode = "r"
    else:
        raise Exception("Invalid format: {}".format(in_format))

    aln_iter = pysam.AlignmentFile(alignment_file, mode)
    return aln_iter
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号