psamm.database – Reaction database¶
Representation of metabolic network databases.
-
class
psamm.database.StoichiometricMatrixView(database)¶ Provides a sparse matrix view on the stoichiometry of a database.
This object is used internally in the database to expose a sparse matrix view of the model stoichiometry. This class should not be instantied, instead use the
MetabolicDatabase.matrixproperty. Any compound, reaction-pair can be looked up to obtain the corresponding stoichiometric value. If the value is not defined (implicitly zero) aKeyErrorwill be raised.In addition, instances also support the NumPy __array__ protocol which means that a
numpy.arraycan by created directly from the matrix.>>> model = MetabolicModel() >>> matrix = numpy.array(model.matrix)
-
class
psamm.database.MetabolicDatabase¶ Database of metabolic reactions.
-
reactions¶ Iterator of reactions IDs in the database.
-
compartments¶ Iterator of compartment IDs in the database.
-
has_reaction(reaction_id)¶ Whether the given reaction exists in the database.
-
is_reversible(reaction_id)¶ Whether the given reaction is reversible.
-
get_reaction_values(reaction_id)¶ Return an iterator of reaction compounds and stoichiometric values.
The returned iterator contains (
Compound, value)-tuples. The value is negative for left-hand side compounds and positive for right-hand side.
-
get_compound_reactions(compound_id)¶ Return an iterator of reactions containing the compound.
Reactions are returned as IDs.
-
reversible¶ The set of reversible reactions.
-
matrix¶ Mapping from compound, reaction to stoichiometric value.
This is an instance of
StoichiometricMatrixView.
-
-
class
psamm.database.DictDatabase¶ Metabolic database backed by in-memory dictionaries
This is a subclass of
MetabolicDatabase.-
reactions¶ Iterator of reactions IDs in the database.
-
compartments¶ Iterator of compartment IDs in the database.
-
has_reaction(reaction_id)¶ Whether the given reaction exists in the database.
-
is_reversible(reaction_id)¶ Whether the given reaction is reversible.
-
get_reaction_values(reaction_id)¶ Return an iterator of reaction compounds and stoichiometric values.
The returned iterator contains (
Compound, value)-tuples. The value is negative for left-hand side compounds and positive for right-hand side.
-
get_compound_reactions(compound_id)¶ Return an iterator of reactions containing the compound.
Reactions are returned as IDs.
-
-
class
psamm.database.ChainedDatabase(*databases)¶ Links a number of databases so they can be treated a single database
This is a subclass of
MetabolicDatabase.-
reactions¶ Iterator of reactions IDs in the database.
-
compartments¶ Iterator of compartment IDs in the database.
-
has_reaction(reaction_id)¶ Whether the given reaction exists in the database.
-
is_reversible(reaction_id)¶ Whether the given reaction is reversible.
-
get_reaction_values(reaction_id)¶ Return an iterator of reaction compounds and stoichiometric values.
The returned iterator contains (
Compound, value)-tuples. The value is negative for left-hand side compounds and positive for right-hand side.
-
get_compound_reactions(compound)¶ Return an iterator of reactions containing the compound.
Reactions are returned as IDs.
-