libsbml set fbc model / reaction / species extension

7 views
Skip to first unread message

Michiel Karrenbelt

unread,
Nov 30, 2018, 10:50:58 AM11/30/18
to libsbml-development
So I can parse FBC plugin related features, now I want the opposite: write a new model and add them

How do I add extension plugin to the model, reactions and species?

Keating, Sarah M.

unread,
Dec 3, 2018, 4:36:07 AM12/3/18
to libsbml-d...@googlegroups.com, Michiel Karrenbelt
The extension plugins will exist if you have declared the fbc namespace
when creating the document/model/species etc. You can access them in the
same way as when parsing.

See

http://sbml.org/Software/libSBML/5.17.0/docs//cpp-api/fbc_example1_8cpp-example.html

Sarah

Matthias König

unread,
Dec 3, 2018, 4:40:11 AM12/3/18
to libsbml-development
Hi Michiel,

You have to enable the package on the SBMLDocument instance.
In addition you have to set the required and strict tags for fbc.
Depending on if you have a strict or non-strict model you set the strict tag (see the fbc specification for definition).


doc.enablePackage("http://www.sbml.org/sbml/level3/version1/fbc/version2", "fbc", True)
doc.setPackageRequired("fbc", False)
fmodel = model.getPlugin("fbc") # type: libsbml.FbcModelPlugin
fmodel.setStrict(False)

Afterwards you can just get the extension plugins and set the information on them (similar to reading them from a file with the package)
Hope this helps.
Code example is based on the python bindings, but should easily transfer to the other libsbml language bindings.

Best Matthias
Reply all
Reply to author
Forward
0 new messages