Skip to content
Snippets Groups Projects
Commit a86879a1 authored by AndiMajore's avatar AndiMajore
Browse files

betweenes centrality fixed

Former-commit-id: c3e7bd3cf65e180f9153272087c802aad19e0061 [formerly e34d9a36054a15f0fe8bd3461c66f75fd333e1ee]
Former-commit-id: bd35491f003f79dc5b47609a542b3e2a636f02b5
parent b6378426
Branches
No related tags found
No related merge requests found
......@@ -181,6 +181,7 @@ def betweenness_centrality(task_hook: TaskHook):
g, seed_ids, drug_ids = read_graph_tool_graph(
filename,
seeds,
id_space,
max_deg,
include_indirect_drugs,
include_non_approved_drugs,
......
......@@ -213,7 +213,7 @@ def kpm_task(task_hook: TaskHook):
if id_space == 'ensembl':
node_map[node.uniprot_code] = [ensg.name for ensg in EnsemblGene.objects.filter(protein_id=node.id)]
flat_map = lambda f, xs: [y for ys in xs for y in f(ys)]
flat_map = lambda f, xs: (y for ys in xs for y in f(ys))
network["nodes"] = flat_map(lambda uniprot: node_map[uniprot], network["nodes"])
network["edges"] = list(map(
......
......@@ -92,8 +92,9 @@ def read_graph_tool_graph(file_path, seeds, id_space, max_deg, include_indirect_
deleted_edges = []
if (
drug_ids and not include_indirect_drugs): # If only_direct_drugs should be included, remove any drug-protein edges that the drug is not a direct neighbor of any seeds
# If only_direct_drugs should be included, remove any drug-protein edges that the drug is not a direct neighbor of
# any seeds
if drug_ids and not include_indirect_drugs:
direct_drugs = set()
for edge in g.edges():
if g.vertex_properties["type"][edge.target()] == d_type and edge.source() in seed_ids:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment