Is it possible to have the snakemake file and/or the rules files configured to execute certain rules only in certain cases using command line switches.
To elaborate, lets say I have these rules in my rules folder:
Is it possible to configure/execute the workflow in this way:
snakemake --user_option 2a
will cause rule 1, rule 2a,
rule 3 to be invokedsnakemake --user_option 2b
will cause rule 1, rule 2b, rule 3 to be invokedThanks in advance.
You could pass the user_option
as a configuration key at the command line and then have an if-else
that decides what intermediate rule to use. E.g.
snakemake --config option='2a'
The dummy Snakefile:
rule all:
input:
'output.txt',
rule one:
output:
'foo.txt'
if config['option'] == '2a':
rule two_a:
input:
'foo.txt',
output:
'bar.txt',
elif config['option'] == '2b':
rule two_b:
input:
'foo.txt',
output:
'bar.txt',
else:
sys.exit() ## handle this case
rule three:
input:
'bar.txt',
output:
'output.txt',