Skip to content

feat: enable user to configure CLI params per rule

CJHerrmann requested to merge rule_config_params into dev

Closes #155 (closed)

  • added rule_config.yaml to tests/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_rule is 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 the params section
  • Parsing the rule_config.yaml:
    • In main Snakefile, rule_config.yaml will be loaded into a rule_config dict; if no rule_config.yaml specified, rule_config dict will be empty and all tools will run with default parameters.
    • In main Snakefile, a function parse_rule_config is 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 params section of each rule the above described function is called. Parameters read from the rule_config.yaml are then injected as a string in the respective shell calls to the tools
  • Adapted config.yaml for tests accordingly
  • Adapted pipeline documentation accordingly
  • The variable current_rule is used for logfile naming in each rule
  • Adapted zarp_multiqc_config.py accordingly
Edited by Alex Kanitz

Merge request reports