feat: enable user to configure CLI params per rule
Closes #155 (closed)
- added
rule_config.yamltotests/input_files/. Here, additional parameters for all rules in main Snakefile and single/paired-end Snakefiles can be set - before each rule a variable
current_ruleis set to the name of the current rule. This workaround is necessary, as currently the snakemake directive {rule} can only be accessed from within the shell calls, whereas we need to access it from theparamssection - Parsing the
rule_config.yaml:- In main Snakefile,
rule_config.yamlwill be loaded into arule_config dict; if norule_config.yamlspecified,rule_config dictwill be empty and all tools will run with default parameters. - In main Snakefile, a function
parse_rule_configis defined, which takes as input the rule_config dict, the current rule name, and a tuple of arguments that must not be changed for the current rule from within the rule config ("immutable" arguments) in order to ensure proper functioning of the pipeline. Immutable arguments are those that either influence a tool's behavior in a way that is critical for pipeline wiring, or those that are defined in the samples table. Returns a string with all additional parameter-value pairs. - in
paramssection of each rule the above described function is called. Parameters read from therule_config.yamlare then injected as a string in the respective shell calls to the tools
- In main Snakefile,
- Adapted config.yaml for tests accordingly
- Adapted pipeline documentation accordingly
- The variable
current_ruleis used for logfile naming in each rule - Adapted
zarp_multiqc_config.pyaccordingly
Edited by Alex Kanitz