Entering edit mode
8 days ago
Ana
▴
10
Hi,
I am doing a dry-run on a snakefile but I am getting an error:
SyntaxError in file /snakefile, line 22:
invalid decimal literal:
None
Line 22 looks like this:
expand(f'/{{CHR}}.merged.split.no_geno.annotated.vcf.gz', CHR = chrlist)
To clarify, chrlist comes from
chrlist = config['chromosomes']
in line 5. The path to the config file is also declared in line 1. Anyone knows what could be causing this issue? Thanks in advance.
I am not a SnakeMake person but what is the
f
supposed to be?f'/{{...
That's Python's f-string, which in this case just turns
{{CHR}}
into{CHR}
, which is then in turn handled by Snakemake'sexpand
function (which also happens to use curly braces) to do its own string templating with what's presumably a list of stuff to use in the filenames... which means there's no need for the f-string here, actually.In an interactive Python interpreter, with Snakemake installed:
Or without the redundant f-string:
I can't think of why that line would give that error no matter what chrlist contains, but, Snakemake can sometimes report misleading line numbers when it runs into problems early in parsing files... Ana, I'd put some
print
calls in a few spots and see what things look like. Does chrlist look like you expect? What other code is around line 22? If you're stumped, make an as-small-as-possible Snakefile that gives the error and then you can share the whole thing verbatim. (Also, it's odd that you have a leading / on the path, but I'd say that's a separate potential issue.)Thank you so much for this! I am going to add some print calls and see, as well as a toy snakefile. The redundancy between f and expand is not what's giving the error though (I' ve tried removing it and the same error arises). Also, the leading / is because I deleted the complete path and must have forgotten that!
That all makes sense! My best guess is something totally unexpected from somewhere else in the file and it's reporting the wrong line. (It looks like that error is what Python throws if you use an invalid name like
0variable = "something"
in regular Python. So maybe it's a problem during Snakemake's parsing of your file, I wonder. Edit: the same error also comes up withvariable = 0something
, if that ends up looking relevant for your code somehow.)