INDRA CoGEx Representation (indra_cogex.representation)
This documentation goes over helper functions and the python objects that represent Neo4j Nodes and Relations.
Representations for nodes and relations to upload to Neo4j.
- class Node(db_ns, db_id, labels, data=None, validate_data=False)[source]
Representation for a node.
Initialize the node.
- Parameters:
db_ns (
str) – The namespace associated with the node. Uses the INDRA standard.db_id (
str) – The identifier within the namespace associated with the node. Uses the INDRA standard.labels (
Collection[str]) – A collection of labels for the node.data (
Optional[Mapping[str,Any]]) – An optional data dictionary associated with the node.validate_data (
bool) – If True, validate the data dictionary. Default: True.
- class Relation(source_ns, source_id, target_ns, target_id, rel_type, data=None, source_name=None, target_name=None)[source]
Representation for a relation.
Initialize the relation.
- Parameters:
source_ns (
str) – The namespace associated with the source node.source_id (
str) – The identifier within the namespace associated with the source node.target_ns (
str) – The namespace associated with the target node.target_id (
str) – The identifier within the namespace associated with the target node.rel_type (
str) – The type of relation.data (
Optional[Mapping[str,Any]]) – An optional data dictionary associated with the relation.source_name (
Optional[str]) – An optional name for the source node.target_name (
Optional[str]) – An optional name for the target node.
- indra_stmts_from_relations(rels, deduplicate=True, order_by_ev_count=False)[source]
Convert a list of relations to INDRA Statements.
Any relations that aren’t representing an INDRA Statement are skipped.
- Parameters:
deduplicate (
bool) – If True, only unique statements are returned. In some cases e.g., for Complexes, there are multiple relations for one statement and this option can be used to return only one of these redundant statements. Default: Trueorder_by_ev_count (
bool) – If True, the statements are ordered by the number of evidences they have with the statement with the most evidences first. Default: False.
- Return type:
List[Statement]- Returns:
A list of INDRA Statements.