[BioC] rsbml: problem writing a model to file

hettling j.hettling at vu.nl
Thu Mar 22 19:28:18 CET 2012


I found another small problem with writing my model to file:
Whenever there are any parentheses in the math expression in a
KineticLaw, the <kineticLaw/> tag in the written SBML file is empty.

Even for a very simple reaction like:

re<-new("Reaction",id="r1",name="r1",kineticLaw=new("KineticLaw",math=as.expression(parse(text="(A)"))),reactants=list(new("SpeciesReference",species="s1",stoichiometry=1)))

I checked my document object within the "rsbml_write" and "rsbml_xml"
functions and the math expression is correct there. I wrote a small C
program to try if the writeSBML function in libsbml can even handle
parentheses, and it does. In the io.c file, the generic libSBML
functions are called..

Therefore I suspect that something goes wrong in in creating the
SBMLDocument c-object (in the doc.c file?)... do you think this is a god
place to look?

I do not want to bug you with requests all the time, and I will look
further into it, it would be great if you could tell me if I am
searching in the right place. After all I do not have experience with
the R-to-C interface and find it quite hard to dubug.

Many thanks,

Hannes



On Thu, 2012-03-22 at 07:06 -0700, Michael Lawrence wrote:
> 
> 
> On Wed, Mar 21, 2012 at 11:11 AM, hettling <j.hettling at vu.nl> wrote:
>         Dear Michael,
>         
>         Thanks a lot for your help! I got it to work with the
>         development
>         version of the package and libsbml 5.
>         
>         The package does not compile anymore with libsbml 4; I guess
>         the package
>         uses the development version of SOSlib, which says it only
>         works with
>         libsbml 3.0.2 or the latest devel version, so it might be good
>         to change
>         the package requirements.
>         I also had to downgrade sundials from 2.4.0 to 2.3.0 because
>         of SOSlib.
>         
> 
> Well, SOSlib is basically a dead library, and the package should still
> compile, even if SOSlib fails to build. Of course, simulation support
> would not be available.
>  
>         Another thing is that the package gave an error creating an
>         SBML
>         document because it could not find the function
>         "rsbml_perform_check",
>         so I changed line 5 in SBML.R and set the variable "valid" to
>         TRUE,
>         which is a bit of a hack, but it works for now. Is this a
>         check for the
>         validity of the SBML document and is this check done with
>         SOSlib?
>         
> 
> I have fixed this. Not sure how that crept in.
> 
> Thanks,
> Michael
>  
>         Many thanks,
>         
>         Hannes
>         
>         
>         
>         
>         
>         On Tue, 2012-03-20 at 18:03 -0700, Michael Lawrence wrote:
>         > Well, it took a bit longer than I expected, but I have
>         things now
>         > working under libsbml 5.x. Should still work under 4.x
>         (please let me
>         > know).
>         >
>         > I have also fixed the validity checking that was causing
>         your problem.
>         > You'll need the devel (2.13.1) or wait for the release next
>         month.
>         >
>         > Thanks,
>         > Michael
>         >
>         > On Fri, Mar 16, 2012 at 10:27 AM, Michael Lawrence
>         <michafla at gene.com>
>         > wrote:
>         >         Thanks for the report, I will look into this. rsbml
>         currently
>         >         has a number of issues (it doesn't even compile for
>         me right
>         >         now). I need to look into it this weekend.
>         >
>         >         Michael
>         >
>         >
>         >
>         >         On Fri, Mar 16, 2012 at 9:16 AM, hettling
>         <j.hettling at vu.nl>
>         >         wrote:
>         >                 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
>         >
>         >
>         _______________________________________________
>         >                 Bioconductor mailing list
>         >                 Bioconductor at r-project.org
>         >
>         https://stat.ethz.ch/mailman/listinfo/bioconductor
>         >                 Search the archives:
>         >
>         http://news.gmane.org/gmane.science.biology.informatics.conductor
>         >
>         >
>         >
>         
>         
>         
>



More information about the Bioconductor mailing list