MathSBML

MathSBML Home Page MathSBML Site Map

MathSBML Model Builder: add/remove/modifyEvent


addEvent[options] adds an <event> to the model. Options are the same as eventToSBML. If an event with the same id already exists, it is replaced.

If an id is not specified for the event, one is automatically generated.

addEvent[x, options] is the same as addEvent[id->x, options]

modifyEvent[options] modifies the specified event. Options are the same as eventToSBML.

modifyEvent[x,options] is the same as modifyEvent[id->x, options].

removeEvent[id] removes the event with the specified id.

addEvent, removeEvent, modifyEvent new in 2.2.0.

Example

The following example illustrates the creation of a model with two events. The first event sets X=0 and Y=X-1 when X+Y>1, with a delay of 12+t/X seconds; the second event sets X=Y=1/2 when X+Y<0. The user then decies to change the name of the first event from "Event #1" to "First Event", and then displays the model.

input:  newModel["eventTest", name -> "Event Example"];
        addSpecies[X, compartment -> "Cell", initialAmount -> 0];
        addSpecies[Y, compartment -> "Cell", initialAmount -> 0];
output: Compartment Cell added.
        Species X added to compartment Cell
        Species Y added to compartment Cell

input:  addEvent[e1, name -> "Event #1", trigger -> (X + Y > 1), delay -> 12 + t/X, eventAssignment -> {X -> 0, Y -> -1 + X}];
output: Event e1 added.


input:  addEvent[e2, name -> "Second Event",trigger -> (X + Y < 0), eventAssignment -> {Y -> 0.5, X -> 0.5}]
output: Event e2 added.

input:  modifyEvent[e1, name -> "First Event"];
output: Previous occurance of event e1 removed.
        Event e1 added.

input:  createModel[]
output: <?xml version="1.0" encoding="UTF-8"?>
        <!-- Generated 30-September-2003 10:48:05.301889 -->
        <!-- Generated by MathSBML 2.1.5b15 (30 Sept 2003) -->
        <sbml xmlns="http://www.sbml.org/sbml/level2"
            level="2"
            version="1">
         <model id="eventTest"
             name="Event Example">
          <listOfFunctionDefinitions/>
          <listOfUnitDefinitions/>
          <listOfCompartments>
           <compartment id="Cell"
               name="Cell"/>
          </listOfCompartments>
          <listOfSpecies>
           <species id="X"
               name="X"
               compartment="Cell"
               boundaryCondition="false"
               constant="false"
               initialAmount="0"/>
           <species id="Y"
               name="Y"
               compartment="Cell"
               boundaryCondition="false"
               constant="false"
               initialAmount="0"/>
          </listOfSpecies>
          <listOfParameters/>
          <listOfRules/>
          <listOfReactions/>
          <listOfEvents>
           <event id="e2"
               name="Second Event">
            <trigger>
             <math xmlns="http://www.w3.org/1998/Math/MathML">
              <apply>
               <lt/>
               <apply>
                <plus/>
                <ci>X</ci>
                <ci>Y</ci>
               </apply>
               <cn type="integer">0</cn>
              </apply>
             </math>
            </trigger>
            <listOfEventAssignments>
             <eventAssignment variable="Y">
              <math xmlns="http://www.w3.org/1998/Math/MathML">
               <cn type="real">0.5</cn>
              </math>
             </eventAssignment>
             <eventAssignment variable="X">
              <math xmlns="http://www.w3.org/1998/Math/MathML">
               <cn type="real">0.5</cn>
              </math>
             </eventAssignment>
            </listOfEventAssignments>
           </event>
           <event id="e1"
               name="First Event">
            <trigger>
             <math xmlns="http://www.w3.org/1998/Math/MathML">
              <apply>
               <gt/>
               <apply>
                <plus/>
                <ci>X</ci>
                <ci>Y</ci>
               </apply>
               <cn type="integer">1</cn>
              </apply>
             </math>
            </trigger>
            <delay>
             <math xmlns="http://www.w3.org/1998/Math/MathML">
              <apply>
               <plus/>
               <apply>
                <times/>
                <ci>t</ci>
                <apply>
                 <power/>
                 <ci>X</ci>
                 <cn type="integer">-1</cn>
                </apply>
               </apply>
               <cn type="integer">12</cn>
              </apply>
             </math>
            </delay>
            <listOfEventAssignments>
             <eventAssignment variable="X">
              <math xmlns="http://www.w3.org/1998/Math/MathML">
               <cn type="integer">0</cn>
              </math>
             </eventAssignment>
             <eventAssignment variable="Y">
              <math xmlns="http://www.w3.org/1998/Math/MathML">
               <apply>
                <plus/>
                <ci>X</ci>
                <cn type="integer">-1</cn>
               </apply>
              </math>
             </eventAssignment>
            </listOfEventAssignments>
           </event>
          </listOfEvents>
         </model>
        </sbml>