Output In-Memory
In-Memory Knowledge Graph Retrieval
Return the in-memory KG class.
Returns
_InMemoryKG: the in-memory KG class
Source code in biocypher/output/in_memory/_get_in_memory_kg.py
In-Memory Knowledge Graph Base Class
Bases: ABC
Abstract class for handling the in-memory Knowledge Graph instance. Specifics of the different in-memory implementations (e.g. csv, networkx) are implemented in the child classes. Any concrete in-memory implementation needs to implement at least: - add_nodes - add_edges - get_kg
Raises:
Type | Description |
---|---|
NotImplementedError
|
InMemoryKG implementation must override 'add_nodes' |
NotImplementedError
|
InMemoryKG implementation must override 'add_edges' |
NotImplementedError
|
InMemoryKG implementation must override 'get_kg' |
Source code in biocypher/output/in_memory/_in_memory_kg.py
add_edges(edges)
abstractmethod
Add edges to the in-memory knowledge graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
edges
|
Iterable[BioCypherEdge]
|
Iterable of BioCypherEdge objects. |
required |
Source code in biocypher/output/in_memory/_in_memory_kg.py
add_nodes(nodes)
abstractmethod
Add nodes to the in-memory knowledge graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nodes
|
Iterable[BioCypherNode]
|
Iterable of BioCypherNode objects. |
required |
Source code in biocypher/output/in_memory/_in_memory_kg.py
Pandas Knowledge Graph
Bases: _InMemoryKG
Source code in biocypher/output/in_memory/_pandas.py
_separate_entity_types(entities)
Given mixed iterable of BioCypher objects, separate them into lists by
type. Also deduplicates using the Deduplicator
instance.
Source code in biocypher/output/in_memory/_pandas.py
add_tables(entities)
Add Pandas dataframes for each node and edge type in the input.
Source code in biocypher/output/in_memory/_pandas.py
NetworkX Knowledge Graph
Bases: _InMemoryKG