Search code examples
snakemake

Is it possible in snakemake to produce reports and the DAG images automatically?


I would like to automatically produce the report and DAG images automatically after running the workflow in snakemake. Also I would like to create the report with a given name, e.g. specified in the config.yaml.

I cannot use the snakemake shell command inside the Snakefile which I would usually use to create the reports manually.

The code I would use for creating the report manually:

snakemake --report

The code for manually creating the DAG image:

snakemake --rulegraph | dot -Tpdf > dag.pdf

How can I do this in the Snakefile?

Thanks for any help!


Solution

  • You could do this but it looks pretty ugly to me. At the end of your Snakefile add:

    onsuccess:
        shell(
            r"""
            snakemake --unlock
            snakemake --report
            snakemake --rulegraph | dot -Tpdf > dag.pdf
            """)