Skip to content

Commit

Permalink
fix: also inherit rule proxies if there is no rulename modifier speci…
Browse files Browse the repository at this point in the history
…fied in a use rule statement (#2440)

### Description

Loading meta-wrappers is failing when in case the output of a
meta-wrapper-rule is set as input.
The latest working snakemake version is 7.32.0.

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [ ] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).

---------

Co-authored-by: Johannes Koester <johannes.koester@uni-due.de>
  • Loading branch information
FelixMoelder and johanneskoester committed Sep 18, 2023
1 parent 71e540a commit 1570289
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
9 changes: 4 additions & 5 deletions snakemake/modules.py
Expand Up @@ -209,11 +209,10 @@ def __init__(
self.namespace = namespace

def inherit_rule_proxies(self, child_modifier):
if child_modifier.local_rulename_modifier is not None:
for name, rule in child_modifier.rule_proxies._rules.items():
self.rule_proxies._register_rule(
child_modifier.local_rulename_modifier(name), rule
)
for name, rule in child_modifier.rule_proxies._rules.items():
if child_modifier.local_rulename_modifier is not None:
name = child_modifier.local_rulename_modifier(name)
self.rule_proxies._register_rule(name, rule)

def skip_rule(self, rulename):
return (
Expand Down
24 changes: 24 additions & 0 deletions tests/test_load_metawrapper/Snakefile
@@ -0,0 +1,24 @@
rule all:
input:
"b.fa",


module fusion_calling:
meta_wrapper:
"v2.5.0/meta/bio/star_arriba"


use rule * from fusion_calling


use rule star_index from fusion_calling with:
input:
fasta="data/genome.fa",
gtf="data/a.gtf",


rule test:
input:
rules.star_index.output,
output:
"b.fa",
Empty file.
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions tests/tests.py
Expand Up @@ -2014,3 +2014,7 @@ def test_module_wildcard_constraints():
@skip_on_windows
def test_config_yte():
run(dpath("test_config_yte"))


def test_load_metawrapper():
run(dpath("test_load_metawrapper"), executor="dryrun")

0 comments on commit 1570289

Please sign in to comment.