Reputation: 1080
This appears to work in SnakeMake to chain parameters. Is this okay to do, or is it going to cause problems in parallel environment, and should a PersistentDict be used instead?
rule a:
params:
a = "Param A", b="Param B"
...
rule b:
params: rules.a.params.b
Upvotes: 0
Views: 82
Reputation: 441
I would advise against that approach as it results in a needlessly coupled system
E.g Now "rule b" must ALWAYS be accompanied by "rule a"
I say needlessly because another option is to declare external variables in a YAML (or JSON) file and have both param directives accept it as an argument.
config.yaml ~ Personal Example
a: Param A
b: Param B
Snakefile ~ Personal Example with just a single rule
configfile: "config.yaml"
rule a:
...
params:
importantRuleAVar = config["a"]
....
rule b:
...
params:
importantRuleBVar = config["a"]
...
This is critical in my pipeline as I need the same wildcard_constraint regex for large parts of my pipeline, yet I didn't want to end up coupling all the rules together.
Also good for things like quality thresholds on aligners. Sometimes you'll use similar thresholds in different aligners for comparative purposes.
Upvotes: 2