Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to create rule-graph #7

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions snakemake.el
Expand Up @@ -350,6 +350,17 @@ targets."
(snakemake-all-rules))
" "))

(defun snakemake-graph-workflow ()
(interactive)
"""Creates a graph for the current snakefile."""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring should be moved up a line and should only consist of
a single set of double quotes.

(let ((dot (shell-command-to-string "which dot")))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to have this as a customizable variable, as is done with snakemake-program.

(when (equal dot "")
(error "You do not have dot (graphviz) on your emacs path!")))
(let* ((fname (buffer-file-name))
(graphname (concat (buffer-file-name) ".pdf"))
(graph-command (concat "snakemake --dag --snakefile " fname " | dot -Tpdf > " graphname)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, but this is limited to creating the graph for the first rule of
the Snakefile, right? Instead, a compile command could be constructed
(similar to what is done in snakemake-compile). This could default
to naming the output something like <rule>-dag.pdf, but the user could
edit the compile command further.

(shell-command graph-command)))


;;; Compilation commands

Expand Down