假设我有以下文件,我想使用 snakemake 自动对其进行一些处理:
test_input_C_1.txt
test_input_B_2.txt
test_input_A_2.txt
test_input_A_1.txt
以下蛇形expand
文件用于确定所有潜在的最终结果文件:
rule all:
input: expand("test_output_{text}_{num}.txt", text=["A", "B", "C"], num=[1, 2])
rule make_output:
input: "test_input_{text}_{num}.txt"
output: "test_output_{text}_{num}.txt"
shell:
"""
md5sum {input} > {output}
"""
执行上面的snakefile会导致如下错误:
MissingInputException in line 4 of /tmp/Snakefile:
Missing input files for rule make_output:
test_input_B_1.txt
该错误的原因是在后台expand
使用itertools.product
生成通配符组合,其中一些恰好对应于丢失的文件。
如何过滤掉不需要的通配符组合?