Snakemake 创建通配符

Snakemake create wildcards

我有一个如下所示的输入文件。当我创建通配符时,出现找不到文件的错误,因为它们有特定的组合。

bob_78/clip/bob_78.hjckl87.dup.srt.bam
bob_79/clip/bob_79.hjckl87.dup.srt.bam
bob_80/clip/bob_80.hjpolxf.dup.srt.bam
bob_81/clip/bob_81.hjpolxf.dup.srt.bam
bob_82/clip/bob_82.hgfhj29.dup.srt.bam

如何为这些文件创建通配符?

SAMPLE=["bob_78","bob_79","bob_80","bob_81","bob_82"]
PREFIX=["hjckl87","hjpolxf","hgfhj29"]

rule all:
    expand("OUTDIR/{sample}.{prefix}.clipped.txt", sample=SAMPLES, prefix=PREFIX)

rule xxx:
    input:
        ins="{sample}/clip/{sample}.{prefix}.dup.srt.bam"
    output:
        outfile="OUTDIR/{sample}.{prefix}.clipped.txt"
    shell:
        """
        some code
        """

您可以 zip 两个列表,但正如@Maarten-vd-Sande 所说,列表必须匹配:

SAMPLE=["bob_78", "bob_79", "bob_80", "bob_81", "bob_82"]
PREFIX=["hjckl87", "hjckl87", "hjpolxf", "hjpolxf", "hgfhj29"]

rule all:
    expand("OUTDIR/{sample}.{prefix}.clipped.txt", zip, sample=SAMPLES, prefix=PREFIX)