0

我正在尝试使用 Snakemake 规则来拆分和处理大 bam 文件。在 splitBam 规则中,我将 Bam 拆分为我尝试在 Count 规则中使用的动态输出。当我尝试这些时,我得到了错误:

data/raw_data/set1/__snakemake_dynamic___R1.fq.gz

有没有迭代输入列表的解决方案?谢谢!

 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}"
4

0 回答 0