我怎样才能在规则上确保所有输出文件夹都已正确创建? 我应该添加每个预期结果文件吗?
以某种方式与snakemake define folder as output相关,但在我的情况下,指定的“输出”是指向目录的路径和所有结果文件的前缀(它们可能是多个)的组合
以下命令创建文件夹路径Analysis / MosDepth并将文件添加到该路径:
gt0.mosdepth.global.dist.txt
gt0.mosdepth.region.dist.txt
gt0.per-base.bed.gz
gt0.per-base.bed.gz.csi
gt0.regions.bed.gz
gt0.regions.bed.gz.csi
rule MosDepth:
input:
bam = "Analysis/Minimap2/"+UnpackedRawFastq+".bam",
bed = "ReferenceData/"+UnpackedGenomeGFF+"_exons.bed"
output:
pfx = "Analysis/MosDepth/gt0"
threads: config["threads"]
shell:
"mosdepth -t {threads} -b {input.bed} {output.pfx} {input.bam}"
我目前在规则全部中只有一个文件:这是否足够?是否有更好的方法来确保mosdepth运行良好,并且在以后的重新运行中不再重做?
rule all:
input:
"Analysis/MosDepth/gt0.regions.bed.gz"
答案 0 :(得分:2)
我会推荐这样的东西:
mos_out = ['gt0.mosdepth.global.dist.txt', 'gt0.mosdepth.region.dist.txt', 'gt0.per-base.bed.gz', 'gt0.per-base.bed.gz.csi', 'gt0.regions.bed.gz', 'gt0.regions.bed.gz.csi']
rule MosDepth:
input:
bam = "Analysis/Minimap2/"+UnpackedRawFastq+".bam",
bed = "ReferenceData/"+UnpackedGenomeGFF+"_exons.bed"
output:
expand("Analysis/MosDepth/{mos_out}", mos_out=mos_out)
params:
pfx = "Analysis/MosDepth/gt0"
threads: config["threads"]
shell:
"mosdepth -t {threads} -b {input.bed} {params.pfx} {input.bam}"
如果规则未创建输出文件之一,snakemake将为您删除所有输出文件,并引发错误。