Skip to content

Commit

Permalink
Merge pull request #42 from sebapersson/EnforceMassAction
Browse files Browse the repository at this point in the history
Add option to enforce mass action kinetics
  • Loading branch information
sebapersson authored Mar 14, 2024
2 parents a87b445 + a72f1dd commit ea580f5
Show file tree
Hide file tree
Showing 11 changed files with 77,347 additions and 40 deletions.
2 changes: 1 addition & 1 deletion docs/build/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.0","generation_timestamp":"2024-02-02T19:36:24","documenter_version":"1.2.1"}}
{"documenter":{"julia_version":"1.10.1","generation_timestamp":"2024-03-14T09:17:16","documenter_version":"1.2.1"}}
6 changes: 4 additions & 2 deletions docs/build/API_choosen.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
ifelse_to_callback::Bool=true,
inline_assignment_rules::Bool=false,
write_to_file::Bool=false,
model_as_string::Bool=false)</code></pre><p>Parse an SBML model into a <code>ParsedReactionNetwork</code> and convert SBML events/piecewise to callbacks.</p><p>For information on simulating the <code>ParsedReactionNetwork</code>, as a <code>JumpProblem</code>, a <code>SDEProblem</code>, or an <code>ODEProblem</code> see the documentation.</p><p><code>path_SBML</code> can be the model as a string if <code>model_as_string=true</code>.</p><p><strong>Arguments</strong></p><ul><li><code>path_SBML</code>: File path to a valid SBML file (level 2 or higher).</li><li><code>ifelse_to_callback=true</code>: Whether to rewrite <code>ifelse</code> (piecewise) expressions to callbacks; recommended for performance.</li><li><code>inline_assignment_rules=true</code>: Whether to inline assignment rules into model equations. Recommended for model import speed, however, it will not be possible to access the rule-variable via sol[:var].</li><li><code>write_to_file=false</code>: Whether to write the parsed SBML model to a Julia file in the same directory as the SBML file.</li><li><code>model_as_string=false</code>: Whether or not the model (<code>path_SBML</code>) is provided as a string.</li></ul><p><strong>Returns</strong></p><ul><li><code>parsed_rn</code>: A <code>ParsedReactionNetwork</code> struct that can be converted into a <code>JumpProblem</code>, a <code>SDEProblem</code>, or an <code>ODEProblem</code></li><li><code>cbset</code>: Callbackset (events, piecewise etc...) for the model.</li></ul><p><strong>Examples</strong></p><pre><code class="language-julia hljs"># Import and simulate model as a JumpProblem
model_as_string::Bool=false,
check_massaction=true,
mass_action::Bool=false)</code></pre><p>Parse an SBML model into a <code>ParsedReactionNetwork</code> and convert SBML events/piecewise to callbacks.</p><p>For information on simulating the <code>ParsedReactionNetwork</code>, as a <code>JumpProblem</code>, a <code>SDEProblem</code>, or an <code>ODEProblem</code> see the documentation.</p><p><code>path_SBML</code> can be the model as a string if <code>model_as_string=true</code>.</p><p><strong>Arguments</strong></p><ul><li><code>path_SBML</code>: File path to a valid SBML file (level 2 or higher).</li><li><code>ifelse_to_callback=true</code>: Whether to rewrite <code>ifelse</code> (piecewise) expressions to callbacks; recommended for performance.</li><li><code>inline_assignment_rules=true</code>: Whether to inline assignment rules into model equations. Recommended for model import speed, however, it will not be possible to access the rule-variable via <code>sol[:var]</code>.</li><li><code>write_to_file=false</code>: Whether to write the parsed SBML model to a Julia file in the same directory as the SBML file.</li><li><code>model_as_string=false</code>: Whether or not the model (<code>path_SBML</code>) is provided as a string.</li><li><code>check_massaction=true</code>: Whether to check if and rewrite a reaction to mass action if possible.</li><li><code>mass_action=false</code>: Determines if reactions are treated as mass-action reactions. This option should be set to true <strong>only</strong> if it is certain that the model has mass action reactions, for example if the model is an SBML file produced by BioNetGen.</li></ul><p><strong>Returns</strong></p><ul><li><code>parsed_rn</code>: A <code>ParsedReactionNetwork</code> struct that can be converted into a <code>JumpProblem</code>, a <code>SDEProblem</code>, or an <code>ODEProblem</code></li><li><code>cbset</code>: Callbackset (events, piecewise etc...) for the model.</li></ul><p><strong>Examples</strong></p><pre><code class="language-julia hljs"># Import and simulate model as a JumpProblem
using SBMLImporter, JumpProcesses
prnbng, cb = load_SBML(path_SBML)
tspan = (0.0, 10.0)
Expand All @@ -19,4 +21,4 @@
prnbng, cb = load_SBML(path_SBML)
sys = convert(ODESystem, prnbng.rn)
oprob = ODEProblem(sys, prnbng.u₀, tspan, prnbng.p, jac=true)
sol = solve(oprob, Rodas5P(), callback=cb)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/sebapersson/SBMLImporter.jl/blob/d44a4689b39f895e5a33b311fe368f3ade40b3bc/src/SBML_to_ReactionSystem.jl#L1-L56">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="Support.html">« 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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 2 February 2024 19:36">Friday 2 February 2024</span>. Using Julia version 1.10.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
sol = solve(oprob, Rodas5P(), callback=cb)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/sebapersson/SBMLImporter.jl/blob/7f16e44060fcba1dc4fe5d967467a7bd13ea58cc/src/SBML_to_ReactionSystem.jl#L1-L62">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="Support.html">« 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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Thursday 14 March 2024 09:17">Thursday 14 March 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit ea580f5

Please sign in to comment.