Skip to content

Snakefile parser fails to parse derived rule #1596

@VukanJ

Description

@VukanJ

Snakemake version
6.15.5

Describe the bug
A derived rule overwrites fields like input and output. If the input and output file is written on the same line as the input keyword, the rule fails to parse.

Minimal example

rule copyfile:
    input: "src1.txt"
    output: "src1_cp.txt"
    shell: "cp -v {input} {output}"


use rule copyfile as copyfile2 with:
    input: "src2.txt"
    output: "src2_cp.txt"

This snakefile fails to parse the rule with the following error

SyntaxError in line 9 of /home/pathto/Snakefile:
Expecting a keyword or comment inside a 'use rule ... with:' statement. (Snakefile, line 9)

If the in- and outputs are written on separate lines like this, the rule can be parsed:

rule copyfile:
    input: "src1.txt"
    output: "src1_cp.txt"
    shell: "cp -v {input} {output}"


use rule copyfile as copyfile2 with:
    input:
        "src2.txt"
    output:
        "src2_cp.txt"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions