Main Content

getstoichmatrix (model)

Get stoichiometry matrix from model object

The order of species in the output arguments (M and objSpecies) matches the order of species returned by modelObj.Species.

Syntax

M = getstoichmatrix(modelObj)
[M,objSpecies] = getstoichmatrix(modelObj)
[M,objSpecies,objReactions] = getstoichmatrix(modelObj)

Arguments

MStoichiometry matrix for modelObj.
modelObjSpecify the model object.
objSpecies

Return the list of modelObj species by Name property of the species.

If the species are in multiple compartments, species names are qualified with the compartment name in the form compartmentName.speciesName. For example, nucleus.DNA, cytoplasm.mRNA.

objReactionsReturn the list of modelObj reactions by the Name property of reactions.

Description

getstoichmatrix returns a stoichiometry matrix for a model object.

M = getstoichmatrix(modelObj) returns a stoichiometry matrix for a SimBiology® model object (modelObj) to M.

A stoichiometry matrix is defined by listing all reactions contained by modelObj column-wise and all species contained by modelObj row-wise in a matrix. The species of the reaction are represented in the matrix with the stoichiometric value at the location of [row of species, column of reaction]. Reactants have negative values. Products have positive values. All other locations in the matrix are 0.

For example, if modelObj is a model object with two reactions with names R1 and R2 and Reaction values of 2 A + B -> 3 C and B + 3 D -> 4 A, the stoichiometry matrix would be defined as:

      R1   R2
A     -2    4
B     -1   -1
C      3    0
D      0   -3

[M,objSpecies] = getstoichmatrix(modelObj) returns the stoichiometry matrix to M and the species to objSpecies. objSpecies is defined by listing all Name property values of species contained by Obj. In the above example, objSpecies would be {'A', 'B', 'C', 'D'};.

[M,objSpecies,objReactions] = getstoichmatrix(modelObj) returns the stoichiometry matrix to M and the reactions to objReactions. objReactions is defined by listing all Name property values of reactions contained by modelObj. In the above example, objReactions would be {'R1', 'R2'}.

Examples

Get Stoichiometry Matrix of SimBiology Model

Load the lotka model.

m1 = sbmlimport('lotka.xml');

Get the stoichiometry matrix of the model.

[M,objSpecies,objReactions] = getstoichmatrix(m1)
M = 
   (2,1)        1
   (2,2)       -1
   (3,2)        1
   (3,3)       -1
   (4,3)        1

objSpecies = 4x1 cell
    {'x' }
    {'y1'}
    {'y2'}
    {'z' }

objReactions = 3x1 cell
    {'Reaction1'}
    {'Reaction2'}
    {'Reaction3'}

Version History

Introduced in R2006a

expand all