运行 nanofilt 与 snakemake
running nanofilt with snakemake
我刚开始使用 snakemake。我想 运行 我的 fastq 文件与 nanofilt 在一个文件夹中。我想用 snakemake 运行 这个,因为我需要它来创建一个管道。这是我的蛇制作脚本:
rule NanoFilt:
input:
"data/samples/{sample}.fastq"
output:
"nanofilt_out.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
当我 运行 它时,我收到以下错误消息:
WildcardError in line 2:
Wildcards in input files cannot be determined from output files:
'sample'
编辑
我尝试搜索错误消息,但仍然无法弄清楚如何让它工作。谁能帮帮我?
所以我尝试了这里的人告诉我的,所以新脚本是这样的:
samples = ['fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8293','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8292','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8291','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290']
rule all:
input:
[f"nanofilt_out_{sample}.gz" for sample in samples]
rule NanoFilt:
input:
"zipped/zipped{sample}.gz"
output:
"nanofilt_out_{sample}.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
但是当我 运行 这样做时,我收到以下错误消息:
Error in rule NanoFilt:
Removing output files of failed job NanoFilt since they might be corrupted:
nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8292.gz
jobid: 4
output: nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz
shell:
gunzip -c zipped/zippedfastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz | NanoFilt -q 8 | gzip > nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz
(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
有人知道如何解决这个问题吗?
SnakeMake 的'idea' 是你指定你想要的输出(例如通过规则全部),SnakeMake 查看所有定义的规则并知道如何获得所需的输出。
当你告诉 SnakeMake 你想要作为输出 nanofilt_out.gz
时,它如何知道要采集什么样本?它不会.. 如果它只获取任何可能的示例文件,那么我们将丢失有关它属于哪个文件的信息。为了解决这个问题,我们还需要在输出中使用与输入中相同的通配符:
rule NanoFilt:
input:
"data/samples/{sample}.fastq"
output:
"nanofilt_out_{sample}.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
这样SnakeMake就可以为每个样本做一个输出。您确实需要以某种方式调整您指定所需输出的管道,可能是这样的:
samples = [1,2,3]
rule all:
input:
[f"nanofilt_out_{sample}.gz" for sample in samples]
我成功了。工作代码如下所示。
rule NanoFilt:
input:
expand("zipped/zipped.gz", sample=samples)
output:
"filtered/nanofilt_out.gz"
conda:
"envs/nanoFilt.yaml"
shell:
"gunzip -c {input} | NanoFilt -q 6 | gzip > {output}"
我刚开始使用 snakemake。我想 运行 我的 fastq 文件与 nanofilt 在一个文件夹中。我想用 snakemake 运行 这个,因为我需要它来创建一个管道。这是我的蛇制作脚本:
rule NanoFilt:
input:
"data/samples/{sample}.fastq"
output:
"nanofilt_out.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
当我 运行 它时,我收到以下错误消息:
WildcardError in line 2:
Wildcards in input files cannot be determined from output files:
'sample'
编辑
我尝试搜索错误消息,但仍然无法弄清楚如何让它工作。谁能帮帮我?
所以我尝试了这里的人告诉我的,所以新脚本是这样的:
samples = ['fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8293','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8292','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8291','fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290']
rule all:
input:
[f"nanofilt_out_{sample}.gz" for sample in samples]
rule NanoFilt:
input:
"zipped/zipped{sample}.gz"
output:
"nanofilt_out_{sample}.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
但是当我 运行 这样做时,我收到以下错误消息:
Error in rule NanoFilt:
Removing output files of failed job NanoFilt since they might be corrupted:
nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8292.gz
jobid: 4
output: nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz
shell:
gunzip -c zipped/zippedfastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz | NanoFilt -q 8 | gzip > nanofilt_out_fastqrunid4d89b52e7b9734bd797205037ef201a30be415c8290.gz
(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
有人知道如何解决这个问题吗?
SnakeMake 的'idea' 是你指定你想要的输出(例如通过规则全部),SnakeMake 查看所有定义的规则并知道如何获得所需的输出。
当你告诉 SnakeMake 你想要作为输出 nanofilt_out.gz
时,它如何知道要采集什么样本?它不会.. 如果它只获取任何可能的示例文件,那么我们将丢失有关它属于哪个文件的信息。为了解决这个问题,我们还需要在输出中使用与输入中相同的通配符:
rule NanoFilt:
input:
"data/samples/{sample}.fastq"
output:
"nanofilt_out_{sample}.gz"
shell:
"gunzip -c {input} | NanoFilt -q 8 | gzip > {output}"
这样SnakeMake就可以为每个样本做一个输出。您确实需要以某种方式调整您指定所需输出的管道,可能是这样的:
samples = [1,2,3]
rule all:
input:
[f"nanofilt_out_{sample}.gz" for sample in samples]
我成功了。工作代码如下所示。
rule NanoFilt:
input:
expand("zipped/zipped.gz", sample=samples)
output:
"filtered/nanofilt_out.gz"
conda:
"envs/nanoFilt.yaml"
shell:
"gunzip -c {input} | NanoFilt -q 6 | gzip > {output}"