-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
A metapath can be defined with two levels of granularity: | ||
- Low: A list of BEL functions representing the types of entities in a given path | ||
- High: An alternating list of BEL functions and BEL relations representing the types of entities in a given path and | ||
their relations | ||
""" | ||
|
||
from pybel.constants import FUNCTION | ||
|
||
|
||
def convert_path_to_metapath(graph, nodes): | ||
"""Converts a list of nodes to their corresponding functions | ||
:param list[tuple] nodes: A list of BEL node tuples | ||
:rtype: list[str] | ||
""" | ||
return [ | ||
graph.node[node][FUNCTION] | ||
for node in nodes | ||
] | ||
|