crnt4sbml.Cgraph

class crnt4sbml.Cgraph(model)[source]

Class for constructing core CRNT values and C-graph of the network.

__init__(model)[source]

Initialization of Cgraph class.

Methods

__init__(model) Initialization of Cgraph class.
get_species() Returns Python list of strings representing the species of the network.
get_complexes() Returns Python list of strings representing the complexes of the network.
get_reactions() Returns Python list of strings representing the reactions of the network.
get_deficiency() Returns integer value representing the deficiency of the network, \delta.
get_dim_equilibrium_manifold() Returns integer value representing the dimension of the equilibrium manifold, \lambda.
get_ode_system() Returns SymPy matrix representing the ODE system.
get_a() Returns SymPy matrix representing the kinetic constant matrix, A.
get_b() Returns SymPy matrix representing the mass conservation matrix, B.
get_s() Returns SymPy matrix representing the stoichiometric matrix, S.
get_y() Returns SymPy matrix representing the molecularity matrix, Y.
get_lambda() Returns SymPy matrix representing the linkage class matrix, \Lambda.
get_psi() Returns SymPy matrix representing the mass action monomials, \psi.
get_graph() Returns the NetworkX DiGraph representation of the network.
get_g_nodes() Returns a list of strings that represent the order of the nodes of the NetworkX DiGraph.
get_g_edges() Returns a list of tuples of strings that represent the order of the edges of the NetworkX DiGraph.
get_network_dimensionality_classification() Returns a two element list specifying the dimensionality of the network.
get_linkage_classes() Returns list of NetworkX subgraphs representing the linkage classes.
get_linkage_classes_deficiencies() Returns an interger list of each linkage class deficiency.
get_if_cgraph_weakly_reversible() Returns weak reversibility of the network.
get_weak_reversibility_of_linkage_classes() Returns list of Python boolean types for the weak reversibility of each linkage class.
get_number_of_terminal_strong_lc_per_lc() Returns an integer list stating the number of terminally strong linkage classes per linkage class.
print() Prints edges and nodes of NetworkX DiGraph.
plot() Plots NetworkX DiGraph.
plot_save() Saves the plot of the NetworkX DiGraph.
get_a()[source]

Returns SymPy matrix representing the kinetic constant matrix, A. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> import sympy
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> sympy.pprint(network.get_c_graph().get_a())
    ⎡-re₁     re1r      0   0         0       0   0         0       0⎤
    ⎢                                                                ⎥
    ⎢re₁   -re1r - re₂  0   0         0       0   0         0       0⎥
    ⎢                                                                ⎥
    ⎢ 0        re₂      0   0         0       0   0         0       0⎥
    ⎢                                                                ⎥
    ⎢ 0         0       0  -re₃     re3r      0   0         0       0⎥
    ⎢                                                                ⎥
    ⎢ 0         0       0  re₃   -re3r - re₄  0   0         0       0⎥
    ⎢                                                                ⎥
    ⎢ 0         0       0   0        re₄      0   0         0       0⎥
    ⎢                                                                ⎥
    ⎢ 0         0       0   0         0       0  -re₅     re5r      0⎥
    ⎢                                                                ⎥
    ⎢ 0         0       0   0         0       0  re₅   -re5r - re₆  0⎥
    ⎢                                                                ⎥
    ⎣ 0         0       0   0         0       0   0        re₆      0⎦
get_b()[source]

Returns SymPy matrix representing the mass conservation matrix, B. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> import sympy
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> sympy.pprint(network.get_c_graph().get_b())
    ⎡ 0    0    0    0   1.0  1.0   0 ⎤
    ⎢                                 ⎥
    ⎢ 0   1.0  1.0   0    0    0    0 ⎥
    ⎢                                 ⎥
    ⎣1.0   0   1.0  1.0   0   1.0  2.0⎦
get_complexes()[source]

Returns Python list of strings representing the complexes of the network. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> print(network.get_c_graph().get_complexes())
    ['s1+s2', 's3', 's6+s2', 's6+s7', 's16', 's7+s1', 's1+s6', 's15', '2*s6']
get_deficiency()[source]

Returns integer value representing the deficiency of the network, \delta. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> print(network.get_c_graph().get_deficiency())
    2
get_dim_equilibrium_manifold()[source]

Returns integer value representing the dimension of the equilibrium manifold, \lambda. This value is the number of mass conservation relationships. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> print(network.get_c_graph().get_dim_equilibrium_manifold())
    3
get_g_edges()[source]

Returns a list of tuples of strings that represent the order of the edges of the NetworkX DiGraph.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_g_edges()
get_g_nodes()[source]

Returns a list of strings that represent the order of the nodes of the NetworkX DiGraph.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_g_nodes()
get_graph()[source]

Returns the NetworkX DiGraph representation of the network.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_graph()
get_if_cgraph_weakly_reversible()[source]

Returns weak reversibility of the network. If the network is weakly reversible True is returned, False otherwise.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_if_cgraph_weakly_reversible()
get_lambda()[source]

Returns SymPy matrix representing the linkage class matrix, \Lambda. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> import sympy
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> sympy.pprint(network.get_c_graph().get_lambda())
    ⎡1  0  0⎤
    ⎢       ⎥
    ⎢1  0  0⎥
    ⎢       ⎥
    ⎢1  0  0⎥
    ⎢       ⎥
    ⎢0  1  0⎥
    ⎢       ⎥
    ⎢0  1  0⎥
    ⎢       ⎥
    ⎢0  1  0⎥
    ⎢       ⎥
    ⎢0  0  1⎥
    ⎢       ⎥
    ⎢0  0  1⎥
    ⎢       ⎥
    ⎣0  0  1⎦
get_linkage_classes()[source]

Returns list of NetworkX subgraphs representing the linkage classes.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_linkage_classes()
get_linkage_classes_deficiencies()[source]

Returns an interger list of each linkage class deficiency. Here, the first element corresponds to the first linkage class with order as defined by crnt4sbml.Cgraph.get_linkage_classes().

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_linkage_classes_deficiencies()
get_network_dimensionality_classification()[source]

Returns a two element list specifying the dimensionality of the network. Possible output: [“over-dimensioned”,0]

or

[“proper”,1]

or

[“under-dimensioned”,2]

or

[“NOT DEFINED!”,3]

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_network_dimensionality_classification()
get_number_of_terminal_strong_lc_per_lc()[source]

Returns an integer list stating the number of terminally strong linkage classes per linkage class. Here, the first element corresponds to the first linkage class with order as defined by crnt4sbml.Cgraph.get_linkage_classes().

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_number_of_terminal_strong_lc_per_lc()
get_ode_system()[source]

Returns SymPy matrix representing the ODE system. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> import sympy
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> sympy.pprint(network.get_c_graph().get_ode_system())
    ⎡    -re₁⋅s₁⋅s₂ + re1r⋅s₃ + re₄⋅s₁₆ - re₅⋅s₁⋅s₆ + re5r⋅s₁₅     ⎤
    ⎢                                                              ⎥
    ⎢                 -re₁⋅s₁⋅s₂ + s₃⋅(re1r + re₂)                 ⎥
    ⎢                                                              ⎥
    ⎢                 re₁⋅s₁⋅s₂ + s₃⋅(-re1r - re₂)                 ⎥
    ⎢                                                              ⎥
    ⎢re₂⋅s₃ - re₃⋅s₆⋅s₇ + re3r⋅s₁₆ - re₅⋅s₁⋅s₆ + s₁₅⋅(re5r + 2⋅re₆)⎥
    ⎢                                                              ⎥
    ⎢                -re₃⋅s₆⋅s₇ + s₁₆⋅(re3r + re₄)                 ⎥
    ⎢                                                              ⎥
    ⎢                re₃⋅s₆⋅s₇ + s₁₆⋅(-re3r - re₄)                 ⎥
    ⎢                                                              ⎥
    ⎣                re₅⋅s₁⋅s₆ + s₁₅⋅(-re5r - re₆)                 ⎦
get_psi()[source]

Returns SymPy matrix representing the mass action monomials, \psi. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> import sympy
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> sympy.pprint(network.get_c_graph().get_psi())
    ⎡s₁⋅s₂⎤
    ⎢     ⎥
    ⎢ s₃  ⎥
    ⎢     ⎥
    ⎢s₂⋅s₆⎥
    ⎢     ⎥
    ⎢s₆⋅s₇⎥
    ⎢     ⎥
    ⎢ s₁₆ ⎥
    ⎢     ⎥
    ⎢s₁⋅s₇⎥
    ⎢     ⎥
    ⎢s₁⋅s₆⎥
    ⎢     ⎥
    ⎢ s₁₅ ⎥
    ⎢     ⎥
    ⎢   2 ⎥
    ⎣ s₆  ⎦
get_reactions()[source]

Returns Python list of strings representing the reactions of the network. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> print(network.get_c_graph().get_reactions())
    ['re1', 're1r', 're2', 're3', 're3r', 're4', 're5', 're5r', 're6']
get_s()[source]

Returns SymPy matrix representing the stoichiometric matrix, S. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> import sympy
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> sympy.pprint(network.get_c_graph().get_s())
    ⎡-1  1   0   0   0   1   -1  1   0 ⎤
    ⎢                                  ⎥
    ⎢-1  1   1   0   0   0   0   0   0 ⎥
    ⎢                                  ⎥
    ⎢1   -1  -1  0   0   0   0   0   0 ⎥
    ⎢                                  ⎥
    ⎢0   0   1   -1  1   0   -1  1   2 ⎥
    ⎢                                  ⎥
    ⎢0   0   0   -1  1   1   0   0   0 ⎥
    ⎢                                  ⎥
    ⎢0   0   0   1   -1  -1  0   0   0 ⎥
    ⎢                                  ⎥
    ⎣0   0   0   0   0   0   1   -1  -1⎦
get_species()[source]

Returns Python list of strings representing the species of the network. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> print(network.get_c_graph().get_species())
    ['s1', 's2', 's3', 's6', 's7', 's16', 's15']
get_weak_reversibility_of_linkage_classes()[source]

Returns list of Python boolean types for the weak reversibility of each linkage class. If the linkage class is weakly reversible then the entry in the list is True, False otherwise with order as defined by crnt4sbml.Cgraph.get_linkage_classes().

Example

>>> import crnt4sbml
>>> network = crnt4sbml.CRNT("path/to/sbml_file.xml")
>>> network.get_c_graph().get_weak_reversibility_of_linkage_classes()
get_y()[source]

Returns SymPy matrix representing the molecularity matrix, Y. Fig1Ci.xml for the provided example.

Example

>>> import crnt4sbml
>>> import sympy
>>> network = crnt4sbml.CRNT("path/to/Fig1Ci.xml")
>>> sympy.pprint(network.get_c_graph().get_y())
    ⎡1  0  0  0  0  1  1  0  0⎤
    ⎢                         ⎥
    ⎢1  0  1  0  0  0  0  0  0⎥
    ⎢                         ⎥
    ⎢0  1  0  0  0  0  0  0  0⎥
    ⎢                         ⎥
    ⎢0  0  1  1  0  0  1  0  2⎥
    ⎢                         ⎥
    ⎢0  0  0  1  0  1  0  0  0⎥
    ⎢                         ⎥
    ⎢0  0  0  0  1  0  0  0  0⎥
    ⎢                         ⎥
    ⎣0  0  0  0  0  0  0  1  0⎦
plot()[source]

Plots NetworkX DiGraph.

plot_save()[source]

Saves the plot of the NetworkX DiGraph.

print()[source]

Prints edges and nodes of NetworkX DiGraph.