Alexander Tille
Alexander Tille

Reputation: 43

How can I translate an SBML formula to program code?

I'm new to sbml and I'm really confused.

I want to solve a ODE with Runge Kutta. The ODE is stored in a SBML file. A part of the file looks the following

<listOfReactions>
  <reaction id="growth_P" reversible="false" fast="false">
    <listOfReactants>
      <speciesReference species="P" constant="false"/>
    </listOfReactants>
    <listOfProducts>
      <speciesReference species="P" constant="false"/>
    </listOfProducts>
    <kineticLaw>
      <math xmlns="http://www.w3.org/1998/Math/MathML">
        <apply>
          <times/>
          <ci> Rp </ci>
          <ci> P </ci>
        </apply>
      </math>
      <listOfLocalParameters>
        <localParameter id="Rp" value="1" units="per_second"/>
      </listOfLocalParameters>
    </kineticLaw>
  </reaction>
....
</listOfReactions>

This should describe the reaction dP/dt = Rp*P

And here comes my problem. I don't know how to translate the sbml formula to a formula my program can deal with (python/C++, whatever)

So the best option would be a function like

Product = evaluate_sbml_formula(formula,value_of_reactant)

I read the sbml documentation and didn't find it.

Have you any suggestions? Thanks

Upvotes: 0

Views: 241

Answers (2)

user401247
user401247

Reputation:

The sbml fragment is a bit unusual. Both the reactant and product is P, hence the reaction is P -> P. This means the rate of change of P is zero, ie

dp/dt = 0

In this case it doesn’t matter what the rate law is.

Upvotes: 0

Frank
Frank

Reputation: 1132

without seeing the whole SBML file it is difficult to construct a set of ODE's to solve. In my python course (1) I used libSBML (available as pypi/anaconda package) to solve SBML files with python. Here a link to a file that converts the SBML into ODE's that are then solved with scipy:

https://www.dropbox.com/s/2bfpiausejp0gd0/convert_reactions.py?dl=0

i hope that helps

Upvotes: 2

Related Questions