Omics Academy

Snakemake error: NameError: The

2018-11-29  本文已影响0人  OmicsAcademy

Re: [Snakemake] Re: Debugging help: The name 'individual' is unknown in this context.

Hi Johannes,

I figured it out myself. And indeed it was an error on my end as well.
I was trying to get something done for all files in a specific directory.

I was first trying it as follows:
FILES, = glob_wildcards("./input/{filename}")

rule all:
input: expand("./output/{filename}", filename = FILES)

rule processFile:
input: "./input/{filename}"
output: "./output/{filename}"
message: "Processed {filename}\n"
shell: "mv ./input/{filename} ./output/filename}"

Error produced:
RuleException in line 5 of Snakefile:
NameError: The name 'filename' is unknown in this context. Pleasemake sure that you defined that variable. Also note that braces not used for variable access have to be escaped by repeating them, i.e. {{print $1}}

(By the way, type in Please make sure...)
Note that line 5 is empty, so there can be no error there. (this really made it more difficult for me)

But the correct code is:
FILES, = glob_wildcards("./input/{filename}")

rule all:
input: expand("./output/{filename}", filename = FILES)

rule processFile:
input: "./input/{filename}"
output: "./output/{filename}"
message: "Processed {input}\n"
shell: "mv {input} {output}"

I guess the error was mainly that I used the wild cards in the wrong place.
I hope this will help others, who want to achieve a similar thing.

Kind regards,

Willem

上一篇下一篇

猜你喜欢

热点阅读