You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Anneliek ter Horst
Hello!
I have a question regarding input files.
When defining input files at the top of a Snakefile, like this:
SAMPLES, = glob_wildcards('/group/ctbrowngrp2/scratch/annie/2023-sourmash-viruses/{ident}.fa
Why is the , needed after SAMPLES? 11:14 AM
titus
💬 glob_wildcards returns an object that (among other things) can be unpacked via iteration. The SAMPLES, says “please unpack this via iteration; I expect one element only.”
11:14 AM
it is equivalent to
SAMPLES = list(glob_wildcards(...))[0]
with the added bonus that if there is more than one element in the list, Python complains. 11:16 AM
The object itself is pretty cool. You could also do
wc_obj = glob_wildcards(...)
SAMPLES = wc_obj.ident
as a way of pulling out just the matches to ident . If you had multiple wildcards being learned by glob_wildcards, this would be a good way to access them.
The text was updated successfully, but these errors were encountered:
Anneliek ter Horst
Hello!
I have a question regarding input files.
When defining input files at the top of a Snakefile, like this:
SAMPLES, = glob_wildcards('/group/ctbrowngrp2/scratch/annie/2023-sourmash-viruses/{ident}.fa
Why is the , needed after SAMPLES?
11:14 AM
titus
💬 glob_wildcards returns an object that (among other things) can be unpacked via iteration. The
SAMPLES,
says “please unpack this via iteration; I expect one element only.”11:14 AM
it is equivalent to
SAMPLES = list(glob_wildcards(...))[0]
with the added bonus that if there is more than one element in the list, Python complains.
11:16 AM
The object itself is pretty cool. You could also do
wc_obj = glob_wildcards(...)
SAMPLES = wc_obj.ident
as a way of pulling out just the matches to ident . If you had multiple wildcards being learned by glob_wildcards, this would be a good way to access them.
The text was updated successfully, but these errors were encountered: