使用OR的两个通配符之间的wildcard_constraints

时间:2019-03-01 06:23:04

标签: snakemake

如果(id == 'FOO || (id == 'BAR' && ver == '2')),我想基于两个通配符来约束一条规则。但是,我不太确定该怎么做(或者是否可行)。我尝试了下面的示例,但似乎不起作用...

rule foo:
    input: "{id}{ver}.txt"
    output: "{id}{ver}.out"
    wildcard_constraints:
       id = "FOO"
    wildcard_constraints:
       id = "BAR",
       ver = "2"

1 个答案:

答案 0 :(得分:1)

我不确定您当前的方法是否行得通。为什么不简单地让snakemake为您提供所需的文件?例如:

rule all:
  input: expand('FOO{ver}.txt, ver=[somelist]), 'BAR2.txt'

rule foo:
  input: "{id}{ver}.txt"
  output: "{id}{ver}.out"
  shell: "some_command {input} > {output}  

这应为您指定的所有foo {ver} .txt文件和bar2.txt文件调用规则foo