Search code examples
pythonsnakemakedirected-acyclic-graphsdot

Specify a color for each rule in Snakemake DAG


I'm running snakemake -n -c1 --dag | dot -Tsvg > dag.svg to get the DAG file. I was wondering if I could somehow set the color scheme for every node. For example, in the picture below, rule samtools_fixmate is of different color from samtools_sort and of samtools_markduplicates. Can you somehow specify within snakemake file what color the nodes should be?

I'll settle even for out-of-snakefile solutions.

enter image description here


Solution

  • Similar to this answer, you can export the dag into a dot file:

    snakemake --dag > test.dot
    

    The dot file can then be edited as necessary.