Skip to content

Commit

Permalink
fixed: secondary resource name lookup by controller
Browse files Browse the repository at this point in the history
  • Loading branch information
deeenes committed Aug 4, 2020
1 parent f2d0fc1 commit 9c01500
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pypath/__version__
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.19
0.11.20
4 changes: 2 additions & 2 deletions src/pypath/omnipath/server/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2403,7 +2403,7 @@ def filter_resources(res):
composite_to_remove = {
comp_res
for comp_res in composite
if not res_ctrl.components[comp_res] & res
if not res_ctrl.secondary_resources(comp_res) & res
}

res = res - composite_to_remove
Expand Down Expand Up @@ -2463,7 +2463,7 @@ def filter_resources(res):

tbl[prefix_col] = _new_prefix_col

bool_idx = [bool(res) for res in _new_res_col]
bool_idx = [bool(res) for res in tbl[res_col]]

tbl = tbl[bool_idx]

Expand Down
16 changes: 16 additions & 0 deletions src/pypath/resources/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,22 @@ def resource(self, name):
return self._get(name, dct = self.data)


def name(self, name):

if name in self.synonyms:

name = self.synonyms[name]

return name


def secondary_resources(self, name):

name = self.name(name)

return self.secondary[name] if name in self.secondary else set()


def _get(self, name, dct):

if name in dct:
Expand Down

0 comments on commit 9c01500

Please sign in to comment.