代码更改后 Snakemake 中的 MissingRuleException

MissingRuleException in Snakemake after code changes

我有这两条规则:

all_participants = ['01','03','04','05','06','07','08']
rule all:
    input: expand("data/interim/tables/screen/p{participant_id}.csv",participant_id=all_participants)

rule extract_screen_table:
    output: "data/interim/tables/screen/p{participant_id}.csv"
    shell: "python src/data/sql_table_to_csv.py --table screen"

如果我执行 snakemake 一切正常,但如果我更改代码并执行:snakemake -n -R 'snakemake --list-code-changes' 我会收到此错误:

Building DAG of jobs...
MissingRuleException:
No rule to produce snakemake --list-code-changes (if you use input functions make sure that they don't raise unexpected exceptions).

snakemake --list-code-change 的输出是:

Building DAG of jobs...
data/interim/tables/screen/p03.csv

我认为不应该,我应该得到 python 脚本。

您必须为 list-code-changes 使用反引号:`snakemake --list-code-changes`。这是 bash 语法,用于执行包含的命令和 return STDOUT 作为字符串。