Home > Mobile >  Reserved name in Snakemake?
Reserved name in Snakemake?

Time:08-24

I use Snakemake version 7.12.1 and I get the following error while trying to execute a pipeline:

AttributeError: invalid name for input, output, wildcard, params or log: pop is reserved for internal use

I normally use the word pop as wildcard for population with no issue. After the raised error, I made it changed to another word and it looks like the error is gone. Would someone confirm that pop is now a reserved name or there is another explanation for? I checked the snakemake manuall and there is no any related notification.

CodePudding user response:

Would someone confirm that pop is now a reserved name or there is another explanation for?

Yes, pop is reserved because internally some processes use .pop method to remove items from the directives.

Internally, the directives (input/output/etc) are stored as a Namedlist which inherits methods from the list. So almost all the methods defined for list (and Namedlist) will trigger this error, e.g. remove, reverse. There are two hard-coded whitelisted exceptions: index and sort.

This change has been added a couple of years ago, so you must have been running a much older snakemake version.

Here's a small Snakefile for testing:

rule all:
    input: 'test.txt'
    
rule test:
    output:
        # this will err
        pop = 'test.txt'
    shell: 'echo {output}'
  • Related