Snakemake cyclic dependency for gather operations
0
1
Entering edit mode
2.8 years ago
DBScan ▴ 450

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 • 1.0k views
ADD COMMENT
2
Entering edit mode

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"
ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1892 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6