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

betweenes centrality fixed

Former-commit-id: 1186a343
parent 9ff6a771
No related branches found
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.
Finish editing this message first!
Please register or to comment