util.py 文件源码

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

项目:gretel 作者: SamStudio8 项目源码 文件源码
def get_ref_len_from_bam(bam_path, target_contig):
    """
    Fetch the length of a given reference sequence from a :py:class:`pysam.AlignmentFile`.

    Parameters
    ----------
    bam_path : str
        Path to the BAM alignment

    target_contig : str
        The name of the contig for which to recover haplotypes.

    Returns
    -------
    end_pos : int
        The 1-indexed genomic position at which to stop considering variants.
    """
    bam = pysam.AlignmentFile(bam_path)
    end = bam.lengths[bam.get_tid(target_contig)]
    bam.close()

    return end
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号