[BioC] rsbml: problem writing a model to file

hettling j.hettling at vu.nl
Fri Mar 16 17:16:46 CET 2012


Dear all,

I have some trouble with SBML export using the package 'rsbml'.
The following example of saving a very simple model to file gives an
error on my machine:

require('rsbml')
com<-new("Compartment",id="default_compartment",name="default_compartment",size=1)
sp<-new("Species",id="s1",name="s1",compartment=com at id,initialConcentration=10)
re<-new("Reaction",id="r1",name="r1",kineticLaw=new("KineticLaw",math=as.expression(0)),reactants=list(new("SpeciesReference",species="s1",stoichiometry=1)))
sbml_model<-new("Model",id="mymodel",name="mymodel",compartments=list(com),species=list(sp),reactions=list(re))
sbml_doc<-new("SBML",level=as.integer(2),ver=as.integer(2),model=sbml_model)
rsbml_write(sbml_doc, file="myfile.xml")

The error occurs in creating the SBML object, the message is:
Error in validObject(.Object) : invalid class "SBML" object: FALSE

If the KineticLaw in the reaction is NULL, e.g.:

re<-new("Reaction",id="r1",name="r1",reactants=list(new("SpeciesReference",species="s1",stoichiometry=1)))

the SBML export works without throwing errors. Also, if I create a
document with SBML Level 2, version 1 instead of Level 2, version 2 in
the example above, the code runs without errors. However, then only the
SBML header is written to file and nothing else.

I went through the documentation and tried it with the example models as
well, but I cannot find a solution. I hope I understood right how to
create a document object from a model object.

I installed rsbml via the bioconductor and have libSBML version 4.0.1
(that's whats written in the generated SBML) on Linux with R 2.13.1.


Does anybody know what could be the problem here?

Many thanks in advance,

Hannes Hettling



More information about the Bioconductor mailing list