Search code examples
yamlsnakemake

Snakemake specifying configuration parameter from nested config.yaml file on the command line


Say I have a config.yaml file such as follows

results: "results/"
reference_database: "data/zymogen_alignment_file.fasta"

basecall:
    perform_basecall: True
    configuration: "dna_r9.4.1_450bps_hac.cfg"

I can access all the parameters in my Snakefile, such as config["results"], config["basecall"]["perform_basecall"], etc.

I can override the results and reference_database parameter easily
snakemake --cores all --config results="/my/new/results/path" reference_database="/my/new/reference/database"

However, I can't seem to be able to override the parameters under basecall. I have tried the following
snakemake --cores all --config basecall["perform_basecall"]=False

But this results in the error: Invalid config definition: Config entry must start with a valid identifier.

Is it possible to override parameters in a nested configuration file?
Thanks for any help!


Solution

  • Try using JSON object syntax. In this specific case, something like

    snakemake -j all --config basecall='{perform_basecall: False}'
    

    Testing this, it seems to retain the rest of the object (i.e., the configuration value) and just overrides the perform_basecall value.