Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

snakemake: Problem with --rerun-triggers flag and bash variable

Tags:

bash

snakemake

I have a problem when I try to provide the --rerun-triggers flag as a bash variable.

My command is

snakemake $snakemake_extra -pr --snakefile Snakefile --configfile config.yaml -c 20 -n

and snakemake_extra is a bash variable defined as

snakemake_extra="--rerun-triggers {mtime,input,params}"

I get the following error:

snakemake: error: argument --rerun-triggers: invalid choice: '{mtime,input,params}' (choose from 'mtime', 'params', 'input', 'software-env', 'code')

The problem seems to be that snakemake(?) adds single-quotes before and after the {}.

When I insert the --rerun-triggers flag directly (without bash variable) it works fine. I need the bash variable however and can also not use a snakemake profile yaml.

Is there any possible workaround?

I am using snakemake version 7.12.1.

Thanx, Carlus

like image 942
Carlus Avatar asked Sep 12 '26 14:09

Carlus


1 Answers

Bash expands the braces when you provide them on the command line without embedding them in a variable, but it won't otherwise (see, for example, Brace expansion from a variable in Bash). A fix is to expand your variable before using it:

snakemake_extra="--rerun-triggers mtime input params"
like image 101
sappjw Avatar answered Sep 15 '26 08:09

sappjw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!