'Is it possible to parse a Snakemake file?
I was wondering if is possible to programmatically parse a snakemake file. Snakefiles can often contain dynamic content both from python functions as well as wildcards that need to be resolved. I was wondering if its possible to resolve this content and then query the resulting rules/targets i.e. something like this (pseudo code):
./Snakefile:
rule:
input: "program.py"
output: "output_{suffix}.out"
shell: "python program.py --arg {wildcard.suffix}"
Parsing code:
ps = parse_snakemake("./Snakefile", target ="output_VAR.out")
print(ps.rules[0].shell)
#> "python program.py --arg VAR"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
