sbml
SBMLClient(uri='neo4j://localhost:7687', neo4j_user='neo4j', neo4j_password='neo4j', database='neo4j', create_db=True, drop_if_exists=False, reaction_groups=True)
Bases: Neo4jClient
In addition to the Neo4j driver, this class also includes a set of helper methods for creating nodes and relationships in the graph with data from the SBML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri |
str
|
URI of the Neo4j server. Defaults to |
'neo4j://localhost:7687'
|
neo4j_user |
str
|
Neo4j user. Defaults to |
'neo4j'
|
neo4j_password |
str
|
Neo4j password. Defaults to |
'neo4j'
|
database |
str
|
Name of the database. Defaults to |
'neo4j'
|
create_db |
bool
|
Whether to create the database. See :meth: |
True
|
drop_if_exists |
bool
|
Whether to drop the database if it already exists. |
False
|
Attributes:
| Name | Type | Description |
|---|---|---|
driver |
:class: |
|
database |
str, name of the database to use. |
|
available_node_labels |
tuple of strings indicating the possible node labels in the graph. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
create_db |
bool
|
If False, does not create the database. This is useful for running on neo4j AuraDB when database creation is not allowed. |
True
|
drop_if_exists |
bool
|
See :meth: |
False
|
reaction_groups |
bool
|
Assume all |
True
|
Source code in db/sbml.py
create_nodes(desc, nodes, query, batch_size=1000, progress_bar=False)
Create nodes in batches with the given label and properties.
For Compartment nodes, simply create them with given properties.
Each compound node is linked to its Compartment node. If it
has related RDF nodes, these are also created and linked to the
Compound node.
GeneProduct nodes don't have relationships to Compartment
nodes, but they are linked to corresponding RDF nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desc |
str
|
Label of the node in log and progress bar. |
required |
nodes |
list[dict[str, Any]]
|
List of properties of the nodes. |
required |
query |
str
|
Cypher query to create the nodes. |
required |
batch_size |
int
|
Number of nodes to create in each batch. |
1000
|
progress_bar |
bool
|
Show progress bar for slow queries. |
False
|
Source code in db/sbml.py
sbml_to_graph(parser)
Populate Neo4j database with SBML data. The process is as follows:
. Parse the SBML file. All parsing errors are logged as warnings.
. Create the database and constraints.
. Feed the SBML file into the database. This will populate
Compartment, Reaction, Compound, GeneProduct,
GeneProductSet, GeneProductComplex, and RDF nodes.
Nodes are created for each SBML element using MERGE statements:
https://neo4j.com/docs/cypher-manual/current/clauses/merge/#merge-merge-with-on-create