-
Notifications
You must be signed in to change notification settings - Fork 634
Description
Snakemake allows to load modules via the module statement which is very helpful.
As far as I've researched, its name cannot be defined dynamically. Example:
for mod_name in ["module1", "module2", "module3"]:
module mod_name:
snakefile: "path/to/module/Snakefile"
use rule * from mod_name as mod_name_*It does not throw an error but 1) "mod_name" is used as module name and 2) the module is simply redeclared in each iteration. If I try to use anything different from a name, e.g. a variable, an error is raised: Expected name after module keyword.
It be great to have a more flexible module declaration which allows for dynamic names (and integration into other control flow constructs such as loops), for example
mod_name = "some_module"
module {mod_name}:
snakefile: "path/to/module/Snakefile"
use rule * from {mod_name} as {mod_name}_*I'm aware that include and module are quite different in concept and syntax though.
In my use case, I want to search a directory tree for datasets and create modules during runtime. I used include like
snakefiles = search_snakefiles() # gives e.g. ["/path/to/snakefile1.smk", "/path/to/snakefile2.smk"]
for f in snakefiles:
include: fwhich worked but is quite limited and has several drawbacks. I'd like to use additional features from module.
BTW, subworkflows show the same limitations.
Does this feature request make sense to you or am I overlooking some other concept?
(not sure if this is a bug or a feature)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status