【问题标题】:Snakemake: MissingInputException with inconsistent naming schemeSnakemake:命名方案不一致的 MissingInputException
【发布时间】:2020-09-09 19:35:17
【问题描述】:

我正在尝试使用带有 Minimap2 的 Porechop 处理 MinION cDNA 扩增子,但出现此错误。

MissingInputException in line 16 of /home/sean/Desktop/reo/antisera project/20200813/MinIONAmplicon.smk:
Missing input files for rule minimap2:
8413_19_strict/BC01.fastq.g

我明白错误告诉我什么,我只是明白为什么它没有尝试在它之前制定规则。 Porechop 用于检查所有可能的条形码,如果在目录中找到多个条形码,它将输出多个fastq 文件。但是,由于我知道我在寻找什么条形码,所以我在 config.yaml 文件中创建了一个 barcodes 部分,以便将它们映射在一起。

我认为该错误正在发生,因为我的 Porechop 目标输出与 minimap2 的输入不匹配,但我不知道如何纠正此问题,因为 porechop 可能有多个输出。

我以为我正在为 minimap2 规则的输入文件构建路径,当 snakemake 发现 porechop 输出不存在时,它会成功,但事实并非如此。

这是我目前的管道,

configfile: "config.yaml"
rule all:
    input:
        expand("{sample}.bam", sample = config["samples"])
rule porechop_strict:
    input:
        lambda wildcards: config["samples"][wildcards.sample]
    output:
        directory("{sample}_strict/")
    shell:
        "porechop -i {input} -b {output} --barcode_threshold 85 --threads 8 --require_two_barcodes"
rule minimap2:
    input:
        lambda wildcards: "{sample}_strict/" + config["barcodes"][wildcards.sample]
    output:
        "{sample}.bam"
    shell:
        "minimap2 -ax map-ont -t8 ../concensus.fasta {input} | samtools sort -o {output}"

还有yaml文件

samples: {
  '8413_19': relabeled_reads/8413_19.raw.fastq.gz,
  '8417_19': relabeled_reads/8417_19.raw.fastq.gz,
  '8445_19': relabeled_reads/8445_19.raw.fastq.gz,
  '8466_19_104': relabeled_reads/8466_19_104.raw.fastq.gz,
  '8466_19_105': relabeled_reads/8466_19_105.raw.fastq.gz,
  '8467_20': relabeled_reads/8467_20.raw.fastq.gz,
  }
barcodes: {
      '8413_19': BC01.fastq.gz,
      '8417_19': BC02.fastq.gz,
      '8445_19': BC03.fastq.gz,
      '8466_19_104': BC04.fastq.gz,
      '8466_19_105': BC05.fastq.gz,
      '8467_20': BC06.fastq.gz,
    }

【问题讨论】:

    标签: snakemake


    【解决方案1】:

    首先,您始终可以调试像指定标志--printshellcmds 这样的问题。这将打印 Snakemake 在后台运行的所有 shell 命令;您可以尝试手动运行它们并找到问题。

    至于为什么你的规则没有产生任何输出,我的猜测是 samtools 需要明确的文件名或 - 才能使用标准输入:

    Samtools 旨在处理流。它涉及输入文件'-' 作为标准输入(stdin)和输出文件'-'作为标准 输出(标准输出)。因此可以将几个命令与 Unix 结合使用 管道。 Samtools 总是将警告和错误消息输出到 标准错误输出 (stderr)。

    那就试试吧:

        shell:
            "minimap2 -ax map-ont -t8 ../concensus.fasta {input} | samtools sort -o {output} -"
    

    【讨论】:

    • 感谢您提供有关--printshellcmds 的信息,我不知道这是一件事,并因此发现了一些格式错误,如果没有它,将需要永远解决。我最终玩了params 功能来让它工作。再次感谢您的意见!
    【解决方案2】:

    所以我不能 100% 确定为什么这种方式有效,我想这与 snakemake 查看目标的方式有关,但这是我找到的解决方案。

    rule minimap2:
        input:
            "{sample}_strict"
        params:
            suffix=lambda wildcards: config["barcodes"][wildcards.sample]
        output:
            "{sample}.bam"
        shell:
            "minimap2 -ax map-ont -t8 ../consensus.fasta\
             {input}/{params.suffix} | samtools sort -o {output}"
    

    通过使用snakemake 中的params 功能,我能够将正确的条形码与样本名称相匹配。我不知道为什么我可以把它作为输入本身,但是当我将输入返回到匹配前一个规则的输出时,它就起作用了。

    【讨论】:

      猜你喜欢
      • 2022-10-15
      • 1970-01-01
      • 2022-11-11
      • 2010-11-14
      • 1970-01-01
      • 1970-01-01
      • 2020-07-13
      • 2012-07-06
      • 2010-09-17
      相关资源
      最近更新 更多