Skip to content

Commit

Permalink
KEGGPathways self_loops corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
sienkie committed Jun 19, 2018
1 parent 6618dc1 commit 9575301
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def get_pathway(self, pathway_id: str, self_loops: bool = False):
if G.node[node]['type'] != 'gene':
for in_edge in G.in_edges(node):
for out_edge in G.out_edges(node):
G.add_edge(in_edge[0], out_edge[1], type=['indirect'])
if in_edge[0] != out_edge[1] or (in_edge[0] == out_edge[1] and self_loops):
G.add_edge(in_edge[0], out_edge[1], type=['indirect'])
not_gene_nodes.append(node)
G.remove_nodes_from(not_gene_nodes)

Expand Down

0 comments on commit 9575301

Please sign in to comment.