Skip to content Skip to sidebar Skip to footer

Snakemake: Tranverse Dag Depth-first?

Snakemake appears to traverse the DAG in a breadth-first manner. Is it possible (e.g. through an option / flag / etc.) to force snakemake to traverse the DAG depth-first?

Solution 1:

One way I can come up with is by setting priorities for each rule:

rule all:
    input:
        ["third_a.txt", "third_b.txt", "third_c.txt"]

rule first:
    output:
        touch("first_{sample}.txt")
    priority: 1

rule second:
    input:
        rules.first.outputoutput:
        touch("second_{sample}.txt")
    priority: 2

rule third:
    input:
        rules.second.outputoutput:
        touch("third_{sample}.txt")
    priority: 3

and if you now run it with snakemake -j 1 it is executed depth-first!

Post a Comment for "Snakemake: Tranverse Dag Depth-first?"