Skip to content

Commit

Permalink
build based on 0506022
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Oct 18, 2024
1 parent c48fb62 commit fb3a2f7
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 113 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-18T15:20:23","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-18T15:24:30","documenter_version":"1.7.0"}}
2 changes: 1 addition & 1 deletion dev/API/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
using SBMLImporter, Catalyst
prn, cb = load_SBML(path_SBML)
sbml_species = species(prn.rn)
c = getcompartment(sbml_species[1])</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/sebapersson/SBMLImporter.jl/blob/0506022a465d34394f817d15e468c15c95958b99/src/util.jl#L1-L16">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorial/">« Tutorial</a><a class="docs-footer-nextpage" href="../support/">Supported SBML featuers »</a><div class="flexbox-break"></div><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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Friday 18 October 2024 15:20">Friday 18 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
c = getcompartment(sbml_species[1])</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/sebapersson/SBMLImporter.jl/blob/0506022a465d34394f817d15e468c15c95958b99/src/util.jl#L1-L16">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorial/">« Tutorial</a><a class="docs-footer-nextpage" href="../support/">Supported SBML featuers »</a><div class="flexbox-break"></div><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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Friday 18 October 2024 15:24">Friday 18 October 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
2 changes: 1 addition & 1 deletion dev/FAQ/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
prn, cb = load_SBML(path_SBML)
sbml_reactions = reactions(prn.rn)
getmetadata(sbml_reactions[1], :id)
getmetadata(sbml_reactions[1], :name)</code></pre><h2 id="How-do-I-get-the-compartment-of-an-SBML-specie?"><a class="docs-heading-anchor" href="#How-do-I-get-the-compartment-of-an-SBML-specie?">How do I get the compartment of an SBML specie?</a><a id="How-do-I-get-the-compartment-of-an-SBML-specie?-1"></a><a class="docs-heading-anchor-permalink" href="#How-do-I-get-the-compartment-of-an-SBML-specie?" title="Permalink"></a></h2><p>Every SBML <code>specie</code> has a <code>compartment</code>. SBMLImporter stores the compartment as <code>Catalyst.Species</code> metadata, which can be accessed via the <code>getcompartment</code> function. For more details, see the <a href="../API/#API">API</a>.</p><h2 id="Why-does-my-simulation-fail-with-DomainError-while-the-model-imports-fine?"><a class="docs-heading-anchor" href="#Why-does-my-simulation-fail-with-DomainError-while-the-model-imports-fine?">Why does my simulation fail with <code>DomainError</code> while the model imports fine?</a><a id="Why-does-my-simulation-fail-with-DomainError-while-the-model-imports-fine?-1"></a><a class="docs-heading-anchor-permalink" href="#Why-does-my-simulation-fail-with-DomainError-while-the-model-imports-fine?" title="Permalink"></a></h2><p>This typically happens due to two reasons. Firstly, the model might contain a function call where the argument must be positive, such as:</p><pre><code class="language-julia hljs">log(specie)</code></pre><p>Even though the model might be written such that <code>specie</code> should never go below 0 (e.g., the model follows mass action kinetics), numerical errors can cause <code>specie</code> to go below zero. Therefore, instead of encoding risky statements into the model such as <code>log(specie)</code>, it might be better to encode something like <code>log(specie + 1e-8)</code>.</p><p>Secondly <code>DomainError</code> might arise due to how SBMLImporter parses SBML piecewise expressions. Piecewise expressions are first parsed into <code>ifelse</code> functions:</p><pre><code class="language-julia hljs">ifelse(condition, x, y)</code></pre><p>Which when <code>condition == true</code> evaluates to <code>x</code>, otherwise to <code>y</code>. In SBMLImporter <code>ifelse</code> expressions are further rewritten to callbacks (events). Hence, in the model equations the <code>ifelse</code> is converted to:</p><pre><code class="language-julia hljs">(1 - condition_bool) * x + condition_bool * y</code></pre><p>Here <code>condition_bool</code> is assigned via a callback (event) to be <code>1</code> when <code>condition</code> is <code>true</code>, and to <code>0</code> when <code>condition</code> if <code>false</code>. This has the same functionality as an <code>ifelse</code>, but is numerically more stable because the integrator (e.g., ODE solver) actually stops at points <code>condition</code> changes. Instead, with <code>ifelse</code>, the integrator does not know an event happens and thus must typically reduce its step size to handle the sudden change in models dynamics. This increases simulation time, and reduces simulation stability (e.g. ODE solvers fail more frequently). However, sometimes the formulas in the <code>ifelse</code> might depend on the <code>condition</code>. For example, let&#39;s say we have:</p><pre><code class="language-julia hljs">ifelse(t &gt; 1, 0, log(t - 1))</code></pre><p>With the <code>ifelse</code> formulation, <code>log(t - 1)</code> is never evaluated until <code>t &gt; 1</code>. With the callback formulation:</p><pre><code class="language-julia hljs">(1 - condition_bool) * 0 + condition_bool * log(t-1)</code></pre><p><code>log(t-1)</code> is evaluated for time-points <code>t &lt; 1</code> which causes <code>DomainError</code>. This can be solved by simply not rewriting <code>ifelse</code> to callback when importing the model:</p><pre><code class="language-julia hljs">prn, cb = load_SBML(path; ifelse_to_callback = false)</code></pre><p>If neither of the above solutions work, please file an issue on <a href="https://github.com/sebapersson/SBMLImporter.jl">GitHub</a>.</p><h2 id="Why-did-I-get-the-SBMLSupport-error?"><a class="docs-heading-anchor" href="#Why-did-I-get-the-SBMLSupport-error?">Why did I get the <code>SBMLSupport</code> error?</a><a id="Why-did-I-get-the-SBMLSupport-error?-1"></a><a class="docs-heading-anchor-permalink" href="#Why-did-I-get-the-SBMLSupport-error?" title="Permalink"></a></h2><p>You likely got this error because your SBML model contains an SBML feature that SBMLImporter does not support yet. An extensive list of supported features can be found <a href="../support/#support">here</a>. If SBMLImporter lacks support for a feature you would like to have, please file an issue on <a href="https://github.com/sebapersson/SBMLImporter.jl">GitHub</a>.</p><h2 id="Do-you-support-SBML-export?"><a class="docs-heading-anchor" href="#Do-you-support-SBML-export?">Do you support SBML export?</a><a id="Do-you-support-SBML-export?-1"></a><a class="docs-heading-anchor-permalink" href="#Do-you-support-SBML-export?" title="Permalink"></a></h2><p>We currently do not support exporting Catalyst <code>ReactionSystem</code> to SBML. Most things are available in Julia for supporting SBML export though, so if anyone is interested, we would be happy to provide guidance for creating a SBMLExporter package.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../differences/">« Other SBML related Julia packages</a><div class="flexbox-break"></div><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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Friday 18 October 2024 15:20">Friday 18 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
getmetadata(sbml_reactions[1], :name)</code></pre><h2 id="How-do-I-get-the-compartment-of-an-SBML-specie?"><a class="docs-heading-anchor" href="#How-do-I-get-the-compartment-of-an-SBML-specie?">How do I get the compartment of an SBML specie?</a><a id="How-do-I-get-the-compartment-of-an-SBML-specie?-1"></a><a class="docs-heading-anchor-permalink" href="#How-do-I-get-the-compartment-of-an-SBML-specie?" title="Permalink"></a></h2><p>Every SBML <code>specie</code> has a <code>compartment</code>. SBMLImporter stores the compartment as <code>Catalyst.Species</code> metadata, which can be accessed via the <code>getcompartment</code> function. For more details, see the <a href="../API/#API">API</a>.</p><h2 id="Why-does-my-simulation-fail-with-DomainError-while-the-model-imports-fine?"><a class="docs-heading-anchor" href="#Why-does-my-simulation-fail-with-DomainError-while-the-model-imports-fine?">Why does my simulation fail with <code>DomainError</code> while the model imports fine?</a><a id="Why-does-my-simulation-fail-with-DomainError-while-the-model-imports-fine?-1"></a><a class="docs-heading-anchor-permalink" href="#Why-does-my-simulation-fail-with-DomainError-while-the-model-imports-fine?" title="Permalink"></a></h2><p>This typically happens due to two reasons. Firstly, the model might contain a function call where the argument must be positive, such as:</p><pre><code class="language-julia hljs">log(specie)</code></pre><p>Even though the model might be written such that <code>specie</code> should never go below 0 (e.g., the model follows mass action kinetics), numerical errors can cause <code>specie</code> to go below zero. Therefore, instead of encoding risky statements into the model such as <code>log(specie)</code>, it might be better to encode something like <code>log(specie + 1e-8)</code>.</p><p>Secondly <code>DomainError</code> might arise due to how SBMLImporter parses SBML piecewise expressions. Piecewise expressions are first parsed into <code>ifelse</code> functions:</p><pre><code class="language-julia hljs">ifelse(condition, x, y)</code></pre><p>Which when <code>condition == true</code> evaluates to <code>x</code>, otherwise to <code>y</code>. In SBMLImporter <code>ifelse</code> expressions are further rewritten to callbacks (events). Hence, in the model equations the <code>ifelse</code> is converted to:</p><pre><code class="language-julia hljs">(1 - condition_bool) * x + condition_bool * y</code></pre><p>Here <code>condition_bool</code> is assigned via a callback (event) to be <code>1</code> when <code>condition</code> is <code>true</code>, and to <code>0</code> when <code>condition</code> if <code>false</code>. This has the same functionality as an <code>ifelse</code>, but is numerically more stable because the integrator (e.g., ODE solver) actually stops at points <code>condition</code> changes. Instead, with <code>ifelse</code>, the integrator does not know an event happens and thus must typically reduce its step size to handle the sudden change in models dynamics. This increases simulation time, and reduces simulation stability (e.g. ODE solvers fail more frequently). However, sometimes the formulas in the <code>ifelse</code> might depend on the <code>condition</code>. For example, let&#39;s say we have:</p><pre><code class="language-julia hljs">ifelse(t &gt; 1, 0, log(t - 1))</code></pre><p>With the <code>ifelse</code> formulation, <code>log(t - 1)</code> is never evaluated until <code>t &gt; 1</code>. With the callback formulation:</p><pre><code class="language-julia hljs">(1 - condition_bool) * 0 + condition_bool * log(t-1)</code></pre><p><code>log(t-1)</code> is evaluated for time-points <code>t &lt; 1</code> which causes <code>DomainError</code>. This can be solved by simply not rewriting <code>ifelse</code> to callback when importing the model:</p><pre><code class="language-julia hljs">prn, cb = load_SBML(path; ifelse_to_callback = false)</code></pre><p>If neither of the above solutions work, please file an issue on <a href="https://github.com/sebapersson/SBMLImporter.jl">GitHub</a>.</p><h2 id="Why-did-I-get-the-SBMLSupport-error?"><a class="docs-heading-anchor" href="#Why-did-I-get-the-SBMLSupport-error?">Why did I get the <code>SBMLSupport</code> error?</a><a id="Why-did-I-get-the-SBMLSupport-error?-1"></a><a class="docs-heading-anchor-permalink" href="#Why-did-I-get-the-SBMLSupport-error?" title="Permalink"></a></h2><p>You likely got this error because your SBML model contains an SBML feature that SBMLImporter does not support yet. An extensive list of supported features can be found <a href="../support/#support">here</a>. If SBMLImporter lacks support for a feature you would like to have, please file an issue on <a href="https://github.com/sebapersson/SBMLImporter.jl">GitHub</a>.</p><h2 id="Do-you-support-SBML-export?"><a class="docs-heading-anchor" href="#Do-you-support-SBML-export?">Do you support SBML export?</a><a id="Do-you-support-SBML-export?-1"></a><a class="docs-heading-anchor-permalink" href="#Do-you-support-SBML-export?" title="Permalink"></a></h2><p>We currently do not support exporting Catalyst <code>ReactionSystem</code> to SBML. Most things are available in Julia for supporting SBML export though, so if anyone is interested, we would be happy to provide guidance for creating a SBMLExporter package.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../differences/">« Other SBML related Julia packages</a><div class="flexbox-break"></div><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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Friday 18 October 2024 15:24">Friday 18 October 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit fb3a2f7

Please sign in to comment.