This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Snakemake cyclic dependency for gather operations

I have some problems when I try to perform split/gather operations (like GatherVCFs from GATK for instance). In the example below I have two samples. I would like to split each sample into 4 parts (rule split), and then gather all 4 parts of a sample (rule gather). However, the code throws me a Cylic depencency error:

PeriodicWildcardError: The value -1 in wildcard sample is periodically repeated (TEST1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1).

What am I doing wrong here?

SAMPLE = ["TEST1", "TEST2"]
out_dir = "/home/"
in_dir = out_dir


rule all:
        input:
                expand(out_dir + "{sample}.txt", sample = SAMPLE)
rule scatter:
        input:
                in_dir + "{sample}.txt"
        output:
                in_dir + "{sample}-{scatter}.txt"

rule gather:
        input:
                lambda wildcards: expand(in_dir + "{sample}-{scatter}.txt", sample = wildcards.sample, scatter = [1,2,3,4])
        output:
                out_dir + "{sample}.txt"
snakemake

This did the trick for me. The problem came from the fact that the input of the workflow was also the output.

SAMPLE = ["TEST1", "TEST2"]
out_dir = "/home/"
in_dir = "/out_dir/"


rule all:
        input:
                expand(out_dir + "{sample}.txt", sample = SAMPLE)
rule scatter:
        input:
                in_dir + "{sample}.txt"
        output:
                in_dir + "{sample}-{scatter}.txt"

rule gather:
        input:
                expand(in_dir + "{{sample}}-{scatter}.txt",  scatter = [1,2,3,4])
        output:
                out_dir + "{sample}.txt"

Which snakemake version are you using? in 6.12.3 your suggestion didn't work unfortunately.

I am using snakemake 4.3.0 (a bit outdated unfortunately).

0 answers

No answers yet.

Log in to answer this question.