如何使snakemake重建丢失的输入?

问题描述

在缺少输入的情况下,snakemake是否有一种类似于make的行为? snakemake的当前行为是错误还是功能

$ ls
b  Makefile  Snakefile

$ cat Makefile
b: a
    touch b
a:
    touch a

$ make -n
touch a
touch b


$ cat Snakefile
rule b:
   input: "a"
   output: touch("b")

rule a:
   output: touch("a")


$ snakemake -n
Building DAG of jobs...
nothing to be done.

$ snakemake -v
5.20.1

解决方法

在您的情况下,a只是生成b的中间输出。由于b已经存在,因此Snakefile将什么也不做。

您可以使用-F参数调用snakemake来重做中间步骤

snakemake -n -F

或定义将ab都指定为最终输出的目标规则

rule all:
   input: "a","b"

rule b:
   input: "a"
   output: touch("b")

rule a:
   output: touch("a")