dynamic input/output in the snakemake rules
0
0
Entering edit mode
6 weeks ago
ali • 0

I'm trying to use Snakemake rules to split and process the big bam files. in the splitBam rule, I split the Bam file using a dynamic output which I called in the Count rule. when I try these I get the following error :

data/raw_data/set1/__snakemake_dynamic___R1.fq.gz

there is any solution to iterate the input list? thanks!

 rule SplitBam :
        input: 
            sort = intermediate_path + "/bamSortByName/{sample}.sortByName.bam"
        output:
            sub = dynamic(intermediate_path +"/bamSortByName/{sample}.sortByName.REF_chr{part}.bam")
        conda:
            "env.yaml"
        shell:
            'bamtools split -in {input.sort} -reference'

rule TEcount :
        input: 
            sub =  intermediate_path +"/bamSortByName/{sample}.sortByName.REF_chr{part}.bam",
            annotation = config["ANNOTATION"],
            anno_te = config["GTFTE"]      
        output:
            countT = final_path +"/repeats" +"/countTables/{sample}_{part}_TE_count.tsv"
        conda:
            "env.yaml"
        params:
            mp = main_path,
            sm = "{sample}"+"_"+"{part}",
            tablet =  main_path + "{sample}_{part}_TE_count.tsv"
        shell:
            "python {params.mp}scripts/TEcount.py --format BAM --mode multi -b {input.sub} --GTF {input.annotation} --TE {input.anno_te} --stranded {strand} --project {params.sm} && mv -f {params.tablet} {output.countT}"

rule merge: 
        input:
            splittable = dynamic( final_path +"/repeats" +"/countTables/{sample}_{part}_TE_count.tsv")
        output:
            mergetable = final_path + "/repeats" +"/countTables/{sample}_mergeTE_count.tsv"
        params:
            prefix= final_path + "/repeats"+"/countTables/{sample}_",
            sufix = "_TE_count.tsv"
        shell:
            "cat {params.prefix}*{params.sufix} > {output.mergetable}"
RNAseq Snakemake dynamic bam • 85 views
ADD COMMENT

Login before adding your answer.

Traffic: 1943 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