是否可以使用命令行标志 enable/disable 某些 Snakemake 规则
Is it possible to enable/disable certain Snakemake rules using command line flags
是否可以将 snakemake 文件 and/or 规则文件配置为仅在某些情况下使用命令行开关执行某些规则。
为了详细说明,假设我的规则文件夹中有这些规则:
- 规则 1
- 规则 2a
- 规则 2b
- 规则 2c
- 规则 3
是否可以configure/execute这样的工作流程:
- 呼叫
snakemake --user_option 2a
将导致规则1、规则2a、
要调用的规则 3
- 调用
snakemake --user_option 2b
将导致调用规则1、规则2b、规则3
- 等等
提前致谢。
您可以在命令行中将 user_option
作为配置键传递,然后使用 if-else
来决定要使用的中间规则。例如。
snakemake --config option='2a'
虚拟 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',
是否可以将 snakemake 文件 and/or 规则文件配置为仅在某些情况下使用命令行开关执行某些规则。
为了详细说明,假设我的规则文件夹中有这些规则:
- 规则 1
- 规则 2a
- 规则 2b
- 规则 2c
- 规则 3
是否可以configure/execute这样的工作流程:
- 呼叫
snakemake --user_option 2a
将导致规则1、规则2a、 要调用的规则 3 - 调用
snakemake --user_option 2b
将导致调用规则1、规则2b、规则3 - 等等
提前致谢。
您可以在命令行中将 user_option
作为配置键传递,然后使用 if-else
来决定要使用的中间规则。例如。
snakemake --config option='2a'
虚拟 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',