You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Snakemake MissingInputException:haplotype_caller_gvcf缺失参考基因组输入

解决Snakemake中haplotype_caller_gvcf规则的MissingInputException问题

问题根源

你的规则里将REFPATH(目录路径)和REFERENCE(文件名)分别列为input的独立项,但Snakemake会验证每个输入条目是否为存在的文件:

  • REFPATH是目录,不是文件,Snakemake无法将其识别为有效输入
  • REFERENCE仅为文件名,Snakemake会在当前工作目录查找,而非你指定的resources/genomes/路径下,因此找不到该文件

解决方案

方案1:合并路径与文件名作为单一输入项

  1. 在Snakefile头部导入os模块:
    import os
    
  2. 修改haplotype_caller_gvcf规则的input部分,合并路径与文件名:
    rule haplotype_caller_gvcf:
        # ... 其他属性保持不变
        input:
            reference = os.path.join(REFPATH, REFERENCE),
            bam = "results/04_Variants/{sample}_{aligner}_{mincov}X_indel-qual.bam"
        # ... 其他属性保持不变
        shell:
            "gatk HaplotypeCaller "
            "-R {input.reference} "
            "-I {input.bam} "
            "-O {output.gvcf} "
            "-ERC GVCF"
    

方案2:提前定义完整参考基因组路径

  1. 在Snakefile头部直接定义完整的参考文件路径:
    import os
    FULL_REF_PATH = os.path.join(config["consensus"]["path"], config["consensus"]["reference"])
    
  2. 修改规则的input部分使用该完整路径:
    rule haplotype_caller_gvcf:
        # ... 其他属性保持不变
        input:
            reference = FULL_REF_PATH,
            bam = "results/04_Variants/{sample}_{aligner}_{mincov}X_indel-qual.bam"
        # ... 其他属性保持不变
        shell:
            "gatk HaplotypeCaller "
            "-R {input.reference} "
            "-I {input.bam} "
            "-O {output.gvcf} "
            "-ERC GVCF"
    

额外检查项

  • 确认参考文件确实存在于路径resources/genomes/GCA_018104305.1_AalbF3_genomic.fasta下,注意大小写敏感(macOS/Linux系统下路径区分大小写)
  • 验证路径中是否存在拼写错误,比如目录名、文件名的空格或特殊字符

内容的提问来源于stack exchange,提问作者ltalignani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 19:05:32