R, an environment for statistical computing, enjoys popularity in the wider fields of computational biology. Until now, if you would feel like consuming an SBML model in R you could use the Bioconductor project rsbml. It would be great for reading SBML (by transforming it into a DOM).
Over the past weeks I’ve spend some time looking into R bindings for libSBML based on SWIG code generation. This will make it possible to fully create / manipulate / validate SBML documents from R. At the same time support for all SBML packages will be readily available.
First experiments seem to be quite convincing, I’ve ported all the C examples over to R (isn’t it nice how you can write C code in any language?). From here I would hope that some R and SBML enthusiast could write some helper functions to make the functions more R-like. Here the examples:
- addCVTerms.R
- addingEvidenceCodes_1.R
- addingEvidenceCodes_2.R
- addModelHistory.R
- appendAnnotation.R
- convertSBML.R
- createExampleSBML.R
- echoSBML.R
- evaluateMath.R
- printAnnotation.R
- printMath.R
- printNotes.R
- printRegisteredPackages.R
- printSBML.R
- printSupported.R
- printUnits.R
- readSBML.R
- translateMath.R
- unsetAnnotation.R
- unsetNotes.R
- validateSBML.R
In order to install the bindings you need to have R 2.15.1 simply download the binary package for your system:
And then execute
R CMD INSTALL <archivename>
(or choose install from local package in the RGui.) I did not have luck renaming these files, so perhaps the names have to be what they are. If you are interested in compiling a binary package from source, you can use the CMake build files and select WITH_R to have it build the R bindings (tested with SWIG 2.0.4). In any case I would look forward to hear how it is working for you.
2 comments:
Hi Frank,
I tried loading in a file and got the following error. Any ideas?
Colin
R> readSBMLFromFile("BIOMD0000000012.xml")
An object of class "_p_SBMLDocument"
Slot "ref":
Error in slot(object, what) :
no slot of name "ref" for this object of class "_p_SBMLDocument"
Actually all is as it should be, the model is loaded. All that is left is to assign it to a variable and make use of it:
doc <- readSBMLFromFile("BIOMD0000000012.xml");
SBMLDocument_getNumErrors(doc)
Post a Comment