LibSBML
LibSBML is an open-source software library that provides an application programming interface (API) for the SBML (Systems Biology Markup Language ) format. The libSBML library can be embedded in a software application or used in a web servlet (such as one that might be served by Apache Tomcat) as part of the application or servlet's implementation of support for reading, writing, and manipulating SBML documents and data streams. The core of libSBML is written in ISO standard C++; the library provides API for many programming languages via interfaces generated with the help of SWIG. The libSBML library is free software released under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or any later version. LibSBML was developed thanks to funding from many agencies, particularly the National Institute of General Medical Sciences (NIGMS, USA) as well as the Defense Advanced Research Projects Agency (DARPA, USA) under the Bio-SPICE program.
LibSBML is an open-source software library that provides an application programming interface (API) for the SBML (Systems Biology Markup Language ) format. The libSBML library can be embedded in a software application or used in a web servlet (such as one that might be served by Apache Tomcat) as part of the application or servlet's implementation of support for reading, writing, and manipulating SBML documents and data streams. The core of libSBML is written in ISO standard C++; the library provides API for many programming languages via interfaces generated with the help of SWIG. The libSBML library is free software released under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or any later version. LibSBML was developed thanks to funding from many agencies, particularly the National Institute of General Medical Sciences (NIGMS, USA) as well as the Defense Advanced Research Projects Agency (DARPA, USA) under the Bio-SPICE program. >>> import libsbml >>> >>> # read a document >>> doc = libsbml.readSBMLFromFile(filename) >>> doc = libsbml.readSBMLFromString(string) >>> >>> # helper function that takes either a string >>> # or filename as argument >>> doc = libsbml.readSBML(filename) >>> doc = libsbml.readSBML(string) >>> >>> # write a document >>> libsbml.writeSBMLToFile(doc, filename) True >>> >>> libsbml.writeSBMLToString(doc) ' \n \n \n \n' void createSBML() { // create an SBML Level 3 Version 1 document SBMLDocument* doc = new SBMLDocument(3, 1); // create the model as a sub element of the document Model * model = doc->createModel(); // create a compartment as a sub element of the model Compartment * compartment1 = model->createCompartment(); // create an independent compartment and then add it to the model Compartment * compartment2 = new Compartment(3, 1); model->addCompartment(compartment2); } >>> import libsbml >>> >>> # create an SBML Level 3 Version 1 document >>> sbmlns = libsbml.SBMLNamespaces(3, 1) >>> doc = libsbml.SBMLDocument(sbmlns) >>> >>> #create the model as a sub element of the document >>> model = doc.createModel() >>> >>> #create a compartment as a sub element of the model >>> compartment = model.createCompartment() >>> >>> # set the attributes on the compartment >>> # note a return value of 0 indicates success >>> compartment.setId("cell") 0 >>> compartment.setSize(2.3) 0 >>> compartment.setSpatialDimensions(3) 0 >>> compartment.setUnits("litre") 0 >>> compartment.setConstant(True) 0 >>> >>> # get the attribute values >>> compartment.getId() 'cell' >>> compartment.getSpatialDimensions() 3 >>> >>> # examine the status of the attribute >>> compartment.isSetSize() True >>> compartment.getSize() 2.3 >>> >>> #unset an attribute value >>> compartment.unsetSize() 0 >>> compartment.isSetSize() False >>> compartment.getSize() nan
References
No reference rows published for this article.
Cite this article
MLA
"LibSBML." encyclopegia.org, 2025, https://encyclopegia.org/wiki/libsbml. Accessed 24 November 2026.
Chicago
"LibSBML." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/libsbml.
APA
encyclopegia.org. (2025). LibSBML. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/libsbml
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON