是否可以使用命令行标志 enable/disable 某些 Snakemake 规则

Is it possible to enable/disable certain Snakemake rules using command line flags

是否可以将 snakemake 文件 and/or 规则文件配置为仅在某些情况下使用命令行开关执行某些规则。

为了详细说明,假设我的规则文件夹中有这些规则:

是否可以configure/execute这样的工作流程:

提前致谢。

您可以在命令行中将 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',