Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

addreaction (model)

Create reaction object and add to model object

Syntax

reactionObj = addreaction(modelObj,'ReactionValue')
reactionObj = addreaction(modelObj, 'ReactantsValue', 'ProductsValue')
reactionObj = addreaction(modelObj, 'ReactantsValue', RStoichCoefficients, 'ProductsValue', PStoichCoefficients)
reactionObj = addreaction(...'PropertyName', PropertyValue...)

Arguments

modelObjSimBiology® model object.
ReactionValue

Specify the reaction equation. Enter a character vector. 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.

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

ReactantsValueCharacter vector defining the species name, a cell array of character vectors, a species object, or an array of species objects. If using names, qualify with compartment names if there are multiple compartments.
ProductsValueCharacter vector defining the species name, a cell array of character vectors, a species object, or an array of species objects. If using names, qualify with compartment names if there are multiple compartments.
RStoichCoefficientsStoichiometric coefficients for reactants, length of array equal to length of ReactantsValue.
PStoichCoefficientsStoichiometric coefficients for products, length of array equal to length of ProductsValue.

Description

reactionObj = addreaction(modelObj,'ReactionValue') creates a reaction object, assigns a value (ReactionValue) to the property Reaction, assigns reactant species object(s) to the property Reactants, assigns the product species object(s) to the property Products, and assigns the model object to the property Parent. In the Model object (modelObj), this method assigns the reaction object to the property Reactions, and returns the reaction object (reactionObj).

reactionObj = addreaction(modelObj, 'a -> b')

When you define a reaction with a new species:

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

  • If only one compartment object (compObj) exists in the model, the method creates a species object in that compartment.

  • If there is more than one compartment object (compObj) 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 the method addspecies.

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

You can copy a SimBiology reaction object to a model object with the function copyobj. You can remove the SimBiology reaction object from a SimBiology model object with the function delete.

You can view additional reaction object properties with the get command. For example, the reaction equation of reactionObj can be viewed with the command get(reactionObj, 'Reaction'). You can modify additional reaction object properties with the command set.

reactionObj = addreaction(modelObj, 'ReactantsValue', 'ProductsValue') creates a reaction object, assigns a value to the property Reaction using the reactant (ReactantsValue) and product (ProductsValue) names, assigns the species objects to the properties Reactants and Products, and assigns the model object to the property Parent. In the model object (modelObj), this method assigns the reaction object to the property Reactions, and returns the reaction object (reactionObj). The stoichiometric values are assumed to be 1.

reactionObj = addreaction(modelObj, 'ReactantsValue', RStoichCoefficients, 'ProductsValue', PStoichCoefficients) adds stoichiometric coefficients (RStoichCoefficients) for reactant species, and stoichiometric coefficients (PStoichCoefficients) for product species to the property Stoichiometry. The length of Reactants and RCoefficients must be equal, and the length of Products and PCoefficients must be equal.

reactionObj = addreaction(...'PropertyName', PropertyValue...) defines optional properties. The property name/property value pairs can be in any format supported by the function set.

Note

If you use the addreaction method to create a reaction rate expression that is not continuous and differentiable, see Using Events to Address Discontinuities in Rule and Reaction Rate Expressions before simulating your model.

Method Summary

Methods for reaction objects

addkineticlaw (reaction)Create kinetic law object and add to reaction object
addproduct (reaction)Add product species object to reaction object
addreactant (reaction)Add species object as reactant to reaction object
copyobj (any object)Copy SimBiology object and its children
delete (any object)Delete SimBiology object
display (any object)Display summary of SimBiology object
get (any object)Get object properties
rename (compartment, parameter, species, reaction)Rename object and update expressions
rmproduct (reaction)Remove species object from reaction object products
rmreactant (reaction)Remove species object from reaction object reactants
set (any object)Set object properties

Property Summary

Properties for reaction objects

ActiveIndicate object in use during simulation
KineticLawShow kinetic law used for ReactionRate
NameSpecify name of object
NotesHTML text describing SimBiology object
ParentIndicate parent object
ProductsArray of reaction products
ReactantsArray of reaction reactants
ReactionReaction object reaction
ReactionRateReaction rate equation in reaction object
ReversibleSpecify whether reaction is reversible or irreversible
StoichiometrySpecies coefficients in reaction
TagSpecify label for SimBiology object
TypeDisplay SimBiology object type
UserDataSpecify data to associate with object

Examples

Create a model, add a reaction object, and assign the expression for the reaction rate equation.

  1. Create a model object, and then add a reaction object.

    modelObj = sbiomodel('my_model');
    reactionObj = addreaction(modelObj, 'a -> c + d');
  2. Create a kinetic law object for the reaction object, of the type 'Henri-Michaelis-Menten'.

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

    reactionObj KineticLaw property is configured to kineticlawObj.

  3. 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');
  4. Set the variable names for the kinetic law object.

    set(kineticlawObj,'ParameterVariableNames', {'Vm_d' 'Km_d'});
    set(kineticlawObj,'SpeciesVariableNames', {'a'});
  5. Verify that the reaction rate is expressed correctly in the reaction object ReactionRate property.

    get (reactionObj, 'ReactionRate')

    MATLAB returns:

    ans =
    
    Vm_d*a/(Km_d+a)

Introduced in R2006a

Was this topic helpful?