This is a test version of Biostars. For the public version, visit https://www.biostars.org.
dynamic input/output in the snakemake rules

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

0 answers

No answers yet.

Log in to answer this question.