Expand description
Parser for the Systems Biology Markup Language (SBML):
§Getting started
§Rust
Add it to your Cargo.toml with no default features to avoid all PyO3 nuisances.
[dependencies.rust_sbml]
version = "0.7.0"
default_features=false
For example,
use rust_sbml::Model;
let example=r#"<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
<model timeUnits="second" extentUnits="mole" substanceUnits="mole">
</model>
</sbml>"#;
let result = Model::parse(example);
println!("{:?}", result.unwrap());
See write_to_file.rs for an example on serializing to a file.
§Python
It has only been tested on Linux.
§Using pip
pip install rust_sbml
§From source
Clone the repository.
git clone https://github.com/carrascomj/rust_sbml.git
You need maturin for building it.
python -m pip install maturin
- Build locally
maturin build --release pip install .
- Build on virtualenv (no pip install required)
# --release can be omitted to speed up compilation time maturin develop --release
Having it installed, you can use it as a normal Python package.
from rust_sbml import Model
sbml = Model("examples/EcoliCore.xml")
reaction = sbml.getListOfReactions()[0]
print(reaction.getListOfReactants())
§Milestones
getListOfSpecies()
(id, name)getListOfCompartments()
(id, name)getListOfReactions()
(id, name).getListOfReactants()
(id, name)- .
getListOfProducts()
(id, name)
- Capable of retrieving FBC bounds.
- Published to pypi
- Kinetic Laws, with naive mathml tailored for SBML.
- Metadata, with naive rdf tailored for SBML.
- Test suite with python calls.
- Test suite with libsbml comparison trough cobrapy.
Modules§
Structs§
- Compartment
- A compartment in SBML represents a bounded space in which species are located.
- Constraint
- The Constraint object is a mechanism for stating the assumptions under which a model is designed to operate.
- Function
Definition - The FunctionDefinition object associates an identifier with a function definition. This identifier can then be4 used as the function called in subsequent MathML apply elements.
- Initial
Assignment - InitialAssigments provide a way to declare initial values that must be computed (using a MathML expression).
- Message
- A XML
<message>
node. - Model
- Abstraction over the SBML specification. It traverses each top-level
listOF_ and provides
HashMaps<id, object>
instead. In addition the model units are gathered in anModelUnits
struct. - Model
Raw - SBML model as defined in the SBML Level 3 Version 2 core.
- Model
Units - Bucket struct to hold all units defined on the top level of
ModelRaw
. - Objective
- The Flux Balance Constraints package of SBML defines extensions for the model, including the FBC Objective.
- Parameter
- A Parameter is used in SBML to define a symbol associated with a value; this symbol can then be used in mathematical formulas in a model.
- Reaction
- A reaction in SBML represents any kind of process that can change the quantity of one or more species in a model. Examples of such processes can include transformation, transport, molecular interactions, and more.
- Species
- A species in SBML refers to a pool of entities that
- Species
Reference - Provide a way for reactions to define species as products and reactants.
- Unit
- A Unit object represents a reference to a (possibly transformed) base unit (see UnitSIdRef).
Enums§
- Rule
- Rules provide additional ways to define the values of variables in a model, their
relationships, and the dynamical behaviors of those variables. Rules enable the encoding of
relationships that cannot be expressed using
Reaction
s alone nor by anInitialAssignment
. - UnitSId
- UnitS
IdRef - SBML provides predefined base units, gathered in
UnitSId
. Alternatively, one can use arbitraryCustomUnit
s.
Functions§
- PyInit_
rust_ ⚠sbml - This autogenerated function is called by the python interpreter when importing the module.
- parse_
document - Shortcut to
Model::parse
.