0
votes

I am writing rule to process some data:
data in directory will be something like:

myfirst.trim_1P, myfirst.trim_2P, mysecond.trim_1P, mysecond.trim_2P,...

rule trim_data:
        input:"{dataset}/{sample}.trim_{r}P"
        output:"{dataset}/{sample}.{r}.fastq"
        params:
            length=14
        shell:
            """
            reformat.sh forcetrimleft="{params.length}" in="{input}" out="{output}"
            """

I have this error:

WorkflowError:
RecursionError: maximum recursion depth exceeded
If building the DAG exceeds the recursion limit

myDir/myfirst.1.trimed.1.trimed.2.trimed.2.trimed.2....

Why it run in recursive way if the output different from the input? and how I can fix it?

2

2 Answers

0
votes

This is a wild guess... Maybe the wildcards capture more then they should since they are interpreted as regular expression. If {dataset}, {sample} and {r} take a defined list of values, try constraining their scope with:

wildcard_constraints:
    dataset= '|'.join([re.escape(x) for x in DATASET]),
    sample= '|'.join([re.escape(x) for x in SAMPLE]),
    r= '|'.join([re.escape(x) for x in R]),

Where DATASET, SAMPLE and R are lists of values (e.g. R= ['1', '2'])

0
votes

I had a similar error (below). This turned out to be caused by the fact the file name for the rule output was identical to a different rule. Changing the name of the output file fixed this error.

Code:

rule merge_sample_chr:
    input:

            bcftools=config["bcftools"],
            chr_list=expand(config["vcf_dir_ase"]+"/Eagle/all_{{sample}}_chr{this_chr}_sorted.vcf.gz",this_chr=CHRS)
    params:
            chr_list=expand("I="+config["vcf_dir_ase"]+"/Eagle/all_{{sample}}_chr{this_chr}_sorted.vcf.gz",this_chr=CHRS)

    output:
            vcf=config["vcf_dir_ase"]+"/Eagle/all_{sample}.vcf.gz"
    shell:
            """
            {input.bcftools} concat {input.chr_list} -Oz -o {output}
            """

Error:

WorkflowError:
RecursionError: maximum recursion depth exceeded in __instancecheck__
If building the DAG exceeds the recursion limit, this is likely due to a cyclic dependency.E.g. you might have a sequence of rules that can generate their own input. Try to make the output files more specific. A common pattern is 
Problematic file pattern: /path/samplid_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_chr1_.vcf.gz