Search code examples
pythongrepbioinformaticssnakemakedot

Snakemake: Hiding certain rules from DAG visualisation


In my snakemake pipeline, I have an 'all' rule, which located at the very bottom of the DAG of jobs. It's essentially the entry point for snakemake, but it doesn't do anything other than list all of the desired outputs.

Is there a way to hide this rule from the DAG visualization?

enter image description here


Solution

  • Running snakemake --dag generates a dot graph that can be modified as needed. For example:

    snakemake --dag > test.dot
    # edit test.dot to remove node 0 and all edges linking it
    dot -Tpng test.dot -o test.png
    

    In principle, editing of the dot file can also be automated using grep/sed/awk:

    snakemake --dag | grep -v "> 0\|0\[label" | dot -Tpng -o test.png