MissingOutputException 和 snakemake 的延迟等待错误
MissingOutputException and latency-wait error with snakemake
我正在尝试在 snakemake 中创建 blastdb 数据库:
workdir: "/path/to/workdir/"
(SAMPLES,) =glob_wildcards('/path/to/workdir/{sample}.fasta')
rule all:
input:
expand("{sample}.fasta.{ext}", sample=SAMPLES, ext=["nhr", "nin", "nsq"])
rule makeblastdb:
input:
reference = "/path/to/workdir/{sample}.fasta"
output:
out = "{sample}.fasta.{ext}"
shell:
/Tools/ncbi-blast-2.9.0+/bin/makeblastdb -in {input.reference} -out {output.out} -dbtype nucl"
我收到这个错误:
MissingOutputException in line 11:
Missing files after 10 seconds:
This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait.
有什么问题?
正如您在评论中指出的,您不知道输出了多少文件。有两种选择:
- 利用输出directories.
- 利用 checkpoints,然而(在我看来)这有点难以正确理解。
未经测试但可能有效:
规则 makeblastdb:
输入:
reference = "/path/to/workdir/{sample}.fasta"
输出:
out = "{sample}.fasta.{ext}"
shell:
/Tools/ncbi-blast-2.9.0+/bin/makeblastdb -in {input.reference} -out {output.out} -dbtype nucl
这里我们将输出标记为名为sample-ext的输出目录,ncbi-blast的输出将在这个名为sample.ext.
的目录中
编辑:
如果我们不想要所有这些输出目录,我们可以做的是说我们期望至少有 1 个输出,如果存在,我们假设一切正常:
rule makeblastdb:
input:
reference = "/path/to/workdir/{sample}.fasta"
output:
out = "{sample}.fasta.00.{ext}
shell:
/Tools/ncbi-blast-2.9.0+/bin/makeblastdb -in {input.reference} -out {wildcards.sample}.fasta.{wildcards.ext} -dbtype nucl"
我会在 makeblastdb
完成时触摸一个文件,并将该文件用作需要 blast 数据库的规则的虚拟输入。这样你就可以让 blast 处理后缀和附件文件。例如
rule makeblastdb:
input:
reference = "/path/to/workdir/{sample}.fasta",
output:
done = touch("{sample}.makeblastdb.done"),
shell:
r"""
/Tools/ncbi-blast-2.9.0+/bin/makeblastdb -in {input.reference} -out {wildcards.sample} -dbtype nucl"
"""
rule blast:
input:
db_done= "{sample}.makeblastdb.done",
...
output:
...
shell:
r"""
blast -db {wildcards.sample} ...
"""
我正在尝试在 snakemake 中创建 blastdb 数据库:
workdir: "/path/to/workdir/"
(SAMPLES,) =glob_wildcards('/path/to/workdir/{sample}.fasta')
rule all:
input:
expand("{sample}.fasta.{ext}", sample=SAMPLES, ext=["nhr", "nin", "nsq"])
rule makeblastdb:
input:
reference = "/path/to/workdir/{sample}.fasta"
output:
out = "{sample}.fasta.{ext}"
shell:
/Tools/ncbi-blast-2.9.0+/bin/makeblastdb -in {input.reference} -out {output.out} -dbtype nucl"
我收到这个错误:
MissingOutputException in line 11:
Missing files after 10 seconds:
This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait.
有什么问题?
正如您在评论中指出的,您不知道输出了多少文件。有两种选择:
- 利用输出directories.
- 利用 checkpoints,然而(在我看来)这有点难以正确理解。
未经测试但可能有效:
规则 makeblastdb: 输入: reference = "/path/to/workdir/{sample}.fasta" 输出: out = "{sample}.fasta.{ext}" shell: /Tools/ncbi-blast-2.9.0+/bin/makeblastdb -in {input.reference} -out {output.out} -dbtype nucl
这里我们将输出标记为名为sample-ext的输出目录,ncbi-blast的输出将在这个名为sample.ext.
的目录中编辑:
如果我们不想要所有这些输出目录,我们可以做的是说我们期望至少有 1 个输出,如果存在,我们假设一切正常:
rule makeblastdb:
input:
reference = "/path/to/workdir/{sample}.fasta"
output:
out = "{sample}.fasta.00.{ext}
shell:
/Tools/ncbi-blast-2.9.0+/bin/makeblastdb -in {input.reference} -out {wildcards.sample}.fasta.{wildcards.ext} -dbtype nucl"
我会在 makeblastdb
完成时触摸一个文件,并将该文件用作需要 blast 数据库的规则的虚拟输入。这样你就可以让 blast 处理后缀和附件文件。例如
rule makeblastdb:
input:
reference = "/path/to/workdir/{sample}.fasta",
output:
done = touch("{sample}.makeblastdb.done"),
shell:
r"""
/Tools/ncbi-blast-2.9.0+/bin/makeblastdb -in {input.reference} -out {wildcards.sample} -dbtype nucl"
"""
rule blast:
input:
db_done= "{sample}.makeblastdb.done",
...
output:
...
shell:
r"""
blast -db {wildcards.sample} ...
"""