index.html 42.2 KB
Newer Older
Documenter.jl's avatar
Documenter.jl committed
1
<!DOCTYPE html>
Documenter.jl's avatar
Documenter.jl committed
2
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Documentation · SBML.jl</title><script data-outdated-warner src="assets/warner.js"></script><link rel="canonical" href="https://lcsb-biocore.github.io/DistributedData.jl/stable/"/><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.039/juliamono-regular.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href><img src="assets/logo.svg" alt="SBML.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href>SBML.jl</a></span></div><form class="docs-search" action="search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li class="is-active"><a class="tocitem" href>Documentation</a><ul class="internal"><li class="toplevel"><a class="tocitem" href="#Function-reference"><span>Function reference</span></a></li><li><a class="tocitem" href="#Data-structures"><span>Data structures</span></a></li><li><a class="tocitem" href="#Base-functions"><span>Base functions</span></a></li><li><a class="tocitem" href="#libsbml-representation-converters"><span><code>libsbml</code> representation converters</span></a></li><li><a class="tocitem" href="#Data-helpers"><span>Data helpers</span></a></li><li><a class="tocitem" href="#Math-and-Symbolics.jl-compatibility"><span>Math and <code>Symbolics.jl</code> compatibility</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Documentation</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Documentation</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/LCSB-BioCore/SBML.jl/blob/master/docs/src/index.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="SBML.jl-—-load-systems-biology-models-from-SBML-files"><a class="docs-heading-anchor" href="#SBML.jl-—-load-systems-biology-models-from-SBML-files">SBML.jl — load systems biology models from SBML files</a><a id="SBML.jl-—-load-systems-biology-models-from-SBML-files-1"></a><a class="docs-heading-anchor-permalink" href="#SBML.jl-—-load-systems-biology-models-from-SBML-files" title="Permalink"></a></h1><p>This package provides a straightforward way to load model- and simulation-relevant information from SBML files.</p><p>The library provides a single function <a href="#SBML.readSBML"><code>readSBML</code></a> to load a <a href="#SBML.Model"><code>SBML.Model</code></a>:</p><pre><code class="language-julia">julia&gt; using SBML
Documenter.jl's avatar
Documenter.jl committed
3
julia&gt; mdl = readSBML(&quot;Ec_core_flux1.xml&quot;)
Documenter.jl's avatar
Documenter.jl committed
4
SBML.Model(…)
Documenter.jl's avatar
Documenter.jl committed
5
6
7
8

julia&gt; mdl.compartments
2-element Array{String,1}:
 &quot;Extra_organism&quot;
Documenter.jl's avatar
Documenter.jl committed
9
 &quot;Cytosol&quot;</code></pre><p>There are several functions to help you with using the data in the usual COBRA-style workflows, such as <a href="#SBML.getS-Tuple{SBML.Model}"><code>getS</code></a>:</p><pre><code class="language-julia">julia&gt; metabolites, reactions, S = getS(mdl)
Documenter.jl's avatar
Documenter.jl committed
10
11
12
13
14
15
16
17
julia&gt; metabolites
77-element Array{String,1}:
 &quot;M_succoa_c&quot;
 &quot;M_ac_c&quot;
 &quot;M_etoh_c&quot;


julia&gt; S
Documenter.jl's avatar
Documenter.jl committed
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&gt; Matrix(S)
Documenter.jl's avatar
Documenter.jl committed
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's avatar
Documenter.jl committed
41
 ⋮                         ⋮         ⋱  ⋮                          ⋮    </code></pre><h1 id="Function-reference"><a class="docs-heading-anchor" href="#Function-reference">Function reference</a><a id="Function-reference-1"></a><a class="docs-heading-anchor-permalink" href="#Function-reference" title="Permalink"></a></h1><h2 id="Data-structures"><a class="docs-heading-anchor" href="#Data-structures">Data structures</a><a id="Data-structures-1"></a><a class="docs-heading-anchor-permalink" href="#Data-structures" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="SBML.Maybe" href="#SBML.Maybe"><code>SBML.Maybe</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia">Maybe{X}</code></pre><p>Type shortcut for &quot;<code>X</code> or nothing&quot; or &quot;nullable <code>X</code>&quot; in javaspeak. Name got inspired by our functional friends.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L2-L7">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.Compartment" href="#SBML.Compartment"><code>SBML.Compartment</code></a><span class="docstring-category">Type</span></header><section><div><p>SBML Compartment with sizing information.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L109-L111">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.FunctionDefinition" href="#SBML.FunctionDefinition"><code>SBML.FunctionDefinition</code></a><span class="docstring-category">Type</span></header><section><div><p>Custom function definition.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L173-L175">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.GPAAnd" href="#SBML.GPAAnd"><code>SBML.GPAAnd</code></a><span class="docstring-category">Type</span></header><section><div><p>Boolean binary &quot;and&quot; in the association expression</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L44-L46">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.GPAOr" href="#SBML.GPAOr"><code>SBML.GPAOr</code></a><span class="docstring-category">Type</span></header><section><div><p>Boolean binary &quot;or&quot; in the association expression</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L51-L53">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.GPARef" href="#SBML.GPARef"><code>SBML.GPARef</code></a><span class="docstring-category">Type</span></header><section><div><p>Gene product reference in the association expression</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L37-L39">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.GeneProduct" href="#SBML.GeneProduct"><code>SBML.GeneProduct</code></a><span class="docstring-category">Type</span></header><section><div><p>Gene product metadata.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L162-L164">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.GeneProductAssociation" href="#SBML.GeneProductAssociation"><code>SBML.GeneProductAssociation</code></a><span class="docstring-category">Type</span></header><section><div><p>Abstract type for all kinds of gene product associations</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L32-L34">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.Math" href="#SBML.Math"><code>SBML.Math</code></a><span class="docstring-category">Type</span></header><section><div><p>A simplified representation of MathML-specified math AST</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L58-L60">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.MathApply" href="#SBML.MathApply"><code>SBML.MathApply</code></a><span class="docstring-category">Type</span></header><section><div><p>Function application (&quot;call by name&quot;, no tricks allowed) in mathematical expression</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L93-L95">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.MathConst" href="#SBML.MathConst"><code>SBML.MathConst</code></a><span class="docstring-category">Type</span></header><section><div><p>A constant identified by name (usually something like <code>pi</code>, <code>e</code> or <code>true</code>) in mathematical expression</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L77-L80">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.MathIdent" href="#SBML.MathIdent"><code>SBML.MathIdent</code></a><span class="docstring-category">Type</span></header><section><div><p>An identifier (usually a variable name) in mathematical expression</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L70-L72">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.MathLambda" href="#SBML.MathLambda"><code>SBML.MathLambda</code></a><span class="docstring-category">Type</span></header><section><div><p>Function definition (aka &quot;lambda&quot;) in mathematical expression</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L101-L103">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.MathTime" href="#SBML.MathTime"><code>SBML.MathTime</code></a><span class="docstring-category">Type</span></header><section><div><p>A special value representing the current time of the simulation, with a special name.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L85-L88">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.MathVal" href="#SBML.MathVal"><code>SBML.MathVal</code></a><span class="docstring-category">Type</span></header><section><div><p>A literal value (usually a numeric constant) in mathematical expression</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L63-L65">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.Model" href="#SBML.Model"><code>SBML.Model</code></a><span class="docstring-category">Type</span></header><section><div><p>Structure that collects the model-related data. Contains <code>parameters</code>, <code>units</code>, <code>compartments</code>, <code>species</code> and <code>reactions</code> and <code>gene_products</code>, and additional <code>notes</code> and <code>annotation</code> (also present internally in some of the data fields). The contained dictionaries are indexed by identifiers of the corresponding objects.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L184-L190">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.Reaction" href="#SBML.Reaction"><code>SBML.Reaction</code></a><span class="docstring-category">Type</span></header><section><div><p>Reaction with stoichiometry that assigns reactants and products their relative consumption/production rates (accessible in field <code>stoichiometry</code>), lower/upper bounds (in tuples <code>lb</code> and <code>ub</code>, with unit names), and objective coefficient (<code>oc</code>). Also may contains <code>notes</code> and <code>annotation</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L123-L128">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.Species" href="#SBML.Species"><code>SBML.Species</code></a><span class="docstring-category">Type</span></header><section><div><p>Species metadata – contains a human-readable <code>name</code>, a <code>compartment</code> identifier, <code>formula</code>, <code>charge</code>, and additional <code>notes</code> and <code>annotation</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L143-L146">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.UnitPart" href="#SBML.UnitPart"><code>SBML.UnitPart</code></a><span class="docstring-category">Type</span></header><section><div><p>Part of a measurement unit definition that corresponds to the SBML definition of <code>Unit</code>. For example, the unit &quot;per square megahour&quot;, Mh^(-2), is written as:</p><pre><code class="nohighlight">SBML.UnitPart(&quot;second&quot;,  # base SI unit, this says we are measuring time
Documenter.jl's avatar
Documenter.jl committed
42
43
         -2,        # exponent, says &quot;per square&quot;
         6,         # log-10 scale of the unit, says &quot;mega&quot;
Documenter.jl's avatar
Documenter.jl committed
44
         1/3600)    # second-to-hour multiplier</code></pre><p>Compound units (such as &quot;volt-amperes&quot; and &quot;dozens of yards per ounce&quot;) are built from multiple <code>UnitPart</code>s; see the definition of field <code>units</code> in <a href="#SBML.Model"><code>SBML.Model</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/structs.jl#L10-L22">source</a></section></article><h2 id="Base-functions"><a class="docs-heading-anchor" href="#Base-functions">Base functions</a><a id="Base-functions-1"></a><a class="docs-heading-anchor-permalink" href="#Base-functions" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="SBML.SBMLVersion-Tuple{}" href="#SBML.SBMLVersion-Tuple{}"><code>SBML.SBMLVersion</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">function SBMLVersion()</code></pre><p>Get the version of the used SBML library in Julia version format.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/version.jl#L2-L6">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.extractModel-Tuple{Ptr{Nothing}}" href="#SBML.extractModel-Tuple{Ptr{Nothing}}"><code>SBML.extractModel</code></a><span class="docstring-category">Method</span></header><section><div><p>&quot;     function extractModel(mdl::VPtr)::SBML.Model</p><p>Take the <code>SBMLModel_t</code> pointer and extract all information required to make a valid <a href="#SBML.Model"><code>SBML.Model</code></a> structure.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/readsbml.jl#L146-L152">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.getAssociation-Tuple{Ptr{Nothing}}" href="#SBML.getAssociation-Tuple{Ptr{Nothing}}"><code>SBML.getAssociation</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">function getAssociation(x::VPtr)::GeneProductAssociation</code></pre><p>Convert a pointer to SBML <code>FbcAssociation_t</code> to the <code>GeneProductAssociation</code> tree structure.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/readsbml.jl#L116-L121">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.get_optional_bool-Tuple{Ptr{Nothing},Any,Any}" href="#SBML.get_optional_bool-Tuple{Ptr{Nothing},Any,Any}"><code>SBML.get_optional_bool</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">get_optional_bool(x::VPtr, is_sym, get_sym)::Maybe{Bool}</code></pre><p>Helper for getting out boolean flags.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/readsbml.jl#L35-L39">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.get_optional_double-Tuple{Ptr{Nothing},Any,Any}" href="#SBML.get_optional_double-Tuple{Ptr{Nothing},Any,Any}"><code>SBML.get_optional_double</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">get_optional_double(x::VPtr, is_sym, get_sym)::Maybe{Float64}</code></pre><p>Helper for getting out C doubles aka Float64s.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/readsbml.jl#L61-L65">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.get_optional_int-Tuple{Ptr{Nothing},Any,Any}" href="#SBML.get_optional_int-Tuple{Ptr{Nothing},Any,Any}"><code>SBML.get_optional_int</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">get_optional_int(x::VPtr, is_sym, get_sym)::Maybe{UInt}</code></pre><p>Helper for getting out unsigned integers.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/readsbml.jl#L48-L52">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.get_optional_string-Tuple{Ptr{Nothing},Any}" href="#SBML.get_optional_string-Tuple{Ptr{Nothing},Any}"><code>SBML.get_optional_string</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">get_optional_string(x::VPtr, fn_sym)::Maybe{String}</code></pre><p>Like <a href="#SBML.get_string-Tuple{Ptr{Nothing},Any}"><code>get_string</code></a>, but returns <code>nothing</code> instead of throwing an exception.</p><p>This is used to get notes and annotations and several other things (see <code>get_notes</code>, <code>get_annotations</code>)</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/readsbml.jl#L17-L25">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.get_string-Tuple{Ptr{Nothing},Any}" href="#SBML.get_string-Tuple{Ptr{Nothing},Any}"><code>SBML.get_string</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">get_string(x::VPtr, fn_sym)::Maybe{String}</code></pre><p>C-call the SBML function <code>fn_sym</code> with a single parameter <code>x</code>, interpret the result as a string and return it, or throw exception in case the pointer is NULL.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/readsbml.jl#L1-L7">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.readSBML" href="#SBML.readSBML"><code>SBML.readSBML</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">function readSBML(fn::String, sbml_conversion = model-&gt;nothing)::SBML.Model</code></pre><p>Read the SBML from a XML file in <code>fn</code> and return the contained <code>SBML.Model</code>.</p><p>The <code>sbml_conversion</code> is a function that does an in-place modification of the single parameter, which is the C pointer to the loaded SBML document (C type <code>SBMLDocument*</code>). Several functions for doing that are prepared, including <a href="#SBML.set_level_and_version-Tuple{Any,Any}"><code>set_level_and_version</code></a>, <a href="#SBML.libsbml_convert-Tuple{AbstractArray{var&quot;#s39&quot;,1} where var&quot;#s39&quot;&lt;:(Pair{String,var&quot;#s38&quot;} where var&quot;#s38&quot;&lt;:AbstractDict{String,String})}"><code>libsbml_convert</code></a>, and <a href="#SBML.convert_simplify_math"><code>convert_simplify_math</code></a>.</p><p><strong>Example</strong></p><pre><code class="nohighlight">m = readSBML(&quot;my_model.xml&quot;, doc -&gt; begin
Documenter.jl's avatar
Documenter.jl committed
45
    set_level_and_version(3, 1)(doc)
Documenter.jl's avatar
Documenter.jl committed
46
    convert_simplify_math(doc)
Documenter.jl's avatar
Documenter.jl committed
47
end)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/readsbml.jl#L74-L92">source</a></section></article><h2 id="libsbml-representation-converters"><a class="docs-heading-anchor" href="#libsbml-representation-converters"><code>libsbml</code> representation converters</a><a id="libsbml-representation-converters-1"></a><a class="docs-heading-anchor-permalink" href="#libsbml-representation-converters" title="Permalink"></a></h2><p>The converters are intended to be used as parameters of <a href="#SBML.readSBML"><code>readSBML</code></a>.</p><article class="docstring"><header><a class="docstring-binding" id="SBML.convert_simplify_math" href="#SBML.convert_simplify_math"><code>SBML.convert_simplify_math</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">convert_simplify_math</code></pre><p>Shortcut for <a href="#SBML.libsbml_convert-Tuple{AbstractArray{var&quot;#s39&quot;,1} where var&quot;#s39&quot;&lt;:(Pair{String,var&quot;#s38&quot;} where var&quot;#s38&quot;&lt;:AbstractDict{String,String})}"><code>libsbml_convert</code></a> that expands functions, local parameters, and initial assignments in the SBML document.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/converters.jl#L60-L65">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.libsbml_convert-Tuple{AbstractArray{var&quot;#s39&quot;,1} where var&quot;#s39&quot;&lt;:(Pair{String,var&quot;#s38&quot;} where var&quot;#s38&quot;&lt;:AbstractDict{String,String})}" href="#SBML.libsbml_convert-Tuple{AbstractArray{var&quot;#s39&quot;,1} where var&quot;#s39&quot;&lt;:(Pair{String,var&quot;#s38&quot;} where var&quot;#s38&quot;&lt;:AbstractDict{String,String})}"><code>SBML.libsbml_convert</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">libsbml_convert(conversion_options::Vector{Pair{String, Dict{String, String}}})</code></pre><p>A converter that runs the SBML conversion routine, with specified conversion options. The argument is a vector of pairs to allow specifying the order of conversions.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/converters.jl#L15-L21">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.libsbml_convert-Tuple{String}" href="#SBML.libsbml_convert-Tuple{String}"><code>SBML.libsbml_convert</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">libsbml_convert(converter::String; kwargs...)</code></pre><p>Quickly construct a single run of a <code>libsbml</code> converter from keyword arguments.</p><p><strong>Example</strong></p><pre><code class="nohighlight">readSBML(&quot;example.xml&quot;, libsbml_convert(&quot;stripPackage&quot;, package=&quot;layout&quot;))</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/converters.jl#L46-L55">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.set_level_and_version-Tuple{Any,Any}" href="#SBML.set_level_and_version-Tuple{Any,Any}"><code>SBML.set_level_and_version</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">set_level_and_version(level, version)</code></pre><p>A converter to pass into <a href="#SBML.readSBML"><code>readSBML</code></a> that enforces certain SBML level and version.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/converters.jl#L2-L7">source</a></section></article><h2 id="Data-helpers"><a class="docs-heading-anchor" href="#Data-helpers">Data helpers</a><a id="Data-helpers-1"></a><a class="docs-heading-anchor-permalink" href="#Data-helpers" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="SBML.check_errors-Tuple{Integer,Ptr{Nothing},Exception}" href="#SBML.check_errors-Tuple{Integer,Ptr{Nothing},Exception}"><code>SBML.check_errors</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">check_errors(success::Integer, doc::Ptr{Cvoid}, error::Exception)</code></pre><p>If success is a 0-valued <code>Integer</code> (a logical <code>false</code>), then call <a href="#SBML.get_error_messages-Tuple{Ptr{Nothing},Exception}"><code>get_error_messages</code></a> to show the error messages reported by SBML in the <code>doc</code> document and throw the <code>error</code> if they are more than 1.  <code>success</code> is typically the value returned by an SBML C function operating on <code>doc</code> which returns a boolean flag to signal a successful operation.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L155-L163">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.extensive_kinetic_math-Tuple{SBML.Model,SBML.Math}" href="#SBML.extensive_kinetic_math-Tuple{SBML.Model,SBML.Math}"><code>SBML.extensive_kinetic_math</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">extensive_kinetic_math(m::SBML.Model, formula::SBML.Math)</code></pre><p>Convert a SBML math <code>formula</code> to &quot;extensive&quot; kinetic laws, where the references to species that are marked as not having only substance units are converted from amounts to concentrations.</p><p>Handling of units in the conversion process is ignored in this version.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L107-L115">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.getLBs-Tuple{SBML.Model}" href="#SBML.getLBs-Tuple{SBML.Model}"><code>SBML.getLBs</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">getLBs(m::SBML.Model)::Vector{Tuple{Float64,String}}</code></pre><p>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).</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L29-L35">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.getOCs-Tuple{SBML.Model}" href="#SBML.getOCs-Tuple{SBML.Model}"><code>SBML.getOCs</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">getOCs(m::SBML.Model)::Vector{Float64}</code></pre><p>Extract the vector of objective coefficients of each reaction.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L47-L51">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.getS-Tuple{SBML.Model}" href="#SBML.getS-Tuple{SBML.Model}"><code>SBML.getS</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">function getS(m::SBML.Model; zeros=spzeros)::Tuple{Vector{String},Vector{String},AbstractMatrix{Float64}}</code></pre><p>Extract the vector of species (aka metabolite) identifiers, vector of reaction identifiers, and the (dense) stoichiometry matrix from an existing <code>SBML.Model</code>. Returns a tuple with these values.</p><p>The matrix is sparse by default (initially constructed by <code>SparseArrays.spzeros</code>). You can fill in a custom empty matrix constructed to argument <code>zeros</code>; e.g. running with <code>zeros=zeros</code> will produce a dense matrix.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L3-L13">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.getUBs-Tuple{SBML.Model}" href="#SBML.getUBs-Tuple{SBML.Model}"><code>SBML.getUBs</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">getUBs(m::SBML.Model)::Vector{Tuple{Float64,String}}</code></pre><p>Likewise to <a href="#SBML.getLBs-Tuple{SBML.Model}"><code>getLBs</code></a>, extract the upper bounds.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L39-L43">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.get_error_messages-Tuple{Ptr{Nothing},Exception}" href="#SBML.get_error_messages-Tuple{Ptr{Nothing},Exception}"><code>SBML.get_error_messages</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">get_error_messages(doc::Ptr{Cvoid}, error::Exception)</code></pre><p>Show the error messages reported by SBML in the <code>doc</code> document and throw the <code>error</code> if they are more than 1.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L136-L141">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.initial_amounts-Tuple{SBML.Model}" href="#SBML.initial_amounts-Tuple{SBML.Model}"><code>SBML.initial_amounts</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">initial_amounts(m::SBML.Model; convert_concentrations = false)</code></pre><p>Return initial amounts for each species as a generator of pairs <code>species_name =&gt; initial_amount</code>; the amount is set to <code>nothing</code> if not available. If <code>convert_concentrations</code> is true and there is information about initial concentration available together with compartment size, the result is computed from the species&#39; initial concentration.</p><p>In the current version, units of the measurements are completely ignored.</p><p><strong>Example</strong></p><pre><code class="nohighlight"># get the initial amounts as dictionary
Documenter.jl's avatar
Documenter.jl committed
48
49
50
Dict(initial_amounts(model, convert_concentrations = true))

# remove the empty entries
Documenter.jl's avatar
Documenter.jl committed
51
Dict(k =&gt; v for (k,v) in initial_amounts(model) if !isnothing(v))</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L54-L73">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.initial_concentrations-Tuple{SBML.Model}" href="#SBML.initial_concentrations-Tuple{SBML.Model}"><code>SBML.initial_concentrations</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">initial_concentrations(m::SBML.Model; convert_amounts = false)</code></pre><p>Return initial concentrations of the species in the model. Refer to work-alike <a href="#SBML.initial_amounts-Tuple{SBML.Model}"><code>initial_amounts</code></a> for details.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/utils.jl#L87-L92">source</a></section></article><h2 id="Math-and-Symbolics.jl-compatibility"><a class="docs-heading-anchor" href="#Math-and-Symbolics.jl-compatibility">Math and <code>Symbolics.jl</code> compatibility</a><a id="Math-and-Symbolics.jl-compatibility-1"></a><a class="docs-heading-anchor-permalink" href="#Math-and-Symbolics.jl-compatibility" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="SBML.default_symbolics_constants" href="#SBML.default_symbolics_constants"><code>SBML.default_symbolics_constants</code></a><span class="docstring-category">Constant</span></header><section><div><pre><code class="language-julia">const default_symbolics_constants::Dict{String, Any}</code></pre><p>A dictionary of default constants filled in place of SBML Math constants in the symbolics conversion.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/symbolics.jl#L69-L74">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.default_symbolics_mapping" href="#SBML.default_symbolics_mapping"><code>SBML.default_symbolics_mapping</code></a><span class="docstring-category">Constant</span></header><section><div><pre><code class="language-julia">default_symbolics_mapping :: Dict{String,Any}</code></pre><p>Default mapping of SBML function names to Julia functions, represented as a dictionary from Strings (SBML names) to anything <code>eval</code>uable as Julia&amp;Symbolics functions, such as symbols and expressions.</p><p>The default mapping only contains the basic SBML functions that are unambiguously represented in Julia; it is supposed to be extended by the user if more functions need to be supported.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/symbolics.jl#L2-L12">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="Base.convert-Tuple{Type{Symbolics.Num},SBML.Math}" href="#Base.convert-Tuple{Type{Symbolics.Num},SBML.Math}"><code>Base.convert</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">Base.convert(
Documenter.jl's avatar
Documenter.jl committed
52
53
54
55
    ::Type{Num},
    x::SBML.Math;
    mapping = default_symbolics_mapping,
    convert_time = (x::SBML.MathTime) -&gt; Num(Variable(Symbol(x.id))).val,
Documenter.jl's avatar
Documenter.jl committed
56
    convert_const = (x::SBML.MathConst) -&gt; Num(default_symbolics_constants[x.id]),
Documenter.jl's avatar
Documenter.jl committed
57
)</code></pre><p>Convert SBML.<a href="#SBML.Math"><code>Math</code></a> to <code>Num</code> type from Symbolics package. The conversion of functions can be customized by supplying a custom mapping; if nothing is supplied, <a href="#SBML.default_symbolics_mapping"><code>default_symbolics_mapping</code></a> that translates basic functions to their Julia equivalents is assumed.</p><p>Translation of <a href="#SBML.MathLambda"><code>MathLambda</code></a> is not supported by Symbolics.</p><p><a href="#SBML.MathTime"><code>MathTime</code></a> is handled specially, the function from the argument <code>convert_time</code> is called to possibly specify any desired behavior. By default, it just creates a variable with the same name as the time variable name stored in SBML.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/symbolics.jl#L78-L98">source</a></section></article><h3 id="Internal-math-helpers"><a class="docs-heading-anchor" href="#Internal-math-helpers">Internal math helpers</a><a id="Internal-math-helpers-1"></a><a class="docs-heading-anchor-permalink" href="#Internal-math-helpers" title="Permalink"></a></h3><article class="docstring"><header><a class="docstring-binding" id="SBML.ast_is-Tuple{Ptr{Nothing},Symbol}" href="#SBML.ast_is-Tuple{Ptr{Nothing},Symbol}"><code>SBML.ast_is</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">ast_is(ast::VPtr, what::Symbol)::Bool</code></pre><p>Helper for quickly recognizing kinds of ASTs</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/math.jl#L2-L6">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.parse_math-Tuple{Ptr{Nothing}}" href="#SBML.parse_math-Tuple{Ptr{Nothing}}"><code>SBML.parse_math</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">parse_math(ast::VPtr)::Math</code></pre><p>This attempts to parse out a decent Julia-esque (<a href="#SBML.Math"><code>Math</code></a> AST from a pointer to <code>ASTNode_t</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/math.jl#L19-L24">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="SBML.parse_math_children-Tuple{Ptr{Nothing}}" href="#SBML.parse_math_children-Tuple{Ptr{Nothing}}"><code>SBML.parse_math_children</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">parse_math_children(ast::VPtr)::Vector{Math}</code></pre><p>Recursively parse all children of an AST node.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/LCSB-BioCore/SBML.jl/blob/9604c34aca43738d55ce50e4103c371af51239f6/src/math.jl#L9-L13">source</a></section></article></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.3 on <span class="colophon-date" title="Saturday 3 July 2021 07:40">Saturday 3 July 2021</span>. Using Julia version 1.5.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>