Python 多输入蛇击

Python 多输入蛇击,python,pipeline,snakemake,Python,Pipeline,Snakemake,我开始为我的生物信息学项目编写一个管道,我使用Snakemake作为工作流程。 我制作了官方网站的所有教程,并提供了一些文档 我想运行一个shell命令,如下所示: fastp-i输入-1-i输入-2-o输出-1-o输出-2 Snakefile中的我的代码: SAMPLES = ['1', '2', '3', '4'] rule fastp: input: reads1=expand("sample{sample}.R1.fq.gz", sample=SAMPLES),

我开始为我的生物信息学项目编写一个管道,我使用Snakemake作为工作流程。 我制作了官方网站的所有教程,并提供了一些文档

我想运行一个shell命令,如下所示:
fastp-i输入-1-i输入-2-o输出-1-o输出-2

Snakefile中的我的代码:

SAMPLES = ['1', '2', '3', '4']
rule fastp:
    input:
        reads1=expand("sample{sample}.R1.fq.gz", sample=SAMPLES),
        reads2=expand("sample{sample}.R2.fq.gz", sample=SAMPLES)
    output:
        reads1out=expand("sample{sample}.R1.fq.gz.out", sample=SAMPLES),
        reads2out=expand("sample{sample}.R2.fq.gz.out", sample=SAMPLES)
    shell:
        "fastp -i {input.reads1} -I {input.reads2} -o {output.reads1out} -O {output.reads2out}"
但是程序运行这一行代码:

1.1.fq.7.7 7 7.7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7.7 7 7 7 7.7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ple4.R2.fq.gz.out

如何编写程序,对每个示例执行不同的shell命令?在
规则fastp:
之后,我在示例中尝试了一个
for I:
,但不起作用,我不知道现在可以尝试什么。很抱歉,如果这个主题在某种程度上过于基本,但我是Python的noob

多谢各位

您需要使用
规则all
输出文件

SAMPLES = ['1', '2', '3', '4']
rule all:
    input:
        expand("sample{sample}.R{read_no}.fq.gz.out", sample=SAMPLES, read_no=['1', '2'])

rule fastp:
    input:
        reads1="sample{sample}.R1.fq.gz",
        reads2="sample{sample}.R2.fq.gz"
    output:
        reads1out="sample{sample}.R1.fq.gz.out",
        reads2out="sample{sample}.R2.fq.gz.out"
    shell:
        "fastp -i {input.reads1} -I {input.reads2} -o {output.reads1out} -O {output.reads2out}"

这是snakemake-np命令的输出,带有
规则all:
,正如JeeYem所写:


λfastp/testdata master✗ 毒蛇-np
规则fastp:
输入:sample1.R1.fq.gz,sample2.R1.fq.gz,sample3.R1.fq.gz,sample4.R1.fq.gz,sample1.R2.fq.gz,sample2.R2.fq.gz,sample3.R2.fq.gz,sample4.R2.fq.gz
输出:sample1.R1.fq.gz.out,sample2.R1.fq.gz.out,sample3.R1.fq.gz.out,sample4.R1.fq.gz.out,sample1.R2.fq.gz.out,sample2.R2.fq.gz.out,sample3.R2.fq.gz.out,sample4.R2.fq.gz.out
jobid:1
1.1.fq.7.7 7 7.7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7.7 7 7 7 7.7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ple4.R2.fq.gz.out
localrule所有:
输入:sample1.R1.fq.gz.out,sample1.R2.fq.gz.out,sample2.R2.fq.gz.out,sample3.R1.fq.gz.out,sample3.R2.fq.gz.out,sample4.R1.fq.gz.out,sample4.R2.fq.gz.out
jobid:0
工作计数:
计算工作
1全部
1 fastp
2.

谢谢你的回答,JeeYem,但我还是有同样的问题。黑客仍然像以前一样尝试将所有样本放在一行中。复制并粘贴我的代码,然后重试。看起来您在代码中添加了
rule all
,但忘记编辑
rule fastp
。我建议将此添加到您的问题中。答案部分应预留给公正的答案。