From e0acf39521d489090ff86bf9aaaad0a68632ed6c Mon Sep 17 00:00:00 2001 From: "Hartung, Michael" Date: Wed, 9 Oct 2024 13:44:10 +0200 Subject: [PATCH] bugfix for custom_edges input bug --- drugstone/management/commands/import_from_nedrex.py | 2 +- tasks/betweenness_centrality.py | 5 ++++- tasks/closeness_centrality.py | 3 +++ tasks/degree_centrality.py | 3 +++ tasks/multi_steiner.py | 3 +++ tasks/network_proximity.py | 3 +++ tasks/trust_rank.py | 3 +++ 7 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drugstone/management/commands/import_from_nedrex.py b/drugstone/management/commands/import_from_nedrex.py index c0b06dd..bb4c50a 100644 --- a/drugstone/management/commands/import_from_nedrex.py +++ b/drugstone/management/commands/import_from_nedrex.py @@ -252,7 +252,7 @@ def add_dpi(edge): if update and e.__hash__() in existing: if existing[e.__hash__()] != e: delete.add(existing[e.__hash__()]) - del existing[e.__hash__()] + del existing[e.__hash__()] else: return if not update or e.__hash__() not in existing: diff --git a/tasks/betweenness_centrality.py b/tasks/betweenness_centrality.py index 3a50e1d..c3b6fcf 100755 --- a/tasks/betweenness_centrality.py +++ b/tasks/betweenness_centrality.py @@ -169,11 +169,14 @@ def betweenness_centrality(task_hook: TaskHook): search_target = task_hook.parameters.get("target", "drug-target") - filterPaths = task_hook.parameters.get("filter_paths", True) + filterPaths = task_hook.parameters.get("filter_paths", True) id_space = task_hook.parameters["config"].get("identifier","symbol") custom_edges = task_hook.parameters.get("custom_edges", False) + if custom_edges: + if not isinstance(custom_edges, list): + custom_edges = False no_default_edges = no_default_edges = task_hook.parameters.get("exclude_drugstone_ppi_edges", False) diff --git a/tasks/closeness_centrality.py b/tasks/closeness_centrality.py index 3f046f0..b286da8 100755 --- a/tasks/closeness_centrality.py +++ b/tasks/closeness_centrality.py @@ -175,6 +175,9 @@ def closeness_centrality(task_hook: TaskHook): id_space = task_hook.parameters["config"].get("identifier", "symbol") custom_edges = task_hook.parameters.get("custom_edges", False) + if custom_edges: + if not isinstance(custom_edges, list): + custom_edges = False no_default_edges = no_default_edges = task_hook.parameters.get("exclude_drugstone_ppi_edges", False) diff --git a/tasks/degree_centrality.py b/tasks/degree_centrality.py index d615c1e..07d863b 100755 --- a/tasks/degree_centrality.py +++ b/tasks/degree_centrality.py @@ -150,6 +150,9 @@ def degree_centrality(task_hook: TaskHook): filterPaths = task_hook.parameters.get("filter_paths", True) custom_edges = task_hook.parameters.get("custom_edges", False) + if custom_edges: + if not isinstance(custom_edges, list): + custom_edges = False no_default_edges = no_default_edges = task_hook.parameters.get("exclude_drugstone_ppi_edges", False) diff --git a/tasks/multi_steiner.py b/tasks/multi_steiner.py index ddd11b7..f2e9577 100755 --- a/tasks/multi_steiner.py +++ b/tasks/multi_steiner.py @@ -101,6 +101,9 @@ def multi_steiner(task_hook: TaskHook): node_name_attribute = "internal_id" # nodes in the input network which is created from RepoTrialDB have primaryDomainId as name attribute custom_edges = task_hook.parameters.get("custom_edges", False) + if custom_edges: + if not isinstance(custom_edges, list): + custom_edges = False no_default_edges = no_default_edges = task_hook.parameters.get("exclude_drugstone_ppi_edges", False) diff --git a/tasks/network_proximity.py b/tasks/network_proximity.py index f7d2adf..dbadf8a 100755 --- a/tasks/network_proximity.py +++ b/tasks/network_proximity.py @@ -81,6 +81,9 @@ def network_proximity(task_hook: TaskHook): filter_paths = task_hook.parameters.get("filter_paths", True) custom_edges = task_hook.parameters.get("custom_edges", False) + if custom_edges: + if not isinstance(custom_edges, list): + custom_edges = False no_default_edges = no_default_edges = task_hook.parameters.get("exclude_drugstone_ppi_edges", False) diff --git a/tasks/trust_rank.py b/tasks/trust_rank.py index 3f11e2e..22136a3 100755 --- a/tasks/trust_rank.py +++ b/tasks/trust_rank.py @@ -198,6 +198,9 @@ def trust_rank(task_hook: TaskHook): filter_paths = task_hook.parameters.get("filter_paths", True) custom_edges = task_hook.parameters.get("custom_edges", False) + if custom_edges: + if not isinstance(custom_edges, list): + custom_edges = False no_default_edges = task_hook.parameters.get("exclude_drugstone_ppi_edges", False)