如何解决Snakemake 使用 porechop
我正在尝试通过 Snakemake 工作流程对多个数据使用 porechop。
在我的 Snakefile 中,除了 all 规则之外,还有三个规则,一个 fastqc 规则和一个 porechop 规则。 fastqc 规则效果很好,我的三个 fastq 都用了这三个。但是对于 porechop,它不是运行该命令三次,而是同时为所有三个文件运行一次带有 -i 标志的命令:
Error in rule porechop:
jobid: 2
output: /ngs/prod/nanocea_project/test/prod/porechop/25022021_2_pore.fastq.gz,/ngs/prod/nanocea_project/test/prod/porechop/02062021_1_pore.fastq.gz,/ngs/prod/nanocea_project/test/prod/porechop/02062021_2_pore.fastq.gz
conda-env: /ngs/prod/nanocea_project/test/.snakemake/conda/a72fb141b37718b7c37d9f32d597faeb
shell:
porechop -i /ngs/prod/nanocea_project/test/reads/25022021_2.fastq.gz /ngs/prod/nanocea_project/test/reads/02062021_1.fastq.gz /ngs/prod/nanocea_project/test/reads/02062021_2.fastq.gz -o /ngs/prod/nanocea_project/test/prod/porechop/25022021_2_pore.fastq.gz /ngs/prod/nanocea_project/test/prod/porechop/02062021_1_pore.fastq.gz /ngs/prod/nanocea_project/test/prod/porechop/02062021_2_pore.fastq.gz -t 40 --discard_middle
(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
但是,当我将它与单个样本一起使用时,该程序可以运行。
这是我的代码:
import glob
import os
###Global Variables###
FORMATS=["zip","html"]
DIR_FASTQ="/ngs/prod/nanocea_project/test/reads"
###FASTQ Files###
def list_samples(DIR_FASTQ):
SAMPLES=[]
for file in glob.glob(DIR_FASTQ+"/*.fastq.gz"):
base=os.path.basename(file)
sample=(base.replace('.fastq.gz',''))
SAMPLES.append(sample)
return(SAMPLES)
SAMPLES=list_samples(DIR_FASTQ)
###Rules###
rule all:
input:
expand("/ngs/prod/nanocea_project/test/stats/fastqc/{sample}_fastqc.{ext}",sample=SAMPLES,ext=FORMATS),expand("/ngs/prod/nanocea_project/test/prod/porechop/{sample}_pore.fastq.gz",sample=SAMPLES)
rule fastqc:
input:
expand(DIR_FASTQ+"/{sample}.fastq.gz",sample=SAMPLES)
output:
expand("/ngs/prod/nanocea_project/test/stats/fastqc/{sample}_fastqc.{ext}",ext=FORMATS)
threads:
16
conda:
"envs/fastqc.yaml"
shell:
"fastqc {input} -o /ngs/prod/nanocea_project/test/stats/fastqc/ -t {threads}"
rule porechop:
input:
expand(DIR_FASTQ+"/{sample}.fastq.gz",sample=SAMPLES)
output:
expand("/ngs/prod/nanocea_project/test/prod/porechop/{sample}_pore.fastq.gz",sample=SAMPLES)
threads:
40
conda:
"envs/porechop.yaml"
shell:
"porechop -i {input} -o {output} -t {threads} --discard_middle"
你知道出了什么问题吗?
谢谢!
解决方法
这个问题经常出现...如果您在 expand()
或 input:
中使用 output:
,那么您正在为规则提供所有文件的列表。这和写作一样:
input:
['sample1.fastq','sample2.fastq',...,'sampleN.fastq'],output:
['sample1.pore.fastq','sample2.pore.fastq','sampleN.pore.fastq'],
要在每个输入/输出上运行规则,只需删除扩展:
rule porechop:
input:
DIR_FASTQ+"/{sample}.fastq.gz"
output:
"/ngs/prod/nanocea_project/test/prod/porechop/{sample}_pore.fastq.gz",
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。