3

What's a good way to add a help function to my Snakemake pipeline to describe config parameter usage? I'm seeing this for printing rule docstrings, but I'm not sure if/how that can be used for config values.

amm
  • 81
  • 1
  • 3

2 Answers2

0

I don't think this is possible with vanilla Snakemake.

However, this is possible with snakeparse: https://github.com/nh13/snakeparse. Unfortunately, the project has not been updated since April 2018 (as of August 18th, 2021).

dofree
  • 401
  • 2
  • 4
0

If coming from a configfile: "config.yaml", the config object will be a dictionary which one could iterate through. A basic example would be simply listing the keys:

Snakefile

configfile: "config.yaml"

rule help:
  run:
    print("Configuration keys:")
    for k in config.keys():
      print(k)

On the more sophisticated end, I would consider creating a JSON schema for validating the parameters and then write a function to print the JSON schema file in a pretty way, since that validation file should contain all the pertinent information about the parameters.

merv
  • 67,214
  • 13
  • 180
  • 245