MathSBML

MathSBML Home Page MathSBML Site Map

MathSBML Model Builder: add/remove/modifyCompartment


addCompartment[options] adds a compartment to the current model. Options are the same as compartmentToSBML. If a compartment by the same id already exists, it is replaced.

If an id is not specified for the compartment, it is automatically generated.

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

modifyCompartment[options] modifies a compartment in the current model. Options are the same as compartmentToSBML.

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

removeCompartment[id] removes a compartment with the given id from the current model.


Example

Input:  newModel["example1", name -> "Example with Compartments"];
        addCompartment[c1, name -> "First Compartment", spatialDimension -> 2, size -> 7.2];
Output: Compartment c1 added.

Input:  addCompartment[c2, name -> "Second One", outside -> c1, units -> "litre", constant -> True];
Output: Compartment c2 added.

Input:  createModel[]
Output: <?xml version="1.0" encoding="UTF-8"?>
        <!-- Generated 27-September-2003 15:28:07.780478 -->
        <!-- Generated by MathSBML 2.1.5b13 (27 Sept 2003) -->
        <sbml xmlns="http://www.sbml.org/sbml/level2"
            level="2"
            version="1">
         <model id="example1"
             name="Example with Compartments">
          <listOfFunctionDefinitions/>
          <listOfUnitDefinitions/>
          <listOfCompartments>
           <compartment id="c1"
               name="First Compartment"
               spatialDimension="2"
               size="7.2"/>
           <compartment id="c2"
               name="Second One"
               units="litre"
               outside="c1"/>
          </listOfCompartments>
          <listOfSpecies/>
          <listOfParameters/>
          <listOfRules/>
          <listOfReactions/>
          <listOfEvents/>
         </model>
        </sbml>

Input:  removeCompartment[c2]
Output: Compartment c2 removed.

Input:  createModel[]
Output: <?xml version="1.0" encoding="UTF-8"?>
        <!-- Generated 27-September-2003 15:30:20.614333 -->
        <!-- Generated by MathSBML 2.1.5b13 (27 Sept 2003) -->
        <sbml xmlns="http://www.sbml.org/sbml/level2"
            level="2"
            version="1">
         <model id="example1"
             name="Example with Compartments">
          <listOfFunctionDefinitions/>
          <listOfUnitDefinitions/>
          <listOfCompartments>
           <compartment id="c1"
               name="First Compartment"
               spatialDimension="2"
               size="7.2"/>
          </listOfCompartments>
          <listOfSpecies/>
          <listOfParameters/>
          <listOfRules/>
          <listOfReactions/>
          <listOfEvents/>
         </model>
        </sbml>

If we now realize that compartment c1 has the wrong size (suppose that it should be 8.5) and that we forgot to give the units as litres, we could modify the model

Input:  modifyCompartment[c1, size -> 8.5, units -> litre]
Output: Previous occurance of c1 removed.
        Compartment c1 added.

Input:  createModel[]
Output: <?xml version="1.0" encoding="UTF-8"?>
        <!-- Generated 29-September-2003 14:44:58.432981 -->
        <!-- Generated by MathSBML 2.1.5b14 (29 Sept 2003) -->
        <sbml xmlns="http://www.sbml.org/sbml/level2"
            level="2"
            version="1">
         <model id="example1"
             name="Example with Compartments">
          <listOfFunctionDefinitions/>
          <listOfUnitDefinitions/>
          <listOfCompartments>
           <compartment id="c1"
               name="First Compartment"
               units="litre"
               spatialDimension="2"
               size="8.5"/>
          </listOfCompartments>
          <listOfSpecies/>
          <listOfParameters/>
          <listOfRules/>
          <listOfReactions/>
          <listOfEvents/>
         </model>
        </sbml>