MathSBML

MathSBML Home Page MathSBML Site Map

MathSBML Model Builder: adding a csymbol to an expression


csymbols in infix expressions new in version 2.6

In the model builder mathematical expressions are defined using standard Mathematica infix notation. To identify a variable as a csybmol the angle bracket notation <variable,definitionURL> is used.

Angle Brackets are entered in Mathematica using the escape sequence esc < esc or esc > esc. On the screen they will look very similar to the usual less-than and greater-than characters < and >.

In general, <var,url> will be encoded as

<csymbol encoding="text" definitionURL=url>
  <ci>var</ci>
</csymbol>

Both variable and definitonURL should be strings.

definitionURL should either be a URI (Uniform Resource Indicator, same syntax as a URL) that defines the csymbol or one of the following predefined special strings:

<var,"time"> is equivalent to <var, "http://www.sbml.org/sbml/symbols/time"> and will be encoded as

<csymbol encoding="text"
     definitionURL="http://www.sbml.org/sbml/symbols/time>
     var
</csymbol>

<var,"delay"> is equivalent to <var, "http://www.sbml.org/sbml/symbols/delay"> and will be encoded as

<csymbol encoding="text"
     definitionURL="http://www.sbml.org/sbml/symbols/delay>
     var
</csymbol>

Although the above syntax allows any definitonURL, the only csymbols that are allowed in SBML Level2, either version 1 or version 2, are the csymbols for time and delay. Other user-defined csymbols are not allowed in the current versions of SBML.


Examples


input:  reactionToSBML[A -> B, kineticLaw -> k*X*<t, "time">]
output: 
<reaction ...>
  ...
 <kineticLaw timeUnits="time" substanceUnits="substance">
  <math ... >
   <apply>
    <times/>
    <ci>k</ci>
    <ci>X</ci>
    <csymbol encoding="text"
        definitionURL="http://www.sbml.org/sbml/symbols/time">
     <ci>t</ci>
    </csymbol>
   </apply>
  </math>
  <listOfParameters/>
 </kineticLaw>
</reaction>

input:  ruleToSBML[type -> "rateRule", variable -> "X", 
math -> <t, "time"> - X]
output: 
<rateRule variable="X">
 <math xmlns="http://www.w3.org/1998/Math/MathML">
  <apply>
   <plus/>
   <csymbol encoding="text"
       definitionURL="http://www.sbml.org/sbml/symbols/time">
    <ci>ted</ci>
   </csymbol>
   <apply>
    <times/>
    <cn type="integer">-1</cn>
    <ci>X</ci>
   </apply>
  </apply>
 </math>
</rateRule>

input:  functionToSBML[f, arguments -> {a, b}, math -> a - b<tim, "time">]
output: 
<functionDefinition id="f" name="f">
 <math xmlns="http://www.w3.org/1998/Math/MathML">
  <lambda>
   <bvar>
    <ci>a</ci>
   </bvar>
   <bvar>
    <ci>b</ci>
   </bvar>
   <apply>
    <plus/>
    <ci>a</ci>
    <apply>
     <times/>
     <cn type="integer">-1</cn>
     <apply>
      <times/>
      <ci>b</ci>
      <csymbol encoding="text"
          definitionURL="http://www.sbml.org/sbml/symbols/time">
       <ci>tim</ci>
      </csymbol>
     </apply>
    </apply>
   </apply>
  </lambda>
 </math>
</functionDefinition>



input:  eventToSBML["ev1", trigger -> (A > 25<t, "time">), 
eventAssignment -> (B -> 4 - <w, "http://mydefinitionurl.com/mydef/foo">)]
output: 

<event id="ev1" name="ev1">
 <trigger>
  <math xmlns="http://www.w3.org/1998/Math/MathML">
   <apply>
    <gt/>
    <ci>A</ci>
    <apply>
     <times/>
     <cn type="integer">25</cn>
     <csymbol encoding="text"
         definitionURL="http://www.sbml.org/sbml/symbols/time">
      <ci>t</ci>
     </csymbol>
    </apply>
   </apply>
  </math>
 </trigger>
 <listOfEventAssignments>
  <eventAssignment variable="B">
   <math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
     <plus/>
     <cn type="integer">4</cn>
     <apply>
      <times/>
      <cn type="integer">-1</cn>
      <csymbol encoding="text"
          definitionURL="http://mydefinitionurl.com/mydef/foo">
       <ci>w</ci>
      </csymbol>
     </apply>
    </apply>
   </math>
  </eventAssignment>
 </listOfEventAssignments>
</event>