Snakemake问题:将所有文件与空格分隔符合并在一起,而不是通过它进行迭代]]

问题描述 投票:0回答:1

我试图运行理想情况下看起来像这样的命令,

minimap2 -a -x map-ont -t 20 /staging/reference.fasta fastq/sample01.fastq | samtools view -bS -F 4 - | samtools sort -o fastq_minon/sample01.bam

类似地,我在文件夹中有多个样本(指的是fastq / sample01.fastq

)。

但是,我为使这种行为自动化而编写的snakemake文件是在命令中同时解析所有文件,例如,

minimap2 -a -x map-ont -t 1 /staging/reference.fasta fastq/sample02.fastq fastq/sample03.fastq fastq/sample01.fastq | samtools view -bS -F 4 - | samtools sort -o fastq_minon/sample02.bam fastq_minon/sample03.bam fastq_minon/sample01.bam

我已经在下面粘贴了代码和日志。请帮助我尝试找出此错误。

代码

SAMPLES, = glob_wildcards("fastq/{smp}.fastq")
rule minimap:
    input:
        expand("fastq/{smp}.fastq", smp=SAMPLES)
    output:
        expand("fastq_minon/{smp}.bam", smp=SAMPLES)
    params:
        ref = FASTA
    threads: 40
    shell:
        """
        minimap2 -a -x map-ont -t {threads} {params.ref} {input} | samtools view -bS -F 4 - | samtools sort -o {output}
        """

log

Building DAG of jobs...
Job counts:
        count   jobs
        1       minimap
        1

[Tue May  5 03:28:50 2020]
rule minimap:
    input: fastq/sample02.fastq, fastq/sample03.fastq, fastq/sample01.fastq
    output: fastq_minon/sample02.bam, fastq_minon/sample03.bam, fastq_minon/sample01.bam
    jobid: 0


        minimap2 -a -x map-ont -t 1 /staging/reference.fasta fastq/sample02.fastq fastq/sample03.fastq fastq/sample01.fastq | samtools view -bS -F 4 - | samtools sort -o fastq_minon/sample02.bam fastq_minon/sample03.bam fastq_minon/sample01.bam

Job counts:
        count   jobs
        1       minimap
        1
This was a dry-run (flag -n). The order of jobs does not reflect the order of execution.

我正在尝试运行理想的命令,如下所示:minimap2 -a -x map-ont -t 20 /staging/reference.fasta fastq / sample01.fastq | samtools视图-bS -F 4-| samtools排序-o fastq_minon / ...

snakemake
1个回答
2
投票

expand功能用于创建列表。因此,在您的规则minimap中,您告诉snakemake您希望所有fastq文件都作为输入,并且该规则将产生尽可能多的bam文件。您想要的是一个将使用通配符为每个样本触发的规则:

© www.soinside.com 2019 - 2024. All rights reserved.