A common emacs interface to define differential equations
In the last few years, I have worked with others in the context of studying ODE models, in classes as well as during research. The tools most people in computational systems biology use are either MATLAB, or COPASI. I prefer to use PyDSTool for its flexibility. A common frustration has been having to switch tools just to collaborate with somebody. As a step towards bridging this gap, a solution I have come up with, is deqn-mode. I took inspiration from org-mode and its various exporters, and would like a mode where I define ODEs in some natural, programming-language-free syntax, and then export it to formatted code. So far, deqn-mode exports to PyDSTool and SBML, along with a plain text export which separates the equations, initial conditions and parameters.
What does it do?
deqn-mode is activated in any file with a .eqn extension. Apart from
doing a rudimentary syntax highlight, deqn-mode parses the text in a
file, ignoring comments starting with a #. Any line starting with a
d is assumed to define an ODE. This allows the extraction of
variable names. Next all non-variable key words are extracted from the
equations, which are assumed to be parameters. Finally, the
non-equation lines are parsed to identify initial conditions and
parameter values. Currently, deqn-mode throws an error in the
- initial condition is not defined for a variable
- parameter not assigned a value
In the second case, deqn-mode will also print the name of the parameter whose value is missing.
deqn-mode defines a series of functions which users can use to
export the equations. These are collected in a hydra, which is called
Upon export, deqn-mode will prompt the user for a filename. If none is given, the name of the .eqn file is used, and the exported file is written in the current directory.
Finally, the SBML export requires the libSBML library for python, which you can install
pip install libsbml.
deqn-mode, clone the repository, and put the following in
(add-to-list 'load-path "/path/to/deqn-repo/") ;; The following is required for finding the python script (setq deqn-python-folder-path "/path/to/deqn-repo/") (require 'deqn-mode)