Commit 8dd0b056 authored by Documenter.jl's avatar Documenter.jl
Browse files

build based on 6d0e83c7

parent 153db974
......@@ -87,4 +87,4 @@ end</code></pre><p>In turn, these variants can be used in <a href="../../functio
nothing
nothing
[7.47738193404817, 1.8840414375838503e-8, 4.860861010127701, -16.023526104614593, … ]
[7.47738193404817, 1.8840414375838503e-8, 4.860861010127701, -16.023526104614593, … ]</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« All advanced tutorials</a><a class="docs-footer-nextpage" href="../2_custom_model/">Working with custom models »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
[7.47738193404817, 1.8840414375838503e-8, 4.860861010127701, -16.023526104614593, … ]</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« All advanced tutorials</a><a class="docs-footer-nextpage" href="../2_custom_model/">Working with custom models »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
......@@ -43,4 +43,4 @@ Dict{String, Float64} with 5 entries:
&quot;rxn4&quot; =&gt; 1.0
</code></pre><h2 id="Writing-generic-model-modifications"><a class="docs-heading-anchor" href="#Writing-generic-model-modifications">Writing generic model modifications</a><a id="Writing-generic-model-modifications-1"></a><a class="docs-heading-anchor-permalink" href="#Writing-generic-model-modifications" title="Permalink"></a></h2><p>The custom model structure can also be made compatible with many of the existing variant-generating functions and analysis modifiers.</p><p>The functions prepared for use as &quot;variants&quot; in <a href="../../functions/analysis/#COBREXA.screen-Tuple"><code>screen</code></a>, usually prefixed by <code>with_</code>, have their generic variants that only call simpler, overloadable functions for each specific model. This choice is based on the overloading dispatch system of Julia. For example,<a href="../../functions/reconstruction/#COBREXA.with_removed_metabolites-Tuple"><code>with_removed_metabolites</code></a> is implemented very generically by reducing the problem to some specific <a href="../../functions/reconstruction/#COBREXA.remove_metabolites-Tuple{CoreModel, AbstractVector{Int64}}"><code>remove_metabolites</code></a> functions selected by the dispatch, as follows:</p><pre><code class="language-julia">with_removed_metabolites(args...; kwargs...) =
m -&gt; remove_metabolites(m, args...; kwargs...)</code></pre><p>To be able to use <a href="../../functions/reconstruction/#COBREXA.with_removed_metabolites-Tuple"><code>with_removed_metabolites</code></a> in your model, we can just overload the actual inner function. For the simple circular model, the modification might as well look like this:</p><pre><code class="language-julia">COBREXA.remove_metabolites(m::CircularModel, n::Int) =
return CircularModel(m.size - n)</code></pre><div class="admonition is-danger"><header class="admonition-header">Functions that generate model variants must be pure</header><div class="admonition-body"><p>Notice that the function is &quot;pure&quot;, i.e., does not make any in-place modifications to the original model structure. That property is required for <a href="../../functions/analysis/#COBREXA.screen-Tuple"><code>screen</code></a> and other functions to properly and predictably apply the modifications to the model. To expose potential in-place modifications to your codebase, you should instead overload the &quot;bang&quot; counterpart of remove metabolites, called <a href="../../functions/reconstruction/#COBREXA.remove_metabolites!-Tuple{CoreModel, AbstractVector{Int64}}"><code>remove_metabolites!</code></a>.</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../1_variants/">« Exploring many model variants</a><a class="docs-footer-nextpage" href="../../notebooks/">All notebooks »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
return CircularModel(m.size - n)</code></pre><div class="admonition is-danger"><header class="admonition-header">Functions that generate model variants must be pure</header><div class="admonition-body"><p>Notice that the function is &quot;pure&quot;, i.e., does not make any in-place modifications to the original model structure. That property is required for <a href="../../functions/analysis/#COBREXA.screen-Tuple"><code>screen</code></a> and other functions to properly and predictably apply the modifications to the model. To expose potential in-place modifications to your codebase, you should instead overload the &quot;bang&quot; counterpart of remove metabolites, called <a href="../../functions/reconstruction/#COBREXA.remove_metabolites!-Tuple{CoreModel, AbstractVector{Int64}}"><code>remove_metabolites!</code></a>.</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../1_variants/">« Exploring many model variants</a><a class="docs-footer-nextpage" href="../../notebooks/">All notebooks »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>All advanced tutorials · COBREXA.jl</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/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><link href="../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../"><img class="docs-light-only" src="../assets/logo.svg" alt="COBREXA.jl logo"/><img class="docs-dark-only" src="../assets/logo-dark.svg" alt="COBREXA.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit">COBREXA.jl</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><a class="tocitem" href="../">Home</a></li><li><span class="tocitem">User guide</span><ul><li><input class="collapse-toggle" id="menuitem-2-1" type="checkbox"/><label class="tocitem" for="menuitem-2-1"><span class="docs-label">Quickstart tutorials</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../tutorials/">All tutorials</a></li><li><a class="tocitem" href="../tutorials/1_loading/">Loading and converting model data</a></li><li><a class="tocitem" href="../tutorials/2_analysis/">Basic analysis of constraint-based models</a></li><li><a class="tocitem" href="../tutorials/3_hpc/">Distributed processing and HPC environments</a></li><li><a class="tocitem" href="../tutorials/4_modifying/">Modifying and saving the models</a></li></ul></li><li><input class="collapse-toggle" id="menuitem-2-2" type="checkbox" checked/><label class="tocitem" for="menuitem-2-2"><span class="docs-label">Advanced tutorials</span><i class="docs-chevron"></i></label><ul class="collapsed"><li class="is-active"><a class="tocitem" href>All advanced tutorials</a></li><li><a class="tocitem" href="1_variants/">Exploring many model variants</a></li><li><a class="tocitem" href="2_custom_model/">Working with custom models</a></li></ul></li><li><input class="collapse-toggle" id="menuitem-2-3" type="checkbox"/><label class="tocitem" for="menuitem-2-3"><span class="docs-label">Examples and notebooks</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../notebooks/">All notebooks</a></li><li><a class="tocitem" href="../notebooks/1_loading_converting_saving/">Loading, converting, and saving models</a></li><li><a class="tocitem" href="../notebooks/2_finding_balance/">Finding balance and variability of constraint-based models</a></li><li><a class="tocitem" href="../notebooks/3_basic_stdmodel_usage/">Basic usage of <code>StandardModel</code></a></li><li><a class="tocitem" href="../notebooks/4_basic_core_coupled_usage/">Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code></a></li><li><a class="tocitem" href="../notebooks/5_basic_stdmodel_construction/">Model construction and modification</a></li><li><a class="tocitem" href="../notebooks/6_screening/">Exploring model variants with <code>screen</code></a></li><li><a class="tocitem" href="../notebooks/7_community_model/">Building and analysing a small community model</a></li><li><a class="tocitem" href="../notebooks/8_custom_model/">Using a custom model data structure</a></li><li><a class="tocitem" href="../notebooks/9_max_min_driving_force_analysis/">Maximum-minimum driving force analysis</a></li></ul></li></ul></li><li><span class="tocitem">Types and functions</span><ul><li><a class="tocitem" href="../functions/">Contents</a></li><li><a class="tocitem" href="../functions/analysis/">Analysis functions</a></li><li><a class="tocitem" href="../functions/base/">Base functions</a></li><li><a class="tocitem" href="../functions/io/">Input and output</a></li><li><a class="tocitem" href="../functions/reconstruction/">Model construction functions</a></li><li><a class="tocitem" href="../functions/types/">Types</a></li><li><a class="tocitem" href="../functions/utils/">Utilities</a></li></ul></li><li><a class="tocitem" href="../howToContribute/">How to contribute</a></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><a class="is-disabled">User guide</a></li><li><a class="is-disabled">Advanced tutorials</a></li><li class="is-active"><a href>All advanced tutorials</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>All advanced tutorials</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/lcsb-biocore/COBREXA.jl/blob/master/docs/src/advanced.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="COBREXA-Advanced-tutorials"><a class="docs-heading-anchor" href="#COBREXA-Advanced-tutorials">COBREXA Advanced tutorials</a><a id="COBREXA-Advanced-tutorials-1"></a><a class="docs-heading-anchor-permalink" href="#COBREXA-Advanced-tutorials" title="Permalink"></a></h1><ul><li><a href="1_variants/#Exploring-many-model-variants">Exploring many model variants</a></li><ul><li><a href="1_variants/#Variant-specification">Variant specification</a></li><li><a href="1_variants/#Writing-custom-variant-functions">Writing custom variant functions</a></li><li><a href="1_variants/#Passing-extra-arguments-to-the-analysis-function">Passing extra arguments to the analysis function</a></li></ul><li><a href="2_custom_model/#Working-with-custom-models">Working with custom models</a></li><ul><li><a href="2_custom_model/#Writing-the-generic-accessors">Writing the generic accessors</a></li><li><a href="2_custom_model/#Writing-generic-model-modifications">Writing generic model modifications</a></li></ul></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorials/4_modifying/">« Modifying and saving the models</a><a class="docs-footer-nextpage" href="1_variants/">Exploring many model variants »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>All advanced tutorials · COBREXA.jl</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/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><link href="../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../"><img class="docs-light-only" src="../assets/logo.svg" alt="COBREXA.jl logo"/><img class="docs-dark-only" src="../assets/logo-dark.svg" alt="COBREXA.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit">COBREXA.jl</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><a class="tocitem" href="../">Home</a></li><li><span class="tocitem">User guide</span><ul><li><input class="collapse-toggle" id="menuitem-2-1" type="checkbox"/><label class="tocitem" for="menuitem-2-1"><span class="docs-label">Quickstart tutorials</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../tutorials/">All tutorials</a></li><li><a class="tocitem" href="../tutorials/1_loading/">Loading and converting model data</a></li><li><a class="tocitem" href="../tutorials/2_analysis/">Basic analysis of constraint-based models</a></li><li><a class="tocitem" href="../tutorials/3_hpc/">Distributed processing and HPC environments</a></li><li><a class="tocitem" href="../tutorials/4_modifying/">Modifying and saving the models</a></li></ul></li><li><input class="collapse-toggle" id="menuitem-2-2" type="checkbox" checked/><label class="tocitem" for="menuitem-2-2"><span class="docs-label">Advanced tutorials</span><i class="docs-chevron"></i></label><ul class="collapsed"><li class="is-active"><a class="tocitem" href>All advanced tutorials</a></li><li><a class="tocitem" href="1_variants/">Exploring many model variants</a></li><li><a class="tocitem" href="2_custom_model/">Working with custom models</a></li></ul></li><li><input class="collapse-toggle" id="menuitem-2-3" type="checkbox"/><label class="tocitem" for="menuitem-2-3"><span class="docs-label">Examples and notebooks</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../notebooks/">All notebooks</a></li><li><a class="tocitem" href="../notebooks/1_loading_converting_saving/">Loading, converting, and saving models</a></li><li><a class="tocitem" href="../notebooks/2_finding_balance/">Finding balance and variability of constraint-based models</a></li><li><a class="tocitem" href="../notebooks/3_basic_stdmodel_usage/">Basic usage of <code>StandardModel</code></a></li><li><a class="tocitem" href="../notebooks/4_basic_core_coupled_usage/">Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code></a></li><li><a class="tocitem" href="../notebooks/5_basic_stdmodel_construction/">Model construction and modification</a></li><li><a class="tocitem" href="../notebooks/6_screening/">Exploring model variants with <code>screen</code></a></li><li><a class="tocitem" href="../notebooks/7_community_model/">Building and analysing a small community model</a></li><li><a class="tocitem" href="../notebooks/8_custom_model/">Using a custom model data structure</a></li><li><a class="tocitem" href="../notebooks/9_max_min_driving_force_analysis/">Maximum-minimum driving force analysis</a></li></ul></li></ul></li><li><span class="tocitem">Types and functions</span><ul><li><a class="tocitem" href="../functions/">Contents</a></li><li><a class="tocitem" href="../functions/analysis/">Analysis functions</a></li><li><a class="tocitem" href="../functions/base/">Base functions</a></li><li><a class="tocitem" href="../functions/io/">Input and output</a></li><li><a class="tocitem" href="../functions/reconstruction/">Model construction functions</a></li><li><a class="tocitem" href="../functions/types/">Types</a></li><li><a class="tocitem" href="../functions/utils/">Utilities</a></li></ul></li><li><a class="tocitem" href="../howToContribute/">How to contribute</a></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><a class="is-disabled">User guide</a></li><li><a class="is-disabled">Advanced tutorials</a></li><li class="is-active"><a href>All advanced tutorials</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>All advanced tutorials</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/lcsb-biocore/COBREXA.jl/blob/master/docs/src/advanced.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="COBREXA-Advanced-tutorials"><a class="docs-heading-anchor" href="#COBREXA-Advanced-tutorials">COBREXA Advanced tutorials</a><a id="COBREXA-Advanced-tutorials-1"></a><a class="docs-heading-anchor-permalink" href="#COBREXA-Advanced-tutorials" title="Permalink"></a></h1><ul><li><a href="1_variants/#Exploring-many-model-variants">Exploring many model variants</a></li><ul><li><a href="1_variants/#Variant-specification">Variant specification</a></li><li><a href="1_variants/#Writing-custom-variant-functions">Writing custom variant functions</a></li><li><a href="1_variants/#Passing-extra-arguments-to-the-analysis-function">Passing extra arguments to the analysis function</a></li></ul><li><a href="2_custom_model/#Working-with-custom-models">Working with custom models</a></li><ul><li><a href="2_custom_model/#Writing-the-generic-accessors">Writing the generic accessors</a></li><li><a href="2_custom_model/#Writing-generic-model-modifications">Writing generic model modifications</a></li></ul></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorials/4_modifying/">« Modifying and saving the models</a><a class="docs-footer-nextpage" href="1_variants/">Exploring many model variants »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Contents · COBREXA.jl</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/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><link href="../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../"><img class="docs-light-only" src="../assets/logo.svg" alt="COBREXA.jl logo"/><img class="docs-dark-only" src="../assets/logo-dark.svg" alt="COBREXA.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit">COBREXA.jl</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><a class="tocitem" href="../">Home</a></li><li><span class="tocitem">User guide</span><ul><li><input class="collapse-toggle" id="menuitem-2-1" type="checkbox"/><label class="tocitem" for="menuitem-2-1"><span class="docs-label">Quickstart tutorials</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../tutorials/">All tutorials</a></li><li><a class="tocitem" href="../tutorials/1_loading/">Loading and converting model data</a></li><li><a class="tocitem" href="../tutorials/2_analysis/">Basic analysis of constraint-based models</a></li><li><a class="tocitem" href="../tutorials/3_hpc/">Distributed processing and HPC environments</a></li><li><a class="tocitem" href="../tutorials/4_modifying/">Modifying and saving the models</a></li></ul></li><li><input class="collapse-toggle" id="menuitem-2-2" type="checkbox"/><label class="tocitem" for="menuitem-2-2"><span class="docs-label">Advanced tutorials</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../advanced/">All advanced tutorials</a></li><li><a class="tocitem" href="../advanced/1_variants/">Exploring many model variants</a></li><li><a class="tocitem" href="../advanced/2_custom_model/">Working with custom models</a></li></ul></li><li><input class="collapse-toggle" id="menuitem-2-3" type="checkbox"/><label class="tocitem" for="menuitem-2-3"><span class="docs-label">Examples and notebooks</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../notebooks/">All notebooks</a></li><li><a class="tocitem" href="../notebooks/1_loading_converting_saving/">Loading, converting, and saving models</a></li><li><a class="tocitem" href="../notebooks/2_finding_balance/">Finding balance and variability of constraint-based models</a></li><li><a class="tocitem" href="../notebooks/3_basic_stdmodel_usage/">Basic usage of <code>StandardModel</code></a></li><li><a class="tocitem" href="../notebooks/4_basic_core_coupled_usage/">Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code></a></li><li><a class="tocitem" href="../notebooks/5_basic_stdmodel_construction/">Model construction and modification</a></li><li><a class="tocitem" href="../notebooks/6_screening/">Exploring model variants with <code>screen</code></a></li><li><a class="tocitem" href="../notebooks/7_community_model/">Building and analysing a small community model</a></li><li><a class="tocitem" href="../notebooks/8_custom_model/">Using a custom model data structure</a></li><li><a class="tocitem" href="../notebooks/9_max_min_driving_force_analysis/">Maximum-minimum driving force analysis</a></li></ul></li></ul></li><li><span class="tocitem">Types and functions</span><ul><li class="is-active"><a class="tocitem" href>Contents</a></li><li><a class="tocitem" href="analysis/">Analysis functions</a></li><li><a class="tocitem" href="base/">Base functions</a></li><li><a class="tocitem" href="io/">Input and output</a></li><li><a class="tocitem" href="reconstruction/">Model construction functions</a></li><li><a class="tocitem" href="types/">Types</a></li><li><a class="tocitem" href="utils/">Utilities</a></li></ul></li><li><a class="tocitem" href="../howToContribute/">How to contribute</a></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><a class="is-disabled">Types and functions</a></li><li class="is-active"><a href>Contents</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Contents</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/lcsb-biocore/COBREXA.jl/blob/master/docs/src/functions.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="Types-and-functions"><a class="docs-heading-anchor" href="#Types-and-functions">Types and functions</a><a id="Types-and-functions-1"></a><a class="docs-heading-anchor-permalink" href="#Types-and-functions" title="Permalink"></a></h1><ul><li><a href="analysis/#Analysis-functions">Analysis functions</a></li><ul><li><a href="analysis/#Common-analysis-functions">Common analysis functions</a></li><li><a href="analysis/#Sampling">Sampling</a></li><li><a href="analysis/#Analysis-modifiers">Analysis modifiers</a></li></ul><li><a href="base/#Base-functions">Base functions</a></li><li><a href="io/#Input-and-output">Input and output</a></li><ul><li><a href="io/#File-I/O-and-serialization">File I/O and serialization</a></li><li><a href="io/#Pretty-printing">Pretty printing</a></li></ul><li><a href="reconstruction/#Model-construction-functions">Model construction functions</a></li><ul><li><a href="reconstruction/#Functions-for-changing-the-models">Functions for changing the models</a></li><li><a href="reconstruction/#Variant-specifiers">Variant specifiers</a></li></ul><li><a href="types/#Types">Types</a></li><ul><li><a href="types/#Base-types">Base types</a></li><li><a href="types/#Model-types-and-contents">Model types and contents</a></li></ul><li><a href="utils/#Utilities">Utilities</a></li><ul><li><a href="utils/#Helper-functions">Helper functions</a></li><li><a href="utils/#Macro-generated-functions-and-internal-helpers">Macro-generated functions and internal helpers</a></li><li><a href="utils/#Logging-and-debugging-helpers">Logging and debugging helpers</a></li></ul></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../notebooks/9_max_min_driving_force_analysis/">« Maximum-minimum driving force analysis</a><a class="docs-footer-nextpage" href="analysis/">Analysis functions »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Contents · COBREXA.jl</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/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><link href="../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../"><img class="docs-light-only" src="../assets/logo.svg" alt="COBREXA.jl logo"/><img class="docs-dark-only" src="../assets/logo-dark.svg" alt="COBREXA.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit">COBREXA.jl</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><a class="tocitem" href="../">Home</a></li><li><span class="tocitem">User guide</span><ul><li><input class="collapse-toggle" id="menuitem-2-1" type="checkbox"/><label class="tocitem" for="menuitem-2-1"><span class="docs-label">Quickstart tutorials</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../tutorials/">All tutorials</a></li><li><a class="tocitem" href="../tutorials/1_loading/">Loading and converting model data</a></li><li><a class="tocitem" href="../tutorials/2_analysis/">Basic analysis of constraint-based models</a></li><li><a class="tocitem" href="../tutorials/3_hpc/">Distributed processing and HPC environments</a></li><li><a class="tocitem" href="../tutorials/4_modifying/">Modifying and saving the models</a></li></ul></li><li><input class="collapse-toggle" id="menuitem-2-2" type="checkbox"/><label class="tocitem" for="menuitem-2-2"><span class="docs-label">Advanced tutorials</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../advanced/">All advanced tutorials</a></li><li><a class="tocitem" href="../advanced/1_variants/">Exploring many model variants</a></li><li><a class="tocitem" href="../advanced/2_custom_model/">Working with custom models</a></li></ul></li><li><input class="collapse-toggle" id="menuitem-2-3" type="checkbox"/><label class="tocitem" for="menuitem-2-3"><span class="docs-label">Examples and notebooks</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../notebooks/">All notebooks</a></li><li><a class="tocitem" href="../notebooks/1_loading_converting_saving/">Loading, converting, and saving models</a></li><li><a class="tocitem" href="../notebooks/2_finding_balance/">Finding balance and variability of constraint-based models</a></li><li><a class="tocitem" href="../notebooks/3_basic_stdmodel_usage/">Basic usage of <code>StandardModel</code></a></li><li><a class="tocitem" href="../notebooks/4_basic_core_coupled_usage/">Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code></a></li><li><a class="tocitem" href="../notebooks/5_basic_stdmodel_construction/">Model construction and modification</a></li><li><a class="tocitem" href="../notebooks/6_screening/">Exploring model variants with <code>screen</code></a></li><li><a class="tocitem" href="../notebooks/7_community_model/">Building and analysing a small community model</a></li><li><a class="tocitem" href="../notebooks/8_custom_model/">Using a custom model data structure</a></li><li><a class="tocitem" href="../notebooks/9_max_min_driving_force_analysis/">Maximum-minimum driving force analysis</a></li></ul></li></ul></li><li><span class="tocitem">Types and functions</span><ul><li class="is-active"><a class="tocitem" href>Contents</a></li><li><a class="tocitem" href="analysis/">Analysis functions</a></li><li><a class="tocitem" href="base/">Base functions</a></li><li><a class="tocitem" href="io/">Input and output</a></li><li><a class="tocitem" href="reconstruction/">Model construction functions</a></li><li><a class="tocitem" href="types/">Types</a></li><li><a class="tocitem" href="utils/">Utilities</a></li></ul></li><li><a class="tocitem" href="../howToContribute/">How to contribute</a></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><a class="is-disabled">Types and functions</a></li><li class="is-active"><a href>Contents</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Contents</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/lcsb-biocore/COBREXA.jl/blob/master/docs/src/functions.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="Types-and-functions"><a class="docs-heading-anchor" href="#Types-and-functions">Types and functions</a><a id="Types-and-functions-1"></a><a class="docs-heading-anchor-permalink" href="#Types-and-functions" title="Permalink"></a></h1><ul><li><a href="analysis/#Analysis-functions">Analysis functions</a></li><ul><li><a href="analysis/#Common-analysis-functions">Common analysis functions</a></li><li><a href="analysis/#Sampling">Sampling</a></li><li><a href="analysis/#Analysis-modifiers">Analysis modifiers</a></li></ul><li><a href="base/#Base-functions">Base functions</a></li><li><a href="io/#Input-and-output">Input and output</a></li><ul><li><a href="io/#File-I/O-and-serialization">File I/O and serialization</a></li><li><a href="io/#Pretty-printing">Pretty printing</a></li></ul><li><a href="reconstruction/#Model-construction-functions">Model construction functions</a></li><ul><li><a href="reconstruction/#Functions-for-changing-the-models">Functions for changing the models</a></li><li><a href="reconstruction/#Variant-specifiers">Variant specifiers</a></li></ul><li><a href="types/#Types">Types</a></li><ul><li><a href="types/#Base-types">Base types</a></li><li><a href="types/#Model-types-and-contents">Model types and contents</a></li><li><a href="types/#Model-type-wrappers">Model type wrappers</a></li></ul><li><a href="utils/#Utilities">Utilities</a></li><ul><li><a href="utils/#Helper-functions">Helper functions</a></li><li><a href="utils/#Macro-generated-functions-and-internal-helpers">Macro-generated functions and internal helpers</a></li><li><a href="utils/#Logging-and-debugging-helpers">Logging and debugging helpers</a></li></ul></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../notebooks/9_max_min_driving_force_analysis/">« Maximum-minimum driving force analysis</a><a class="docs-footer-nextpage" href="analysis/">Analysis functions »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -5,4 +5,4 @@
$ julia</code></pre><p>With Julia, you can install the development version of the package from the directory as follows:</p><pre><code class="language-julia">(v1.6) pkg&gt; add .</code></pre><p>(press <code>]</code> to get into the packaging environment)</p><p>This adds the <code>COBREXA.jl</code> package and all its dependencies. You can verify that the installation worked by typing:</p><pre><code class="language-julia">(v1.6) pkg&gt; status</code></pre><p>If you are planning to develop the package, it is often easier to install the package in development mode, with <code>dev</code> command:</p><pre><code class="language-julia">(v1.6) pkg&gt; dev .</code></pre><p>That causes the package to always load with whatever code changes that you added to the source directory.</p><h4 id="Finally:-load-COBREXA.jl"><a class="docs-heading-anchor" href="#Finally:-load-COBREXA.jl">Finally: load COBREXA.jl</a><a id="Finally:-load-COBREXA.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Finally:-load-COBREXA.jl" title="Permalink"></a></h4><p>With both of above options, you should get COBREXA.jl installed, which means that the following command should, without errors, load the package and make COBREXA.jl functions available for testing:</p><pre><code class="language-julia">julia&gt; using COBREXA</code></pre><p>You may now freely modify the code and test the result.</p><p>Remember that if you want to work in the environment of the package, you need to <em>activate</em> it. That causes, among other, that the additional dependencies specified with packaging <code>add</code> command will be written automaticaly to <code>Project.toml</code> file of your local COBREXA.jl clone, not to your global environment. Activation is simple: when in the directory of the package, just type the command into the packaging shell:</p><pre><code class="language-julia">(v1.6) pkg&gt; activate</code></pre><h3 id="Step-2:-Publish-your-changes"><a class="docs-heading-anchor" href="#Step-2:-Publish-your-changes">Step 2: Publish your changes</a><a id="Step-2:-Publish-your-changes-1"></a><a class="docs-heading-anchor-permalink" href="#Step-2:-Publish-your-changes" title="Permalink"></a></h3><p>You are expected to make a fork of the main COBREXA.jl repository, and open a pull request from that one to the <code>develop</code> branch of the main repository. For creating the fork, just hit the &quot;Fork&quot; button on GitHub.</p><p>After that, change the directory to your repository and adjust the remotes:</p><pre><code class="language-bash">$ cd ~/.julia/dev/COBREXA # or any other directory, as needed
$ git remote rename origin upstream # renames the origin (the main COBREXA.jl repo) to upstream
$ git remote add origin git@github.com:yourUsername/COBREXA.jl.git # adds the link to your clone as new origin
$ git fetch origin # fetches the refs from your repo</code></pre><p>In the above code, change <code>yourUsername</code> is your GitHub username.</p><p>When the renaming is done, start a new branch at <code>upstream/master</code>. In the code snippet, substitute <code>yn</code> for your initials (Your Name here) and give the new feature a better name than <code>somefeature</code>:</p><pre><code class="language-bash">$ git checkout -b yn-somefeature origin/master</code></pre><p>Commit any changes and features that you like to the new branch. When the commits look complete to you, push the branch to your repository fork:</p><pre><code class="language-bash">$ git push -u origin yn-somefeature</code></pre><p>This makes your changes visible in your repository. After that, you can navigate to <a href="https://github.com/LCSB-BioCore/COBREXA.jl/pulls">GitHub&#39;s pull request page</a>, where you should immediately see a big green button that helps you to create a pull request for this branch. Read the section below for precise details and guidelines on submitting the pull requests.</p><h2 id="How-to-submit-a-pull-request-(PR)-with-your-modification/enhancement?"><a class="docs-heading-anchor" href="#How-to-submit-a-pull-request-(PR)-with-your-modification/enhancement?">How to submit a pull request (PR) with your modification/enhancement?</a><a id="How-to-submit-a-pull-request-(PR)-with-your-modification/enhancement?-1"></a><a class="docs-heading-anchor-permalink" href="#How-to-submit-a-pull-request-(PR)-with-your-modification/enhancement?" title="Permalink"></a></h2><ol><li><strong>Make a fork of the repository</strong>, commit the modifications in a <strong>separate branch</strong> and push the branch to your fork.</li><li>Make a pull request where you describe the motivation and expected outcome for the users. Specifically, consider any possible incompatibilities, and the necessity to increment the version number after your changes are applied. Set the target branch to <code>develop</code>.</li><li>After submitting the pull request, verify that all status checks (tests, documentation) are passing. Make sure any new contribution is properly documented and tested (you may want to check with coverage tools, using <code>test --coverage</code> from the Julia packaging shell)</li></ol><p>After you submitted a pull request, a label might be assigned that allows us to track and manage issues and pull requests.</p><h3 id="Code-culture-and-style-recommendations"><a class="docs-heading-anchor" href="#Code-culture-and-style-recommendations">Code culture and style recommendations</a><a id="Code-culture-and-style-recommendations-1"></a><a class="docs-heading-anchor-permalink" href="#Code-culture-and-style-recommendations" title="Permalink"></a></h3><p>Follow basic rules for software maintainability and extensibility:</p><ul><li>Do not reimplement functionality that is available in other packages, unless the reimplementation is either trivial and short, or there is a grave need to do so because the other implementations are deficient in some manner.</li><li>Try to keep the function names and interfaces consistent with ecosystem standards and the other functions in the package. Consistency reduces the amount of surprise on the user side, thus lowers the need to reach for documentation, and in turn makes the software much easier and faster to use.</li><li>Code less. Shorter code is almost always better unless demonstrated otherwise, e.g. with a benchmark. Avoid repetitive boilerplate (there should be ways to generate it, if needed).</li><li>Keep the functionality &quot;open&quot; and composable. In particular, avoid all unnecessarily opaque and leaky abstractions (common in object-oriented programming).</li><li>Avoid producing lots of &quot;informative&quot; text side-output by default, unless that is what the user asked for.</li><li>Adhere to the code formatting rules defined by <a href="https://github.com/domluna/JuliaFormatter.jl">JuliaFormatter</a>. We usually have a bot running that checks all PRs and reports whether the code is properly formatted.</li></ul><p>Follow the common rules for making easily mergable and reviewable PRs:</p><ul><li>Create one PR for each logical &quot;feature&quot; you want to merge. If your change is more complex and contains multiple &quot;stages&quot;, open multiple PRs.</li><li>Keep the test coverage reasonably high.</li><li>If you commit many small, partial changes in a PR, you may help us save energy by prefixing your commit names with <code>[skip ci]</code>, which deactivates the CI trigger on that commit. With each skipped CI, you save a few watt-hours of energy. Testing just the &quot;final&quot; commit of the pull-request branch is sufficient.</li></ul><h2 id="For-developers:-What-is-the-expected-branch-management/workflow?"><a class="docs-heading-anchor" href="#For-developers:-What-is-the-expected-branch-management/workflow?">For developers: What is the expected branch management/workflow?</a><a id="For-developers:-What-is-the-expected-branch-management/workflow?-1"></a><a class="docs-heading-anchor-permalink" href="#For-developers:-What-is-the-expected-branch-management/workflow?" title="Permalink"></a></h2><p>The workflow is based on <a href="https://docs.gitlab.com/ee/topics/gitlab_flow.html">GitLab flow</a>, i.e., a <code>develop</code> branch with <code>feature</code> branches being merged into the <code>develop</code> branch, all periodically merged to <code>master</code> branch. Depending on your access rights, you may open the <code>feature</code> branch in this repository, or in your fork.</p><p>The guidelines can be summarized as such:</p><ul><li>when making a contribution, create one new branch and open one new PR for each new independent feature or bugfix</li><li>do not push to another branch unless it is your own</li><li>try to get a review before merging unless the change is trivial and non-impacting</li><li>consider prefixing your branch names with your initials, so that one can easily see who owns which branch (e.g. <code>ad-somefeature</code> would be committed by Arthur Dent)</li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../functions/utils/">« Utilities</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
$ git fetch origin # fetches the refs from your repo</code></pre><p>In the above code, change <code>yourUsername</code> is your GitHub username.</p><p>When the renaming is done, start a new branch at <code>upstream/master</code>. In the code snippet, substitute <code>yn</code> for your initials (Your Name here) and give the new feature a better name than <code>somefeature</code>:</p><pre><code class="language-bash">$ git checkout -b yn-somefeature origin/master</code></pre><p>Commit any changes and features that you like to the new branch. When the commits look complete to you, push the branch to your repository fork:</p><pre><code class="language-bash">$ git push -u origin yn-somefeature</code></pre><p>This makes your changes visible in your repository. After that, you can navigate to <a href="https://github.com/LCSB-BioCore/COBREXA.jl/pulls">GitHub&#39;s pull request page</a>, where you should immediately see a big green button that helps you to create a pull request for this branch. Read the section below for precise details and guidelines on submitting the pull requests.</p><h2 id="How-to-submit-a-pull-request-(PR)-with-your-modification/enhancement?"><a class="docs-heading-anchor" href="#How-to-submit-a-pull-request-(PR)-with-your-modification/enhancement?">How to submit a pull request (PR) with your modification/enhancement?</a><a id="How-to-submit-a-pull-request-(PR)-with-your-modification/enhancement?-1"></a><a class="docs-heading-anchor-permalink" href="#How-to-submit-a-pull-request-(PR)-with-your-modification/enhancement?" title="Permalink"></a></h2><ol><li><strong>Make a fork of the repository</strong>, commit the modifications in a <strong>separate branch</strong> and push the branch to your fork.</li><li>Make a pull request where you describe the motivation and expected outcome for the users. Specifically, consider any possible incompatibilities, and the necessity to increment the version number after your changes are applied. Set the target branch to <code>develop</code>.</li><li>After submitting the pull request, verify that all status checks (tests, documentation) are passing. Make sure any new contribution is properly documented and tested (you may want to check with coverage tools, using <code>test --coverage</code> from the Julia packaging shell)</li></ol><p>After you submitted a pull request, a label might be assigned that allows us to track and manage issues and pull requests.</p><h3 id="Code-culture-and-style-recommendations"><a class="docs-heading-anchor" href="#Code-culture-and-style-recommendations">Code culture and style recommendations</a><a id="Code-culture-and-style-recommendations-1"></a><a class="docs-heading-anchor-permalink" href="#Code-culture-and-style-recommendations" title="Permalink"></a></h3><p>Follow basic rules for software maintainability and extensibility:</p><ul><li>Do not reimplement functionality that is available in other packages, unless the reimplementation is either trivial and short, or there is a grave need to do so because the other implementations are deficient in some manner.</li><li>Try to keep the function names and interfaces consistent with ecosystem standards and the other functions in the package. Consistency reduces the amount of surprise on the user side, thus lowers the need to reach for documentation, and in turn makes the software much easier and faster to use.</li><li>Code less. Shorter code is almost always better unless demonstrated otherwise, e.g. with a benchmark. Avoid repetitive boilerplate (there should be ways to generate it, if needed).</li><li>Keep the functionality &quot;open&quot; and composable. In particular, avoid all unnecessarily opaque and leaky abstractions (common in object-oriented programming).</li><li>Avoid producing lots of &quot;informative&quot; text side-output by default, unless that is what the user asked for.</li><li>Adhere to the code formatting rules defined by <a href="https://github.com/domluna/JuliaFormatter.jl">JuliaFormatter</a>. We usually have a bot running that checks all PRs and reports whether the code is properly formatted.</li></ul><p>Follow the common rules for making easily mergable and reviewable PRs:</p><ul><li>Create one PR for each logical &quot;feature&quot; you want to merge. If your change is more complex and contains multiple &quot;stages&quot;, open multiple PRs.</li><li>Keep the test coverage reasonably high.</li><li>If you commit many small, partial changes in a PR, you may help us save energy by prefixing your commit names with <code>[skip ci]</code>, which deactivates the CI trigger on that commit. With each skipped CI, you save a few watt-hours of energy. Testing just the &quot;final&quot; commit of the pull-request branch is sufficient.</li></ul><h2 id="For-developers:-What-is-the-expected-branch-management/workflow?"><a class="docs-heading-anchor" href="#For-developers:-What-is-the-expected-branch-management/workflow?">For developers: What is the expected branch management/workflow?</a><a id="For-developers:-What-is-the-expected-branch-management/workflow?-1"></a><a class="docs-heading-anchor-permalink" href="#For-developers:-What-is-the-expected-branch-management/workflow?" title="Permalink"></a></h2><p>The workflow is based on <a href="https://docs.gitlab.com/ee/topics/gitlab_flow.html">GitLab flow</a>, i.e., a <code>develop</code> branch with <code>feature</code> branches being merged into the <code>develop</code> branch, all periodically merged to <code>master</code> branch. Depending on your access rights, you may open the <code>feature</code> branch in this repository, or in your fork.</p><p>The guidelines can be summarized as such:</p><ul><li>when making a contribution, create one new branch and open one new PR for each new independent feature or bugfix</li><li>do not push to another branch unless it is your own</li><li>try to get a review before merging unless the change is trivial and non-impacting</li><li>consider prefixing your branch names with your initials, so that one can easily see who owns which branch (e.g. <code>ad-somefeature</code> would be committed by Arthur Dent)</li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../functions/utils/">« Utilities</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
......@@ -83,4 +83,4 @@ res = screen(m,
&quot;CS&quot; =&gt; 2.44779e-14
&quot;PGM&quot; =&gt; 1.04221e-15
&quot;TKT1&quot; =&gt; 0.864759
⋮ =&gt;</code></pre><h2 id="Basic-and-quick-start-tutorials"><a class="docs-heading-anchor" href="#Basic-and-quick-start-tutorials">Basic and quick-start tutorials</a><a id="Basic-and-quick-start-tutorials-1"></a><a class="docs-heading-anchor-permalink" href="#Basic-and-quick-start-tutorials" title="Permalink"></a></h2><p>Detailed tutorial content is <a href="tutorials/">available here</a>.</p><ul><li><a href="tutorials/1_loading/#Loading-and-converting-model-data">Loading and converting model data</a></li><li><a href="tutorials/2_analysis/#Basic-analysis-of-constraint-based-models">Basic analysis of constraint-based models</a></li><li><a href="tutorials/3_hpc/#Distributed-processing-and-HPC-environments">Distributed processing and HPC environments</a></li><li><a href="tutorials/4_modifying/#Modifying-and-saving-the-models">Modifying and saving the models</a></li></ul><h2 id="Advanced-tutorials"><a class="docs-heading-anchor" href="#Advanced-tutorials">Advanced tutorials</a><a id="Advanced-tutorials-1"></a><a class="docs-heading-anchor-permalink" href="#Advanced-tutorials" title="Permalink"></a></h2><p>Detailed listing of advanced tutorials is <a href="advanced/">available here</a>.</p><ul><li><a href="advanced/1_variants/#Exploring-many-model-variants">Exploring many model variants</a></li><li><a href="advanced/2_custom_model/#Working-with-custom-models">Working with custom models</a></li></ul><h2 id="Example-notebooks-and-workflows"><a class="docs-heading-anchor" href="#Example-notebooks-and-workflows">Example notebooks and workflows</a><a id="Example-notebooks-and-workflows-1"></a><a class="docs-heading-anchor-permalink" href="#Example-notebooks-and-workflows" title="Permalink"></a></h2><p>Detailed notebook content is <a href="notebooks/">available here</a>.</p><ul><li><a href="notebooks/1_loading_converting_saving/#Loading,-converting,-and-saving-models">Loading, converting, and saving models</a></li><li><a href="notebooks/2_finding_balance/#Finding-balance-and-variability-of-constraint-based-models">Finding balance and variability of constraint-based models</a></li><li><a href="notebooks/3_basic_stdmodel_usage/#Basic-usage-of-StandardModel">Basic usage of <code>StandardModel</code></a></li><li><a href="notebooks/4_basic_core_coupled_usage/#Basic-usage-of-CoreModel-and-CoreModelCoupled">Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code></a></li><li><a href="notebooks/5_basic_stdmodel_construction/#Model-construction-and-modification">Model construction and modification</a></li><li><a href="notebooks/6_screening/#Exploring-model-variants-with-screen">Exploring model variants with <code>screen</code></a></li><li><a href="notebooks/7_community_model/#Building-and-analysing-a-small-community-model">Building and analysing a small community model</a></li><li><a href="notebooks/8_custom_model/#Using-a-custom-model-data-structure">Using a custom model data structure</a></li><li><a href="notebooks/9_max_min_driving_force_analysis/#Maximum-minimum-driving-force-analysis">Maximum-minimum driving force analysis</a></li></ul><h2 id="Functions-reference"><a class="docs-heading-anchor" href="#Functions-reference">Functions reference</a><a id="Functions-reference-1"></a><a class="docs-heading-anchor-permalink" href="#Functions-reference" title="Permalink"></a></h2><ul><li><a href="functions/#Types-and-functions">Types and functions</a></li></ul><h2 id="Contribution-guide"><a class="docs-heading-anchor" href="#Contribution-guide">Contribution guide</a><a id="Contribution-guide-1"></a><a class="docs-heading-anchor-permalink" href="#Contribution-guide" title="Permalink"></a></h2><p>If you wish to contribute code, patches or improvements to <code>COBREXA.jl</code>, please read the basic <a href="howToContribute/">contribution guidelines and hints.</a>.</p><h2 id="Acknowledgements"><a class="docs-heading-anchor" href="#Acknowledgements">Acknowledgements</a><a id="Acknowledgements-1"></a><a class="docs-heading-anchor-permalink" href="#Acknowledgements" title="Permalink"></a></h2><p><code>COBREXA.jl</code> is developed at the Luxembourg Centre for Systems Biomedicine of the University of Luxembourg (<a href="https://wwwen.uni.lu/lcsb">uni.lu/lcsb</a>), cooperating with the Institute for Quantitative and Theoretical Biology at the Heinrich Heine University in Düsseldorf (<a href="https://www.qtb.hhu.de/">qtb.hhu.de</a>).</p><p>The development was supported by European Union&#39;s Horizon 2020 Programme under PerMedCoE project (<a href="https://permedcoe.eu/">permedcoe.eu</a>) agreement no. 951773.</p><img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/cobrexa.svg" alt="COBREXA logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/unilu.svg" alt="Uni.lu logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/lcsb.svg" alt="LCSB logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/hhu.svg" alt="HHU logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/qtb.svg" alt="QTB logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/permedcoe.svg" alt="PerMedCoE logo" height="64px" style="height:64px; width:auto"></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="tutorials/">All tutorials »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
⋮ =&gt;</code></pre><h2 id="Basic-and-quick-start-tutorials"><a class="docs-heading-anchor" href="#Basic-and-quick-start-tutorials">Basic and quick-start tutorials</a><a id="Basic-and-quick-start-tutorials-1"></a><a class="docs-heading-anchor-permalink" href="#Basic-and-quick-start-tutorials" title="Permalink"></a></h2><p>Detailed tutorial content is <a href="tutorials/">available here</a>.</p><ul><li><a href="tutorials/1_loading/#Loading-and-converting-model-data">Loading and converting model data</a></li><li><a href="tutorials/2_analysis/#Basic-analysis-of-constraint-based-models">Basic analysis of constraint-based models</a></li><li><a href="tutorials/3_hpc/#Distributed-processing-and-HPC-environments">Distributed processing and HPC environments</a></li><li><a href="tutorials/4_modifying/#Modifying-and-saving-the-models">Modifying and saving the models</a></li></ul><h2 id="Advanced-tutorials"><a class="docs-heading-anchor" href="#Advanced-tutorials">Advanced tutorials</a><a id="Advanced-tutorials-1"></a><a class="docs-heading-anchor-permalink" href="#Advanced-tutorials" title="Permalink"></a></h2><p>Detailed listing of advanced tutorials is <a href="advanced/">available here</a>.</p><ul><li><a href="advanced/1_variants/#Exploring-many-model-variants">Exploring many model variants</a></li><li><a href="advanced/2_custom_model/#Working-with-custom-models">Working with custom models</a></li></ul><h2 id="Example-notebooks-and-workflows"><a class="docs-heading-anchor" href="#Example-notebooks-and-workflows">Example notebooks and workflows</a><a id="Example-notebooks-and-workflows-1"></a><a class="docs-heading-anchor-permalink" href="#Example-notebooks-and-workflows" title="Permalink"></a></h2><p>Detailed notebook content is <a href="notebooks/">available here</a>.</p><ul><li><a href="notebooks/1_loading_converting_saving/#Loading,-converting,-and-saving-models">Loading, converting, and saving models</a></li><li><a href="notebooks/2_finding_balance/#Finding-balance-and-variability-of-constraint-based-models">Finding balance and variability of constraint-based models</a></li><li><a href="notebooks/3_basic_stdmodel_usage/#Basic-usage-of-StandardModel">Basic usage of <code>StandardModel</code></a></li><li><a href="notebooks/4_basic_core_coupled_usage/#Basic-usage-of-CoreModel-and-CoreModelCoupled">Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code></a></li><li><a href="notebooks/5_basic_stdmodel_construction/#Model-construction-and-modification">Model construction and modification</a></li><li><a href="notebooks/6_screening/#Exploring-model-variants-with-screen">Exploring model variants with <code>screen</code></a></li><li><a href="notebooks/7_community_model/#Building-and-analysing-a-small-community-model">Building and analysing a small community model</a></li><li><a href="notebooks/8_custom_model/#Using-a-custom-model-data-structure">Using a custom model data structure</a></li><li><a href="notebooks/9_max_min_driving_force_analysis/#Maximum-minimum-driving-force-analysis">Maximum-minimum driving force analysis</a></li></ul><h2 id="Functions-reference"><a class="docs-heading-anchor" href="#Functions-reference">Functions reference</a><a id="Functions-reference-1"></a><a class="docs-heading-anchor-permalink" href="#Functions-reference" title="Permalink"></a></h2><ul><li><a href="functions/#Types-and-functions">Types and functions</a></li></ul><h2 id="Contribution-guide"><a class="docs-heading-anchor" href="#Contribution-guide">Contribution guide</a><a id="Contribution-guide-1"></a><a class="docs-heading-anchor-permalink" href="#Contribution-guide" title="Permalink"></a></h2><p>If you wish to contribute code, patches or improvements to <code>COBREXA.jl</code>, please read the basic <a href="howToContribute/">contribution guidelines and hints.</a>.</p><h2 id="Acknowledgements"><a class="docs-heading-anchor" href="#Acknowledgements">Acknowledgements</a><a id="Acknowledgements-1"></a><a class="docs-heading-anchor-permalink" href="#Acknowledgements" title="Permalink"></a></h2><p><code>COBREXA.jl</code> is developed at the Luxembourg Centre for Systems Biomedicine of the University of Luxembourg (<a href="https://wwwen.uni.lu/lcsb">uni.lu/lcsb</a>), cooperating with the Institute for Quantitative and Theoretical Biology at the Heinrich Heine University in Düsseldorf (<a href="https://www.qtb.hhu.de/">qtb.hhu.de</a>).</p><p>The development was supported by European Union&#39;s Horizon 2020 Programme under PerMedCoE project (<a href="https://permedcoe.eu/">permedcoe.eu</a>) agreement no. 951773.</p><img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/cobrexa.svg" alt="COBREXA logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/unilu.svg" alt="Uni.lu logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/lcsb.svg" alt="LCSB logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/hhu.svg" alt="HHU logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/qtb.svg" alt="QTB logo" height="64px" style="height:64px; width:auto">   <img src="https://lcsb-biocore.github.io/COBREXA.jl/stable/assets/permedcoe.svg" alt="PerMedCoE logo" height="64px" style="height:64px; width:auto"></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="tutorials/">All tutorials »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
%% Cell type:markdown id: tags:
# Loading, converting, and saving models
%% Cell type:markdown id: tags:
`COBREXA` can load models stored in `.mat`, `.json`, and `.xml` formats (with
the latter denoting SBML formatted models).
%% Cell type:markdown id: tags:
We will primarily use the *E. Coli* "core" model to demonstrate the utilities
found in `COBREXA`. First, let's download the model in several formats.
%% Cell type:code id: tags:
``` julia
# Downloads the model files if they don't already exist
!isfile("e_coli_core.mat") &&
download("http://bigg.ucsd.edu/static/models/e_coli_core.mat", "e_coli_core.mat");
!isfile("e_coli_core.json") &&
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json");
!isfile("e_coli_core.xml") &&
download("http://bigg.ucsd.edu/static/models/e_coli_core.xml", "e_coli_core.xml");
```
%% Cell type:markdown id: tags:
Now, load the package:
%% Cell type:code id: tags:
``` julia
using COBREXA
```
%% Cell type:markdown id: tags:
## Loading models
%% Cell type:markdown id: tags:
Load the models using the `load_model` function. Each model is able to
"pretty-print" itself, hiding the inner complexity.
%% Cell type:code id: tags:
``` julia
mat_model = load_model("e_coli_core.mat")
```
%% Output
Metabolic model of type MATModel\nsparse([9, 51, 55, 64, 65, 34, 44, 59, 66, 64 … 20, 22, 23, 25, 16, 17, 34, 44, 57, 59], [1, 1, 1, 1, 1, 2, 2, 2, 2, 3 … 93, 93, 94, 94, 95, 95, 95, 95, 95, 95], [1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0 … 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0], 72, 95)\nNumber of reactions: 95\nNumber of metabolites: 72\n
%% Cell type:code id: tags:
``` julia
json_model = load_model("e_coli_core.json")
```
%% Output
Metabolic model of type JSONModel\nsparse([9, 51, 55, 64, 65, 34, 44, 59, 66, 64 … 20, 22, 23, 25, 16, 17, 34, 44, 57, 59], [1, 1, 1, 1, 1, 2, 2, 2, 2, 3 … 93, 93, 94, 94, 95, 95, 95, 95, 95, 95], [1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0 … 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0], 72, 95)\nNumber of reactions: 95\nNumber of metabolites: 72\n
%% Cell type:code id: tags:
``` julia
sbml_model = load_model("e_coli_core.xml")
```
%% Output
Metabolic model of type SBMLModel\nsparse([41, 23, 51, 67, 61, 65, 1, 7, 19, 28 … 72, 3, 8, 33, 57, 66, 31, 45, 46, 57], [1, 2, 2, 2, 3, 3, 4, 4, 4, 4 … 93, 94, 94, 94, 94, 94, 95, 95, 95, 95], [-1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0 … 1.0, -1.0, 1.0, -1.0, 1.0, 1.0, 1.0, -1.0, -1.0, 1.0], 72, 95)\nNumber of reactions: 95\nNumber of metabolites: 72\n
%% Cell type:markdown id: tags:
You can directly inspect the model objects, although only with a specific way
for each specific type.
%% Cell type:markdown id: tags:
JSON models contain their corresponding JSON:
%% Cell type:code id: tags:
``` julia
json_model.json
```
%% Output
Dict{String, Any} with 6 entries:\n "metabolites" => Any[Dict{String, Any}("compartment"=>"e", "name"=>"D-Glucos…\n "id" => "e_coli_core"\n "compartments" => Dict{String, Any}("c"=>"cytosol", "e"=>"extracellular space…\n "reactions" => Any[Dict{String, Any}("name"=>"Phosphofructokinase", "metab…\n "version" => "1"\n "genes" => Any[Dict{String, Any}("name"=>"adhE", "id"=>"b1241", "notes…
%% Cell type:markdown id: tags:
SBML models contain a complicated structure from [`SBML.jl`
package](https://github.com/LCSB-BioCore/SBML.jl):
%% Cell type:code id: tags:
``` julia
typeof(sbml_model.sbml)
```
%% Output
SBML.Model
%% Cell type:markdown id: tags:
MAT models contain MATLAB data:
%% Cell type:code id: tags:
``` julia
mat_model.mat
```
%% Output
Dict{String, Any} with 17 entries:\n "description" => "e_coli_core"\n "c" => [0.0; 0.0; … ; 0.0; 0.0;;]\n "rev" => [0; 0; … ; 1; 0;;]\n "mets" => Any["glc__D_e"; "gln__L_c"; … ; "g3p_c"; "g6p_c";;]\n "grRules" => Any["b3916 or b1723"; "((b0902 and b0903) and b2579) or (b09…\n "subSystems" => Any["Glycolysis/Gluconeogenesis"; "Pyruvate Metabolism"; … ;…\n "b" => [0.0; 0.0; … ; 0.0; 0.0;;]\n "metFormulas" => Any["C6H12O6"; "C5H10N2O3"; … ; "C3H5O6P"; "C6H11O9P";;]\n "rxnGeneMat" => sparse([6, 10, 6, 11, 27, 82, 93, 94, 12, 12 … 37, 38, 38,…\n "S" => [0.0 0.0 … 0.0 0.0; 0.0 0.0 … 0.0 0.0; … ; 0.0 0.0 … 0.0 0.0…\n "metNames" => Any["D-Glucose"; "L-Glutamine"; … ; "Glyceraldehyde 3-phosph…\n "lb" => [0.0; 0.0; … ; -1000.0; 0.0;;]\n "metCharge" => [0.0; 0.0; … ; -2.0; -2.0;;]\n "ub" => [1000.0; 1000.0; … ; 1000.0; 1000.0;;]\n "rxnNames" => Any["Phosphofructokinase"; "Pyruvate formate lyase"; … ; "O2…\n "rxns" => Any["PFK"; "PFL"; … ; "O2t"; "PDH";;]\n "genes" => Any["b1241"; "b0351"; … ; "b2935"; "b3919";;]
%% Cell type:markdown id: tags:
## Using the generic interface to access model details
%% Cell type:markdown id: tags:
To prevent the complexities of object representation, `COBREXA.jl` uses a set
of generic interface functions that extract various important information
from all supported model types. This approach ensures that the analysis
functions can work on any data.
%% Cell type:markdown id: tags:
For example, you can check the reactions and metabolites contained in SBML
and JSON models using the same accessor:
%% Cell type:code id: tags:
``` julia
reactions(json_model)
```
%% Output
95-element Vector{String}:\n "PFK"\n "PFL"\n "PGI"\n "PGK"\n "PGL"\n "ACALD"\n "AKGt2r"\n "PGM"\n "PIt2r"\n "ALCD2x"\n\n "MALt2_2"\n "MDH"\n "ME1"\n "ME2"\n "NADH16"\n "NADTRHD"\n "NH4t"\n "O2t"\n "PDH"
%% Cell type:code id: tags:
``` julia
reactions(sbml_model)
```
%% Output
95-element Vector{String}:\n "R_EX_fum_e"\n "R_ACONTb"\n "R_TPI"\n "R_SUCOAS"\n "R_GLNS"\n "R_EX_pi_e"\n "R_PPC"\n "R_O2t"\n "R_G6PDH2r"\n "R_TALA"\n\n "R_THD2"\n "R_EX_h2o_e"\n "R_GLUSy"\n "R_ME1"\n "R_GLUN"\n "R_EX_o2_e"\n "R_FRUpts2"\n "R_ALCD2x"\n "R_PIt2r"
%% Cell type:code id: tags:
``` julia
issetequal(reactions(json_model), reactions(mat_model)) # do models contain the same reactions?
```
%% Output
true
%% Cell type:markdown id: tags:
All accessors are defined in a single file in COBREXA source code; you may
therefore get a list of all accessors as follows:
%% Cell type:code id: tags:
``` julia
using InteractiveUtils
for method in filter(
x -> endswith(string(x.file), "MetabolicModel.jl"),
InteractiveUtils.methodswith(MetabolicModel, COBREXA),
)
println(method.name)
end
```
%% Output
balance
bounds
coupling
coupling_bounds
fluxes
gene_annotations
gene_name
gene_notes
genes
metabolite_annotations
metabolite_charge
metabolite_compartment
metabolite_formula
metabolite_name
metabolite_notes
metabolites
n_coupling_constraints
n_fluxes
n_genes
n_metabolites
n_reactions
objective
precache!
reaction_annotations
reaction_flux
reaction_gene_association
reaction_name
reaction_notes
reaction_stoichiometry
reaction_subsystem
reactions
stoichiometry
%% Cell type:markdown id: tags:
## Converting between model types
%% Cell type:markdown id: tags:
It is possible to convert model types to-and-fro. To do this, use the
`convert` function, which is overloaded from Julia's `Base`.
%% Cell type:code id: tags:
``` julia
m = convert(MATModel, json_model)
```
%% Output
Metabolic model of type MATModel\nsparse([9, 51, 55, 64, 65, 34, 44, 59, 66, 64 … 20, 22, 23, 25, 16, 17, 34, 44, 57, 59], [1, 1, 1, 1, 1, 2, 2, 2, 2, 3 … 93, 93, 94, 94, 95, 95, 95, 95, 95, 95], [1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0 … 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0], 72, 95)\nNumber of reactions: 95\nNumber of metabolites: 72\n
%% Cell type:markdown id: tags:
`m` will now contain the MATLAB-style matrix representation of the model:
%% Cell type:code id: tags:
``` julia
Matrix(m.mat["S"])
```
%% Output
72×95 Matrix{Float64}:\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 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\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 1.0 0.0 0.0 0.0 1.0 1.0 1.0 0.0 0.0 -4.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 3.0 0.0 0.0 0.0 0.0\n ⋮ ⋮ ⋱ ⋮ \n -1.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\n 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\n 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\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 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
%% Cell type:markdown id: tags:
The loading and conversion can be combined using a shortcut:
%% Cell type:code id: tags:
``` julia
m = load_model(MATModel, "e_coli_core.json")
```
%% Output
Metabolic model of type MATModel\nsparse([9, 51, 55, 64, 65, 34, 44, 59, 66, 64 … 20, 22, 23, 25, 16, 17, 34, 44, 57, 59], [1, 1, 1, 1, 1, 2, 2, 2, 2, 3 … 93, 93, 94, 94, 95, 95, 95, 95, 95, 95], [1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0 … 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0], 72, 95)\nNumber of reactions: 95\nNumber of metabolites: 72\n
%% Cell type:markdown id: tags:
## Saving and exporting models
%% Cell type:markdown id: tags:
`COBREXA.jl` supports exporting the models in JSON and MAT format, using `save_model`.
%% Cell type:code id: tags:
``` julia
save_model(m, "converted_model.json")
save_model(m, "converted_model.mat")
```
%% Cell type:markdown id: tags:
If you need a non-standard suffix, use the type-specific saving functions:
%% Cell type:code id: tags:
``` julia
save_json_model(m, "file.without.a.good.suffix")
save_mat_model(m, "another.file.matlab")
```
%% Cell type:markdown id: tags:
If you are saving the models only for future processing in Julia environment,
it is often wasteful to encode the models to external formats and decode them
back. Instead, you can use the "native" Julia data format, accessible with
package `Serialization`.
This way, you can use `serialize` to save even the `StandardModel`
that has no file format associated:
%% Cell type:code id: tags:
``` julia
using Serialization
sm = convert(StandardModel, m)
open(f -> serialize(f, sm), "myModel.stdmodel", "w")
```
%% Cell type:markdown id: tags:
The models can then be loaded back using `deserialize`:
%% Cell type:code id: tags:
``` julia
sm2 = deserialize("myModel.stdmodel")
issetequal(metabolites(sm), metabolites(sm2))
```
%% Output
true
%% Cell type:markdown id: tags:
This form of loading operation is usually pretty quick:
%% Cell type:code id: tags:
``` julia
t = @elapsed deserialize("myModel.stdmodel")
@info "Deserialization took $t seconds"
```
%% Output
┌ Info: Deserialization took 0.002033235 seconds
┌ Info: Deserialization took 0.002080741 seconds
└ @ Main.##275 string:2
%% Cell type:markdown id: tags:
Notably, large and complicated models with thousands of reactions and
annotations can take seconds to decode properly. Serialization allows you to
almost completely remove this overhead, and scales well to tens of millions
of reactions.
%% Cell type:markdown id: tags:
---
*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
......@@ -154,4 +154,4 @@ sm = convert(StandardModel, m)
open(f -&gt; serialize(f, sm), &quot;myModel.stdmodel&quot;, &quot;w&quot;)</code></pre><p>The models can then be loaded back using <code>deserialize</code>:</p><pre><code class="language-julia">sm2 = deserialize(&quot;myModel.stdmodel&quot;)
issetequal(metabolites(sm), metabolites(sm2))</code></pre><pre class="documenter-example-output">true</pre><p>This form of loading operation is usually pretty quick:</p><pre><code class="language-julia">t = @elapsed deserialize(&quot;myModel.stdmodel&quot;)
@info &quot;Deserialization took $t seconds&quot;</code></pre><pre class="documenter-example-output">[ Info: Deserialization took 0.002233536 seconds</pre><p>Notably, large and complicated models with thousands of reactions and annotations can take seconds to decode properly. Serialization allows you to almost completely remove this overhead, and scales well to tens of millions of reactions.</p><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« All notebooks</a><a class="docs-footer-nextpage" href="../2_finding_balance/">Finding balance and variability of constraint-based models »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
@info &quot;Deserialization took $t seconds&quot;</code></pre><pre class="documenter-example-output">[ Info: Deserialization took 0.002083896 seconds</pre><p>Notably, large and complicated models with thousands of reactions and annotations can take seconds to decode properly. Serialization allows you to almost completely remove this overhead, and scales well to tens of millions of reactions.</p><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« All notebooks</a><a class="docs-footer-nextpage" href="../2_finding_balance/">Finding balance and variability of constraint-based models »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
This diff is collapsed.
%% Cell type:markdown id: tags:
# Basic usage of `StandardModel`
%% Cell type:markdown id: tags:
In this tutorial we will use `COBREXA`'s `StandardModel` and functions that
specifically operate on it. As usual we will use the toy model of *E. coli*
for demonstration.
%% Cell type:code id: tags:
``` julia
!isfile("e_coli_core.json") &&
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json")
using COBREXA
```
%% Cell type:markdown id: tags:
## Loading a model
%% Cell type:code id: tags:
``` julia
model = load_model(StandardModel, "e_coli_core.json") # we specifically want to load a StandardModel from the model file
```
%% Output
Metabolic model of type StandardModel\nsparse([9, 51, 55, 64, 65, 34, 44, 59, 66, 64 … 20, 22, 23, 25, 16, 17, 34, 44, 57, 59], [1, 1, 1, 1, 1, 2, 2, 2, 2, 3 … 93, 93, 94, 94, 95, 95, 95, 95, 95, 95], [1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0 … 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0], 72, 95)\nNumber of reactions: 95\nNumber of metabolites: 72\n
%% Cell type:markdown id: tags:
When using `load_model(StandardModel, file_location)` the model at
`file_location` is first loaded into its inferred format and is then
converted to a `StandardModel` using the generic accessor interface.
Thus, data loss may occur. Always check your model to ensure that
nothing important has been lost.
%% Cell type:markdown id: tags:
## Basic analysis
%% Cell type:markdown id: tags:
As before, for optimization based analysis we need to load an optimizer. Here we
will use [`Tulip.jl`](https://github.com/ds4dm/Tulip.jl) to solve the linear
programs of this tutorial. Refer to the basic constraint-based analysis
tutorial for more informaiton.
%% Cell type:markdown id: tags:
All the normal analysis functions work on `StandardModel`, due to it also
having the same generic accessor interface as all the other model types.
%% Cell type:code id: tags:
``` julia
using Tulip
fluxes = flux_balance_analysis_dict(
model,
Tulip.Optimizer;
modifications = [
change_objective("BIOMASS_Ecoli_core_w_GAM"),
change_constraint("EX_glc__D_e"; lb = -12, ub = -12),
change_constraint("EX_o2_e"; lb = 0, ub = 0),
],
)
```
%% Output
Dict{String, Float64} with 95 entries:\n "ACALD" => -9.78427\n "PTAr" => 10.0729\n "ALCD2x" => -9.78427\n "PDH" => 1.98381e-9\n "PYK" => 9.94501\n "CO2t" => 0.487021\n "EX_nh4_e" => -1.48633\n "MALt2_2" => 0.0\n "CS" => 0.294088\n "PGM" => -22.8676\n "TKT1" => -0.0487648\n "EX_mal__L_e" => 0.0\n "ACONTa" => 0.294088\n "EX_pi_e" => -1.00274\n "GLNS" => 0.069699\n "ICL" => 5.34932e-11\n "EX_o2_e" => 0.0\n "FBA" => 11.7289\n "EX_gln__L_e" => 0.0\n ⋮ => ⋮
%% Cell type:markdown id: tags:
This is not very exciting yet, since every other model type can also do this.
However, deeper inspection of flux results is possible when using
`StandardModel`.
%% Cell type:markdown id: tags:
## Inspecting the flux solution: `atom_fluxes`
%% Cell type:markdown id: tags:
It is sometimes interesting to keep track of the atoms entering and leaving
the system through boundary reactions. This can be inspected by calling
`atom_fluxes`. That gives you the flux of individual atoms getting
consumed and produced by all reactions, based on `fluxes`. We erase the
reaction that consumes the atoms for creating biomass, to see how much mass
the "rest" of the reaction produces for it:
%% Cell type:code id: tags:
``` julia
fluxes_without_biomass = copy(fluxes);
delete!(fluxes_without_biomass, "BIOMASS_Ecoli_core_w_GAM");
atom_fluxes(model, fluxes_without_biomass)
```
%% Output
Dict{String, Float64} with 6 entries:\n "S" => 0.0\n "C" => 11.5998\n "N" => 1.48633\n "P" => 1.00274\n "H" => 20.7086\n "O" => 12.995
%% Cell type:markdown id: tags:
## Inspecting the flux solution: `metabolite_fluxes`
%% Cell type:markdown id: tags:
Another useful flux result analysis function is `metabolite_fluxes`.
This function gives an overview of reactions consuming and producing each
metabolite.
%% Cell type:code id: tags:
``` julia
consuming, producing = metabolite_fluxes(model, fluxes)
consuming["atp_c"] # reactions consuming `atp_c`
```
%% Output
Dict{String, Float64} with 8 entries:\n "PFK" => -11.7289\n "BIOMASS_Ecoli_core_w_GAM" => -16.3031\n "GLNS" => -0.069699\n "ATPM" => -8.39\n "ADK1" => -1.66663e-10\n "PPCK" => -5.66231e-11\n "PPS" => -1.66662e-10\n "ATPS4r" => -6.80168
%% Cell type:markdown id: tags:
## Internals of `StandardModel`
%% Cell type:markdown id: tags:
Another benefit of `StandardModel` is that it supports a richer internal
infrastructure that can be used to manipulate internal model attributes in a
systematic way. Specifically, the genes, reactions, and metabolites with of a
model each have a type. This is particularly useful when modifying or even
constructing a model from scratch.
%% Cell type:markdown id: tags:
## `Gene`s, `Reaction`s, and `Metabolite`s
%% Cell type:markdown id: tags:
`StandardModel` is composed of ordered dictionaries of `Gene`s, `Metabolite`s
and `Reaction`s. Ordered dictionaries are used because the order of the
reactions and metabolites are important for constructing a stoichiometric
matrix since the rows and columns should correspond to the order of the metabolites
and reactions returned by calling the accessors `metabolites` and `reactions`.
%% Cell type:markdown id: tags:
Each `StandardModel` is composed of the following fields:
%% Cell type:code id: tags:
``` julia
fieldnames(StandardModel) # fields of a StandardModel
```
%% Output
(:id, :reactions, :metabolites, :genes)
%% Cell type:markdown id: tags:
The `:genes` field of a `StandardModel` contains an ordered dictionary of gene ids mapped to `Gene`s.
%% Cell type:code id: tags:
``` julia
model.genes # the keys of this dictionary are the same as genes(model)
```
%% Output
OrderedCollections.OrderedDict{String, Gene} with 137 entries:\n "b1241" => Gene("b1241", "adhE", Dict("original_bigg_ids"=>["b1241"]), Dict("…\n "b0351" => Gene("b0351", "mhpF", Dict("original_bigg_ids"=>["b0351"]), Dict("…\n "s0001" => Gene("s0001", "", Dict("original_bigg_ids"=>["s0001"]), Dict("sbo"…\n "b1849" => Gene("b1849", "purT", Dict("original_bigg_ids"=>["b1849"]), Dict("…\n "b3115" => Gene("b3115", "tdcD", Dict("original_bigg_ids"=>["b3115"]), Dict("…\n "b2296" => Gene("b2296", "ackA", Dict("original_bigg_ids"=>["b2296"]), Dict("…\n "b1276" => Gene("b1276", "acnA", Dict("original_bigg_ids"=>["b1276"]), Dict("…\n "b0118" => Gene("b0118", "acnB", Dict("original_bigg_ids"=>["b0118"]), Dict("…\n "b0474" => Gene("b0474", "adk", Dict("original_bigg_ids"=>["b0474"]), Dict("s…\n "b0116" => Gene("b0116", "lpd", Dict("original_bigg_ids"=>["b0116"]), Dict("s…\n "b0727" => Gene("b0727", "sucB", Dict("original_bigg_ids"=>["b0727"]), Dict("…\n "b0726" => Gene("b0726", "sucA", Dict("original_bigg_ids"=>["b0726"]), Dict("…\n "b2587" => Gene("b2587", "kgtP", Dict("original_bigg_ids"=>["b2587"]), Dict("…\n "b0356" => Gene("b0356", "frmA", Dict("original_bigg_ids"=>["b0356"]), Dict("…\n "b1478" => Gene("b1478", "adhP", Dict("original_bigg_ids"=>["b1478"]), Dict("…\n "b3734" => Gene("b3734", "atpA", Dict("original_bigg_ids"=>["b3734"]), Dict("…\n "b3733" => Gene("b3733", "atpG", Dict("original_bigg_ids"=>["b3733"]), Dict("…\n "b3736" => Gene("b3736", "atpF", Dict("original_bigg_ids"=>["b3736"]), Dict("…\n "b3737" => Gene("b3737", "atpE", Dict("original_bigg_ids"=>["b3737"]), Dict("…\n ⋮ => ⋮
%% Cell type:markdown id: tags:
The `Gene` type is a struct that can be used to store information about genes
in a `StandardModel`. Each `Gene` is composed of the following fields:
%% Cell type:code id: tags:
``` julia
fieldnames(Gene)
```
%% Output
(:id, :name, :notes, :annotations)
%% Cell type:markdown id: tags:
Use <tab> to quickly explore the fields of a struct. For example,
Gene.<tab> will list all the fields shown above.
%% Cell type:markdown id: tags:
The keys used in the ordered dictionaries in
`model.genes` are the ids returned using the generic accessor `genes`. `Gene`s
have pretty printing, as demonstrated below for a random gene drawn from the
model:
%% Cell type:code id: tags:
``` julia
random_gene_id = genes(model)[rand(1:n_genes(model))]
model.genes[random_gene_id]
```
%% Output
Gene.id: b2417\nGene.name: crr\nGene.notes: \n original_bigg_ids: ["b2417"]\nGene.annotations: \n sbo: ["SBO:0000243"]\n uniprot: ["P69783"]\n ecogene: ["EG10165"]\n ncbigene: ["946880"]\n ncbigi: ["16130343"]\n refseq_locus_tag: ["b2417"]\n refseq_name: ["crr"]\n asap: ["ABE-0007971"]\n refseq_synonym: gsr, ..., iex\n
Gene.id: b3612\nGene.name: gpmM\nGene.notes: \n original_bigg_ids: ["b3612"]\nGene.annotations: \n sbo: ["SBO:0000243"]\n uniprot: ["P37689"]\n ecogene: ["EG12296"]\n ncbigene: ["948130"]\n ncbigi: ["16131483"]\n refseq_locus_tag: ["b3612"]\n refseq_name: ["gpmM"]\n asap: ["ABE-0011818"]\n refseq_synonym: JW3587, ..., gpmI\n
%% Cell type:markdown id: tags:
The same idea holds for both metabolites (stored as `Metabolite`s) and
reactions (stored as `Reaction`s). This is demonstrated below.
%% Cell type:code id: tags:
``` julia
random_metabolite_id = metabolites(model)[rand(1:n_metabolites(model))]
model.metabolites[random_metabolite_id]
```
%% Output
Metabolite.id: dhap_c\nMetabolite.name: Dihydroxyacetone phosphate\nMetabolite.formula: C3P1H5O6\nMetabolite.charge: -2\nMetabolite.compartment: c\nMetabolite.notes: \n original_bigg_ids: ["dhap_c"]\nMetabolite.annotations: \n sabiork: ["28"]\n kegg.compound: ["C00111"]\n sbo: ["SBO:0000247"]\n biocyc: META:DIHYDROXY-ACETO...\n chebi: CHEBI:14341, ..., CHEBI:57642\n metanetx.chemical: ["MNXM77"]\n inchi_key: GNGACRATGGDKBX-UHFFF...\n hmdb: ["HMDB11735", "HMDB01473"]\n bigg.metabolite: ["dhap"]\n seed.compound: ["cpd00095"]\n reactome.compound: 390404, ..., 188451\n
Metabolite.id: etoh_e\nMetabolite.name: Ethanol\nMetabolite.formula: C2H6O1\nMetabolite.charge: 0\nMetabolite.compartment: e\nMetabolite.notes: \n original_bigg_ids: ["etoh_e"]\nMetabolite.annotations: \n envipath: 5882df9c-dae1-4d80-a...\n kegg.drug: D06542, ..., D04855\n kegg.compound: ["C00469"]\n sbo: ["SBO:0000247"]\n sabiork: ["56"]\n biocyc: ["META:ETOH"]\n chebi: CHEBI:42377, ..., CHEBI:14222\n metanetx.chemical: ["MNXM303"]\n inchi_key: LFQSCWFLJHTTHZ-UHFFF...\n hmdb: ["HMDB00108"]\n bigg.metabolite: ["etoh"]\n seed.compound: ["cpd00363"]\n reactome.compound: ["113748", "30203"]\n
%% Cell type:code id: tags:
``` julia
random_reaction_id = reactions(model)[rand(1:n_reactions(model))]
model.reactions[random_reaction_id]
```
%% Output
Reaction.id: RPE\nReaction.name: Ribulose 5-phosphate 3-epimerase\nReaction.metabolites: 1.0 ru5p__D_c ↔ 1.0 xu5p__D_c\nReaction.lb: -1000.0\nReaction.ub: 1000.0\nReaction.grr: (b3386) or (b4301)\nReaction.subsystem: Pentose Phosphate Pathway\nReaction.notes: \n original_bigg_ids: ["RPE"]\nReaction.annotations: \n bigg.reaction: ["RPE"]\n sabiork: ["62"]\n metanetx.reaction: ["MNXR104083"]\n rhea: 13677, ..., 13679\n sbo: ["SBO:0000176"]\n seed.reaction: ["rxn01116"]\n kegg.reaction: ["R01529"]\n biocyc: ["META:RIBULP3EPIM-RXN"]\n reactome.reaction: R-SPO-71303, ..., R-BTA-199803\n ec-code: ["5.1.3.1"]\nReaction.objective_coefficient: 0.0\n
Reaction.id: GLNS\nReaction.name: Glutamine synthetase\nReaction.metabolites: 1.0 glu__L_c + 1.0 atp_c + 1.0 nh4_c → 1.0 adp_c + 1.0 gln__L_c + 1.0 pi_c + 1.0 h_c\nReaction.lb: 0.0\nReaction.ub: 1000.0\nReaction.grr: (b3870) or (b1297)\nReaction.subsystem: Glutamate Metabolism\nReaction.notes: \n original_bigg_ids: ["GLNS"]\nReaction.annotations: \n bigg.reaction: ["GLNS"]\n sabiork: ["760"]\n metanetx.reaction: ["MNXR100024"]\n rhea: 16172, ..., 16170\n sbo: ["SBO:0000176"]\n seed.reaction: ["rxn00187"]\n kegg.reaction: ["R00253"]\n biocyc: META:GLUTAMINESYN-RX...\n reactome.reaction: R-GGA-70606, ..., R-SCE-70606\n ec-code: ["6.3.1.2"]\nReaction.objective_coefficient: 0.0\n
%% Cell type:markdown id: tags:
`StandardModel` can be used to build your own metabolic model or modify an
existing one. One of the main use cases for `StandardModel` is that it can be
used to merge multiple models or parts of multiple models together. Since the
internals are uniform inside each `StandardModel`, attributes of other model
types are squashed into the required format (using the generic accessors).
This ensures that the internals of all `StandardModel`s are the same -
allowing easy systematic evaluation.
%% Cell type:markdown id: tags:
## Checking the internals of `StandardModel`s: `annotation_index`
%% Cell type:markdown id: tags:
Often when models are automatically reconstructed duplicate genes, reactions
or metabolites end up in a model. `COBREXA` exports `annotation_index` to
check for cases where the id of a struct may be different, but the annotations
the same (possibly suggesting a duplication). `annotation_index` builds a
dictionary mapping annotation features to the ids of whatever struct you are
inspecting. This makes it easy to find structs that share certain annotation features.
%% Cell type:code id: tags:
``` julia
rxn_annotations = annotation_index(model.reactions)
```
%% Output
Dict{String, Dict{String, Set{String}}} with 10 entries:\n "ec-code" => Dict("3.6.3.37"=>Set(["ATPM"]), "3.6.3.42"=>Set(["ATPM…\n "sabiork" => Dict("109"=>Set(["PGL"]), "762"=>Set(["GLUN"]), "155"=…\n "metanetx.reaction" => Dict("MNXR104869"=>Set(["TKT2"]), "MNXR99715"=>Set(["E…\n "rhea" => Dict("27626"=>Set(["TKT2"]), "10229"=>Set(["ACONTa"]),…\n "sbo" => Dict("SBO:0000627"=>Set(["EX_for_e", "EX_nh4_e", "EX_p…\n "seed.reaction" => Dict("rxn05297"=>Set(["GLUt2r"]), "rxn09717"=>Set(["PY…\n "kegg.reaction" => Dict("R00114"=>Set(["GLUSy"]), "R00199"=>Set(["PPS"]),…\n "biocyc" => Dict("META:TRANS-RXN-121B"=>Set(["FUMt2_2"]), "META:PE…\n "reactome.reaction" => Dict("R-TGU-71397"=>Set(["PDH"]), "R-XTR-70449"=>Set([…\n "bigg.reaction" => Dict("ACALD"=>Set(["ACALD"]), "PTAr"=>Set(["PTAr"]), "…
%% Cell type:code id: tags:
``` julia
rxn_annotations["ec-code"]
```
%% Output
Dict{String, Set{String}} with 141 entries:\n "3.6.3.37" => Set(["ATPM"])\n "3.6.3.42" => Set(["ATPM"])\n "3.6.3.38" => Set(["ATPM"])\n "3.6.3.19" => Set(["ATPM"])\n "2.3.3.1" => Set(["CS"])\n "1.6.1.2" => Set(["NADTRHD"])\n "3.6.3.35" => Set(["ATPM"])\n "6.2.1.5" => Set(["SUCOAS"])\n "6.3.5.4" => Set(["GLUN"])\n "3.6.3.49" => Set(["ATPM"])\n "3.6.3.51" => Set(["ATPM"])\n "1.2.1.12" => Set(["GAPD"])\n "3.6.3.32" => Set(["ATPM"])\n "2.3.3.3" => Set(["CS"])\n "2.7.4.3" => Set(["ADK1"])\n "6.3.5.5" => Set(["GLUN"])\n "3.5.1.2" => Set(["GLUN"])\n "1.1.1.49" => Set(["G6PDH2r"])\n "5.3.1.9" => Set(["PGI"])\n ⋮ => ⋮
%% Cell type:markdown id: tags:
The `annotation_index` function can also be used on `Reaction`s and
`Gene`s in the same way.
%% Cell type:markdown id: tags:
## Checking the internals of `StandardModel`s: `check_duplicate_reaction`
%% Cell type:markdown id: tags:
Another useful function is `check_duplicate_reaction`, which checks for
reactions that have duplicate (or similar) reaction equations.
%% Cell type:code id: tags:
``` julia
pgm_duplicate = Reaction()
pgm_duplicate.id = "pgm2" # Phosphoglycerate mutase
pgm_duplicate.metabolites = Dict{String,Float64}("3pg_c" => 1, "2pg_c" => -1)
pgm_duplicate
```
%% Output
Reaction.id: pgm2\nReaction.name: ---\nReaction.metabolites: 1.0 2pg_c ↔ 1.0 3pg_c\nReaction.lb: -1000.0\nReaction.ub: 1000.0\nReaction.grr: ---\nReaction.subsystem: ---\nReaction.notes: ---\nReaction.annotations: ---\nReaction.objective_coefficient: 0.0\n
%% Cell type:code id: tags:
``` julia
check_duplicate_reaction(pgm_duplicate, model.reactions; only_metabolites = false) # can also just check if only the metabolites are the same but different stoichiometry is used
```
%% Output
"PGM"
%% Cell type:markdown id: tags:
## Checking the internals of `StandardModel`s: `reaction_mass_balanced`
%% Cell type:markdown id: tags:
Finally, `reaction_mass_balanced` can be used to check if a reaction is mass
balanced based on the formulas of the reaction equation.
%% Cell type:code id: tags:
``` julia
rxn_dict = Dict{String,Float64}("3pg_c" => 1, "2pg_c" => -1, "h2o_c" => 1)
reaction_mass_balanced(model, rxn_dict)
```
%% Output
false
%% Cell type:markdown id: tags:
Now to determine which atoms are unbalanced, you can use `reaction_atom_balance`
%% Cell type:code id: tags:
``` julia
reaction_atom_balance(model, rxn_dict)
```
%% Output
Dict{String, Float64} with 4 entries:\n "C" => 0.0\n "P" => 0.0\n "H" => 2.0\n "O" => 1.0
%% Cell type:markdown id: tags:
Note, since `pgm_duplicate` is not in the model, we cannot use the other variants of this
function because they find the reaction equation stored inside the `model`.
%% Cell type:markdown id: tags:
---
*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
......@@ -176,4 +176,4 @@ reaction_mass_balanced(model, rxn_dict)</code></pre><pre class="documenter-examp
&quot;C&quot; =&gt; 0.0
&quot;P&quot; =&gt; 0.0
&quot;H&quot; =&gt; 2.0
&quot;O&quot; =&gt; 1.0</pre><p>Note, since <code>pgm_duplicate</code> is not in the model, we cannot use the other variants of this function because they find the reaction equation stored inside the <code>model</code>.</p><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../2_finding_balance/">« Finding balance and variability of constraint-based models</a><a class="docs-footer-nextpage" href="../4_basic_core_coupled_usage/">Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code> »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
&quot;O&quot; =&gt; 1.0</pre><p>Note, since <code>pgm_duplicate</code> is not in the model, we cannot use the other variants of this function because they find the reaction equation stored inside the <code>model</code>.</p><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../2_finding_balance/">« Finding balance and variability of constraint-based models</a><a class="docs-footer-nextpage" href="../4_basic_core_coupled_usage/">Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code> »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
......@@ -75,4 +75,4 @@ Number of reactions: 95
Number of metabolites: 72
</pre><pre><code class="language-julia">d = flux_balance_analysis_dict(model, Tulip.Optimizer)
d[&quot;R_BIOMASS_Ecoli_core_w_GAM&quot;]</code></pre><pre class="documenter-example-output">0.8739215022661532</pre><pre><code class="language-julia">dc = flux_balance_analysis_dict(cmodel, Tulip.Optimizer)
dc[&quot;R_BIOMASS_Ecoli_core_w_GAM&quot;]</code></pre><pre class="documenter-example-output">0.6655856992982556</pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../3_basic_stdmodel_usage/">« Basic usage of <code>StandardModel</code></a><a class="docs-footer-nextpage" href="../5_basic_stdmodel_construction/">Model construction and modification »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
dc[&quot;R_BIOMASS_Ecoli_core_w_GAM&quot;]</code></pre><pre class="documenter-example-output">0.6655856992982556</pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../3_basic_stdmodel_usage/">« Basic usage of <code>StandardModel</code></a><a class="docs-footer-nextpage" href="../5_basic_stdmodel_construction/">Model construction and modification »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
......@@ -49,4 +49,4 @@ model</code></pre><pre class="documenter-example-output">Metabolic model of type
sparse([1, 2, 1, 2, 2, 3, 1, 2, 4, 3, 4, 2, 4], [1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8], [-1.0, 1.0, 1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0], 4, 8)
Number of reactions: 8
Number of metabolites: 4
</pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../4_basic_core_coupled_usage/">« Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code></a><a class="docs-footer-nextpage" href="../6_screening/">Exploring model variants with <code>screen</code> »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 12:46">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
</pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../4_basic_core_coupled_usage/">« Basic usage of <code>CoreModel</code> and <code>CoreModelCoupled</code></a><a class="docs-footer-nextpage" href="../6_screening/">Exploring model variants with <code>screen</code> »</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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Monday 16 May 2022 13:40">Monday 16 May 2022</span>. Using Julia version 1.7.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
%% Cell type:markdown id: tags:
# Exploring model variants with `screen`
%% Cell type:markdown id: tags:
This notebooks demonstrates a simple use of `screen` to explore large
number of model variants. On the toy *E. Coli* model, we try to map the
impact of knocking out single reactions and 2-reaction combinations.
%% Cell type:markdown id: tags:
First, let's download the data and load the packages and the model
%% Cell type:code id: tags:
``` julia
!isfile("e_coli_core.json") &&
download("http://bigg.ucsd.edu/static/models/e_coli_core.json", "e_coli_core.json");
using COBREXA, Tulip
model = load_model(StandardModel, "e_coli_core.json")
```
%% Output
Metabolic model of type StandardModel\nsparse([9, 51, 55, 64, 65, 34, 44, 59, 66, 64 … 20, 22, 23, 25, 16, 17, 34, 44, 57, 59], [1, 1, 1, 1, 1, 2, 2, 2, 2, 3 … 93, 93, 94, 94, 95, 95, 95, 95, 95, 95], [1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0 … 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0], 72, 95)\nNumber of reactions: 95\nNumber of metabolites: 72\n
%% Cell type:markdown id: tags:
## Preparing the functions
While we could use the `with_changed_bound` to limit the reaction rates,
but we will make a slightly more precise, usage-tailored modification. This
is a straightforward modification of the `with_changed_bound` that does
not set bounds "outside" of the original bounds:
%% Cell type:code id: tags:
``` julia
with_limited_rate(reaction_id::String, limit) =
model::StandardModel -> begin
m = copy(model)
m.reactions = copy(model.reactions)
r = m.reactions[reaction_id] = copy(model.reactions[reaction_id])
if -limit > r.lb
r.lb = -limit
end
if limit < r.ub
r.ub = limit
end
m
end
```
%% Output
with_limited_rate (generic function with 1 method)
%% Cell type:markdown id: tags:
## Knocking out single reactions
This can be applied to see how much biomass can the model produce with
certain reactions limited to almost zero:
%% Cell type:code id: tags:
``` julia
get_biomass(x) = isnothing(x) ? 0 : x["BIOMASS_Ecoli_core_w_GAM"]
productions = screen_variants(
model,
[[with_limited_rate(rxn, 0.1)] for rxn in reactions(model)],
model -> get_biomass(flux_balance_analysis_dict(model, Tulip.Optimizer)),
)
```
%% Output
95-element Vector{Real}:\n 0.7110773172306842\n 0.8739215069620168\n 0.8633809523181394\n 0.007974352115966855\n 0.8640171040038155\n 0.8739215063456838\n 0.87392150695555\n 0.009054524481803774\n 0.027183515911490083\n 0.8739215069217056\n\n 0.8739215022678488\n 0.8270283079105472\n 0.8739215065011818\n 0.8739215045533565\n 0.21346280281143498\n 0.8739215053667706\n 0.018339201041498398\n 0.21526265974680325\n 0.7975549891965423
%% Cell type:markdown id: tags:
This can be nicely plotted to give a more comprehensive overview of which
reactions are critical or not:
%% Cell type:code id: tags:
``` julia
using CairoMakie
disp_rxns = rand(1:95, 20) # only display 20 random fluxes to save space
barplot(
productions[disp_rxns],
direction = :x,
axis = (
yticks = (1:20, reactions(model)[disp_rxns]),
xlabel = "Flux [mmol/gDW/h]",
ylabel = "Reaction ID",
),
)
```
%% Output
FigureAxisPlot()
%% Cell type:markdown id: tags:
## Knocking out reaction combinations
It is very easy to prepare matrices of biomass productions from all possible
two-reaction knockouts. To make it more interesting, we will restrict one of
the reactions of the pair a bit less, to see more possible outcomes.
%% Cell type:markdown id: tags:
We do not process all reactions here to make the notebook rendering
efficient, but you can easily remove the restriction, and speed the process
up using parallel execution, by specifying `workers` argument (see
documentation of `screen` for details)
%% Cell type:code id: tags:
``` julia
rxns = reactions(model)
productions = screen_variants(
model,
[
[with_limited_rate(rxn1, 3), with_limited_rate(rxn2, 0.1)] for rxn1 in rxns,
rxn2 in rxns
],
model -> get_biomass(flux_balance_analysis_dict(model, Tulip.Optimizer)),
)
f = Figure()
ax = Axis(
f[1, 1],
ylabel = "Reaction KO",
xlabel = "Reaction KO",
yticks = (1:20, reactions(model)[disp_rxns]),
xticks = (1:20, reactions(model)[disp_rxns]),
xticklabelrotation = -pi / 4,
)
hm = heatmap!(ax, productions[disp_rxns, disp_rxns])
Colorbar(f[1, 2], hm, label = "Flux [mmol/gDW/h]")
f
```
%% Output
Figure()
%% Cell type:markdown id: tags:
---
*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment