Main Content

addreaction

Create reaction object and add to model

Description

rxnObj = addreaction(modelObj,rxnEquation) creates and returns a SimBiology.Reaction object rxnObj. The function also assigns

  • rxnEquation to the Reaction property of rxnObj.

  • Reactant species to the Reactants property of rxnObj.

  • Product species to the Products property of rxnObj.

  • modelObj to the Parent property of rxnObj.

  • rxnObj to the Reactions property of modelObj.

Note

example

rxnObj = addreaction(modelObj,reactantNames,productNames) specifies the reactant species and product species. By default, the stoichiometric values are set to 1.

rxnObj = addreaction(modelObj,reactantNames,RStoichCoefficients,productNames,PStoichCoefficients) also specifies the stoichiometric coefficients for reactants and products and sets the Stoichiometry property of rxnObj.

rxnObj = addreaction(___,Name=Value) also sets the properties of rxnObj using one or more name-value arguments. Name is the property name and Value is the corresponding value.

Examples

collapse all

Create a model.

modelObj = sbiomodel("m1");

Add a reaction.

rxnObj = addreaction(modelObj, 'a -> c + d');

Create a kinetic law object for the reaction object, of the type 'Henri-Michaelis-Menten'.

kineticlawObj = addkineticlaw(rxnObj, 'Henri-Michaelis-Menten');

The 'Henri-Michaelis-Menten' kinetic law has two parameter variables (Vm and Km) and one species variable (S) that should to be set. To set these variables, first create the parameter variables as parameter objects (parameterObj1, parameterObj2) with names Vm_d, and Km_d, and assign the objects Parent property value to the kineticlawObj.

parameterObj1 = addparameter(kineticlawObj,"Vm_d");
parameterObj2 = addparameter(kineticlawObj,"Km_d");

Set the variable names for the kinetic law object.

kineticlawObj.ParameterVariableNames = ["Vm_d","Km_d"];
kineticlawObj.SpeciesVariableNames = "a";

Verify that the reaction rate is expressed correctly in the reaction object ReactionRate property.

rxnObj.ReactionRate
ans = 
'Vm_d*a/(Km_d+a)'

Input Arguments

collapse all

SimBiology model, specified as a Model object.

Reaction equation, specified as a character vector or string scalar.

A hyphen preceded by a space and followed by a right angle bracket (->) indicates reactants going forward to products. A hyphen with left and right angle brackets (<->) indicates a reversible reaction. Coefficients before reactant or product names must be followed by a space.

Examples are 'A -> B', 'A + B -> C', '2 A + B -> 2 C', and 'A <-> B'. Enter reactions with spaces between the species.

If there are multiple compartments, or to specify the compartment name, use compartmentName.speciesName to qualify the species name.

Examples are 'cytoplasm.A -> cytoplasm.B', 'cytoplasm.A -> nucleus.A', and 'cytoplasm.A + cytoplasm.B -> nucleus.AB'.

Data Types: char | string

Names of reactant species, specified as a character vector, string scalar, string vector, or cell array of character vectors. Qualify with compartment names if there are multiple compartments.

Data Types: char | string | cell

Names of product species, specified as a character vector, string scalar, string vector, or cell array of character vectors. Qualify with compartment names if there are multiple compartments.

Data Types: char | string | cell

Stoichiometry coefficients of reactants, specified as a positive numeric scalar or positive numeric vector. If it is a vector, it must have the same length as reactantNames.

Data Types: double

Stoichiometry coefficients of products, specified as a positive numeric scalar or positive numeric vector. If it is a vector, it must have the same length as productNames.

Data Types: double

More About

collapse all

Add Reactions to SimBiology Model

When you define a reaction with a new species:

  • If no compartment objects exist in the model, the function creates a compartment object (called 'unnamed') in the model and adds the newly created species to that compartment.

  • If only one compartment object exists in the model, the function creates a species object in that compartment.

  • If there is more than one compartment object in the model, you must qualify the species name with the compartment name.

    For example, cell.glucose denotes that you want to put the species named glucose into a compartment named cell. Additionally, if the compartment named cell does not exist, the process of adding the reaction creates the compartment and names it cell.

You can manually add a species to a compartment object with addspecies.

You can add species to a reaction object using addreactant or addproduct. You can remove species from a reaction object with rmreactant or rmproduct. The property Reaction is modified by adding or removing species from the reaction equation.

Version History

Introduced in R2006a

expand all