diff --git a/tasks/trust_rank.py b/tasks/trust_rank.py index 2283d74337e88c1a7212252dd43b4c680902a332..0b3d677ae63c684fac803e2c070f21a7870a4afb 100755 --- a/tasks/trust_rank.py +++ b/tasks/trust_rank.py @@ -213,7 +213,7 @@ def trust_rank(task_hook: TaskHook): if custom_edges: edges = task_hook.parameters.get("input_network")['edges'] g = add_edges(g, edges) - + task_hook.set_progress(1 / 4.0, "Computing edge weights.") weights = edge_weights(g, hub_penalty, inverse=True) diff --git a/tasks/util/custom_edges.py b/tasks/util/custom_edges.py index d0b8ea2af07b1debe3c49935f222a8747cba6e9e..713f679f912cbae400f10df6beb59fb46d0bb928 100644 --- a/tasks/util/custom_edges.py +++ b/tasks/util/custom_edges.py @@ -11,8 +11,10 @@ def add_edges(g, edge_list): mapping = make_node_id_map(g) edge_id_list = [] for edge in edge_list: - a = mapping[edge['from']] - b = mapping[edge['to']] - edge_id_list.append((a, b)) - g.add_edge_list(edge_list) + a = mapping[edge['from']] if edge['from'] in mapping else False + b = mapping[edge['to']] if edge['to'] in mapping else False + if a and b: + edge_id_list.append((a, b, 'protein-protein')) + e_type = g.edge_properties["type"] + g.add_edge_list(edge_id_list, eprops=[e_type]) return g \ No newline at end of file