Snakemake's SyntaxError positional argument follows keyword argument
2
0
Entering edit mode
8 months ago
ema ▴ 10

Hello all,

I'm trying to dry-run a snakemake pipeline but I get a SyntaxError in line 75 "positional argument follows keyword argument". The thing is, it's pointing towards a benchmark line (*) in an intermediate rule, that follows the same pattern as previous rules... I don't understand what might be the problem.

This is the structure of the rules I'm writing:

rule name:
    input:
        i1 = "...",
        i2 = "..."
    output:
        a = "...",
        b = "...",
        c = "..."
    threads:
        n
    log:
        "..."
    *benchmark:
        "benchmarks/(...).benchmark.txt"
    message:
        "(...)"
    shell:
        """
        (...)
        """

All the input and output files are named and separated by commas. Nevertheless, the error points to 'benchmark:' (*). Does anyone know why this is happening?

EDIT: If I remove the benchmark line, the error simply points to the previous or the next line in the rule, and if I keep chipping away at the rule, (leaving only the input lines), eventually the error points to an empty line. If I add/remove empty lines between rules, the error points to different empty lines or, when there are none, to any line in the closest rule. I have no idea what this is.

Thank you.

snakemake • 927 views
ADD COMMENT
0
Entering edit mode

Please explain how this is related to bioinformatics.

ADD REPLY
1
Entering edit mode
8 months ago
ema ▴ 10

Hello again,

In the meantime I fixed the code. This SyntaxError in particular wasn't real. I went ahead and fixed some minor errors in the code (mistyping, extra commas and whatnot) and this specific SyntaxError eventually disappeared. This was most likely a bug on Snakemake's part, not being able to locate the real error. It's a shame because it made me waste a lot of time.

ADD COMMENT
2
Entering edit mode
8 months ago

It's unlikely it is a bug in snakemake. My guess is that you had something like this:

rule one:
    output:
        'done.txt',
    params:
        a='x', # <- Keyword argument
        'y',   # <- Positional argument

This would be ok:

rule one:
    output:
        'done.txt',
    params:
        'y',
        a='x',
ADD COMMENT

Login before adding your answer.

Traffic: 1981 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6