init.py 文件源码

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

项目:IgDiscover 作者: NBISweden 项目源码 文件源码
def guess_paired_path(path):
    """
    Given the path to a file that contains the sequences for the first read in a
    pair, return the file that contains the sequences for the second read in a
    pair. Both files must have identical names, except that the first must have
    a '1' in its name, and the second must have a '2' at the same position.

    Return None if no second file was found or if there are too many candidates.

    >>> guess_paired_path('file.1.fastq.gz')  # doctest: +SKIP
    'file.2.fastq.gz'  # if that file exists
    """
    base, name = os.path.split(path)
    glob_pattern = os.path.join(base, name.replace('1', '?'))
    paths = [p for p in glob.glob(glob_pattern) if is_1_2(p, path) and '_R1_' not in p]
    if len(paths) != 1:
        return None
    return paths[0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号