user3224522
user3224522

Reputation: 1151

Snakemake create wildcards

I have an input file like below. When I create wildcards, I get an error that the files are not found, because they have specific combinations.

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

How to create a wildcards for these files?

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
        """

Upvotes: 1

Views: 74

Answers (1)

Dmitry Kuzminov
Dmitry Kuzminov

Reputation: 6584

You may zip two lists, but as @Maarten-vd-Sande said, the lists have to match:

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)

Upvotes: 3

Related Questions