index.html 19.6 KB
 Documenter.jl committed Feb 09, 2021 1   Documenter.jl committed Feb 09, 2021 2 Documentation · SBML.jl

SBML.jl — load systems biology models from SBML files

This package provides a straightforward way to load model- and simulation-relevant information from SBML files.

julia> using SBML 
Documenter.jl committed Feb 09, 2021  3      4      5      6      7      8      9      10      11      12      13      14      15      16      17  julia> mdl = readSBML("Ec_core_flux1.xml") Model(…)  julia> mdl.compartments 2-element Array{String,1}:  "Extra_organism"  "Cytosol"

There are several functions to help you with using the data in the usual COBRA-style workflows, such as getS:

julia> metabolites, reactions, S = getS(mdl) julia> metabolites 77-element Array{String,1}:  "M_succoa_c"  "M_ac_c"  "M_etoh_c"   ⋮  julia> S 
Documenter.jl committed Feb 26, 2021  18      19      20      21      22      23      24      25      26      27      28      29                   77×77 SparseArrays.SparseMatrixCSC{Float64,Int64} with 308 stored entries:   [60,  1]  =  -1.0   [68,  1]  =  1.0   [1 ,  2]  =  1.0   [6 ,  2]  =  -1.0   ⋮   [23, 76]  =  1.0   [56, 76]  =  -1.0   [30, 77]  =  -1.0   [48, 77]  =  1.0  julia> Matrix(S) 
Documenter.jl committed Feb 09, 2021  30      31      32      33      34      35      36      37      38      39      40                           77×77 Array{Float64,2}:  0.0   1.0  0.0  0.0  0.0  0.0  0.0  …  0.0   0.0  0.0   0.0  0.0  0.0  0.0  0.0   0.0  0.0  0.0  0.0  0.0  0.0     0.0   0.0  0.0   0.0  0.0  0.0  0.0  0.0   0.0  0.0  0.0  0.0  0.0  0.0     0.0   0.0  0.0   0.0  0.0  0.0  0.0  0.0   0.0  1.0  0.0  0.0  0.0  0.0     0.0   0.0  0.0   0.0  0.0  0.0  0.0  0.0   0.0  0.0  0.0  0.0  0.0  0.0     0.0   0.0  0.0   0.0  0.0  0.0  0.0  0.0  -1.0  0.0  0.0  0.0  0.0  0.0  …  0.0   0.0  0.0   0.0  0.0  0.0  0.0  0.0   0.0  0.0  0.0  0.0  0.0  0.0     0.0   0.0  1.0  -1.0  0.0  0.0  0.0  0.0   0.0  0.0  0.0  0.0  0.0  0.0     0.0   0.0  0.0   0.0  0.0  0.0  0.0  0.0   0.0  0.0  0.0  0.0  0.0  0.0     0.0   0.0  0.0   0.0  0.0  0.0  0.0  0.0   0.0  0.0  0.0  0.0  0.0  0.0     0.0  -1.0  0.0   0.0  0.0  0.0  0.0 
Documenter.jl committed Mar 17, 2021  41                                                                                                            ⋮                         ⋮         ⋱  ⋮                          ⋮

Functions

Data structures

SBML.MaybeType
Maybe{X}

Type shortcut for "X or nothing" or "nullable X" in javaspeak. Name got inspired by our functional friends.

source
SBML.ModelType

Structure that collects the model-related data. Contains parameters, units, compartments, species and reactions and gene_products, and additional notes and annotation (also present internally in some of the data fields). The contained dictionaries are indexed by identifiers of the corresponding objects.

source
SBML.ReactionType

Reaction with stoichiometry that assigns reactants and products their relative consumption/production rates (accessible in field stoichiometry), lower/upper bounds (in tuples lb and ub, with unit names), and objective coefficient (oc). Also may contains notes and annotation.

source
SBML.SpeciesType

Species metadata – contains a human-readable name, a compartment identifier, formula, charge, and additional notes and annotation.

source
SBML.UnitPartType

Part of a measurement unit definition that corresponds to the SBML definition of Unit. For example, the unit "per square megahour", Mh^(-2), is written as:

UnitPart("second",  # base SI unit, this says we are measuring time 
Documenter.jl committed Feb 09, 2021  42      43                                                                                                            -2,        # exponent, says "per square"          6,         # log-10 scale of the unit, says "mega" 
Documenter.jl committed Mar 17, 2021  44                                                                                                                    1/3600)    # second-to-hour multiplier

Compound units (such as "volt-amperes" and "dozens of yards per ounce") are built from multiple UnitParts; see the definition of field units in Model.

source

Base functions

SBML.SBMLVersionMethod
function SBMLVersion()

Get the version of the used SBML library in Julia version format.

source
SBML.extractModelMethod

" function extractModel(mdl::VPtr)::Model

Take the SBMLModel_t pointer and extract all information required to make a valid Model structure.

source
SBML.getAssociationMethod
function getAssociation(x::VPtr)::GeneProductAssociation

Convert a pointer to SBML FbcAssociation_t to the GeneProductAssociation tree structure.

source
SBML.getOptionalStringMethod
function getOptionalString(x::VPtr, fn_sym)::Maybe{String}

C-call the SBML function fn_sym with a single parameter x, interpret the result as a nullable string pointer and return appropriately.

This is used to get notes and annotations and several other things (see getNotes, getAnnotations)

source

Read the SBML from a XML file in fn and return the contained Model.

source

Data helpers

SBML.getLBsMethod
function getLBs(m::Model)::Vector{Tuple{Float64,String}}

Extract a vector of lower bounds of reaction rates from the model. All bounds are accompanied with the unit of the corresponding value (this behavior is based on SBML specification).

source
SBML.getOCsMethod
function getOCs(m::Model)::Vector{Float64}

Extract the vector of objective coefficients of each reaction.

source
SBML.getSMethod
function getS(m::Model; zeros=spzeros)::Tuple{Vector{String},Vector{String},AbstractMatrix{Float64}}

Extract the vector of species (aka metabolite) identifiers, vector of reaction identifiers, and the (dense) stoichiometry matrix from an existing Model. Returns a tuple with these values.

The matrix is sparse by default (initially constructed by SparseArrays.spzeros). You can fill in a custom empty matrix constructed to argument zeros; e.g. running with zeros=zeros will produce a dense matrix.

source
SBML.getUBsMethod
function getUBs(m::Model)::Vector{Tuple{Float64,String}}

Likewise to getLBs, extract the upper bounds.

source