summaryrefslogtreecommitdiff
path: root/snakemake-file-targets
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-02-28 03:37:28 -0500
committerKyle Meyer <kyle@kyleam.com>2016-02-28 03:46:06 -0500
commit0f6a001f2a6450a837476f9719a28235f2e95d50 (patch)
tree49b2b233d75cd98001b871a3cdd35a4474f16ae3 /snakemake-file-targets
parent737484092c3afc994eeab446b805b0998853b47d (diff)
downloadsnakemake-mode-0f6a001f2a6450a837476f9719a28235f2e95d50.tar.gz
Add snakemake-file-targets script
Diffstat (limited to 'snakemake-file-targets')
-rwxr-xr-xsnakemake-file-targets25
1 files changed, 25 insertions, 0 deletions
diff --git a/snakemake-file-targets b/snakemake-file-targets
new file mode 100755
index 0000000..12dca78
--- /dev/null
+++ b/snakemake-file-targets
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+"""Print all concrete file targets.
+
+Usage: snakemake-file-targets [SNAKEFILE]
+"""
+import sys
+from snakemake.workflow import Workflow
+
+if len(sys.argv) == 1:
+ snakefile = "Snakefile"
+elif len(sys.argv) == 2 and sys.argv[1] not in ["-h", "--help"]:
+ snakefile = sys.argv[1]
+else:
+ sys.exit(__doc__)
+
+workflow = Workflow(snakefile=snakefile, snakemakepath="snakemake")
+workflow.include(snakefile)
+
+for rule in workflow.rules:
+ for fname in rule.output:
+ if not callable(fname) and not fname.contains_wildcard():
+ try:
+ print(fname)
+ except BrokenPipeError:
+ sys.exit(0)