在snakemake中,对于给定的规则,拥有资源使用永久性的最佳方法是什么?这意味着给定规则的resources
继承以下规则。一个例子是在分区(例如/dev/shm
)中一次限制一个输入bam文件,而随后的规则正在使用它:
samples = ["sample1", "sample2", "sample3"]
motifs = ["motif_1", ... , "motif_n"]
rule all:
input: expand("output/{sample}.{motif}.out", sample=samples, motif=motifs)
rule copy_bam_to_shm:
input: "{sample}.bam"
output: temporary("/dev/shm/{sample}.bam")
resources: shm_usage = 1
shell: "cp {input} {output}"
rule process_motif:
input:
bam = rules.copy_bam_to_shm.output,
motif = "{motif}.bed"
output: "output/{sample}.{motif}.out"
shell: "run_bed_bam_and_beyond.py {input.bam} {input.bed} > {output}"
我想要的是,copy_bam_to_shm
中声明的shm_usage
资源约束保持不变,同时我正在为当前示例运行所有后续的process_motif
步骤—使用尽可能多的并发作业执行后一个规则。只有在sample1.bam完成之后,sample2.bam才会被复制到/dev/shm
并进行处理,依此类推。如果不清楚,请参阅下面的伪代码以了解我需要的行为:
# Pseudocode
for sample in samples
copy sample.bam to /dev/shm
for motif in motifs
process motif (in parallel with as many motifs as possible)
remove sample.bam from /dev/shm
done
目前没有回答
相关问题 更多 >
编程相关推荐