Snakemake: Tranverse DAG depth-first?

Oct 02 2020

Snakemake ดูเหมือนจะสำรวจ DAG ในลักษณะที่กว้างเป็นอันดับแรก เป็นไปได้หรือไม่ (เช่นผ่านตัวเลือก / แฟล็ก / ฯลฯ ) เพื่อบังคับให้ snakemake สำรวจความลึก DAG ก่อน?

คำตอบ

2 Maarten-vd-Sande Oct 03 2020 at 14:51

วิธีหนึ่งที่ฉันสามารถทำได้คือการกำหนดลำดับความสำคัญสำหรับแต่ละกฎ:

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.output
    output:
        touch("second_{sample}.txt")
    priority: 2

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

และถ้าคุณเรียกใช้มันตอนนี้snakemake -j 1จะดำเนินการในเชิงลึกก่อน!