Skip to content

Commit

Permalink
build based on 5173c55
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Sep 10, 2024
1 parent 780fc77 commit eddfa4a
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 107 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-10T22:51:53","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-10T22:55:57","documenter_version":"1.7.0"}}
14 changes: 7 additions & 7 deletions dev/SPRFitting_api/index.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dev/fitting/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

# create a new environment for the surrogate constructions
Pkg.activate("fitting_env")
Pkg.add(url=&quot;https://github.com/isaacsas/SPRFittingPaper2023.jl.git&quot;)</code></pre><h2 id="Estimating-Best-Fit-Parameters-to-an-SPR-Dataset"><a class="docs-heading-anchor" href="#Estimating-Best-Fit-Parameters-to-an-SPR-Dataset">Estimating Best Fit Parameters to an SPR Dataset</a><a id="Estimating-Best-Fit-Parameters-to-an-SPR-Dataset-1"></a><a class="docs-heading-anchor-permalink" href="#Estimating-Best-Fit-Parameters-to-an-SPR-Dataset" title="Permalink"></a></h2><p>We wil work with the same SPR dataset as in the <a href="../forward_simulation/#Forward-Model-Simulation">Forward Model Simulation</a> tutorial. As described in [1], our general approach will be to use the XNES optimizer from BlackBoxOptim.jl to minimize the difference between the SPR data and the surrogate&#39;s predicted SPR traces. XNES is a stochastic natural evolution optimizer that we have found often gives the best fits among many optimizer choices. We use this optimizer via Optimization.jl, which allows for the easy selection of different optimizer choices. As XNES is stochastic, we will run the parameter estimation process <code>nfits</code> times, and select parameters from the run with the minimal loss as our final estimates. </p><p>We&#39;ll use the full surrogate from [1], which can be downloaded <a href="https://doi.org/10.6084/m9.figshare.26936854">here</a>.</p><p>We being by defining some variables related to the fitting process:</p><pre><code class="language-julia hljs">nfits = 100 # how many fits to run and then take the minimum over
Pkg.add(url=&quot;https://github.com/isaacsas/SPRFittingPaper2023.jl.git&quot;)</code></pre><h2 id="Estimating-Best-Fit-Parameters-to-an-SPR-Dataset"><a class="docs-heading-anchor" href="#Estimating-Best-Fit-Parameters-to-an-SPR-Dataset">Estimating Best Fit Parameters to an SPR Dataset</a><a id="Estimating-Best-Fit-Parameters-to-an-SPR-Dataset-1"></a><a class="docs-heading-anchor-permalink" href="#Estimating-Best-Fit-Parameters-to-an-SPR-Dataset" title="Permalink"></a></h2><p>We wil work with the same SPR dataset as in the <a href="../forward_simulation/#Forward-Model-Simulation">Forward Model Simulation</a> tutorial. As described in [1], our general approach will be to use the XNES optimizer from BlackBoxOptim.jl to minimize the difference between the SPR data and the surrogate&#39;s predicted SPR traces. XNES is a stochastic natural evolution optimizer that we have found often gives the best fits among many optimizer choices. We use this optimizer via Optimization.jl, which allows for the easy selection of different optimizer choices. As XNES is stochastic, we will run the parameter estimation process <code>nfits</code> times, and select parameters from the run with the minimal loss as our final estimates. </p><p>We&#39;ll use the full surrogate from [1], which can be downloaded <a href="https://doi.org/10.6084/m9.figshare.26936854">here</a>.</p><p>We begin by defining some variables related to the fitting process:</p><pre><code class="language-julia hljs">nfits = 100 # how many fits to run and then take the minimum over
nsims = 250 # number of simulations to average when plotting
logCP_optrange = (1.0, 5.0) # allowable log-space range of CP values </code></pre><p>Next we set the location of the surrogate:</p><pre><code class="language-julia hljs">surfile = &quot;PATH_TO_DOWNLOADED_SURROGATE.jld&quot;</code></pre><p>We are now load the surrogate and SPR data:</p><pre><code class="language-julia hljs"># load the surrogate
logCP_optrange = (1.0, 5.0) # allowable log-space range of CP values </code></pre><p>Next we set the location of the surrogate:</p><pre><code class="language-julia hljs">surfile = &quot;PATH_TO_DOWNLOADED_SURROGATE.jld&quot;</code></pre><p>We now load the surrogate and SPR data:</p><pre><code class="language-julia hljs"># load the surrogate
surrogate = Surrogate(surfile)
sps = surrogate.surpars

Expand All @@ -28,5 +28,5 @@
# save a figure showing the fit to the SPR data
OUTDIR = tempdir()
figfile = joinpath(OUTDIR, &quot;fit_curves.png&quot;)
visualisefit(optsol, aligneddat, surrogate, simpars, figfile)</code></pre><p>Which gives</p><p><img src="../fitting_data/fit_curves.png" alt="spr_fit"/></p><p>Here the SPR data is shown in black and the average predicted responses in color. Finally, we can save a spreadsheet with our fits and parameter estimates via</p><pre><code class="language-julia hljs">curvefile = joinpath(OUTDIR, &quot;parameters.xlsx&quot;)
savefit(optsol, aligneddat, surrogate, simpars, curvefile)</code></pre><p>For this example the file <a href="../fitting_data/parameters.xlsx_fit.xlsx">here</a> shows the resulting Excel spreadsheet. Note that the second sheet within it shows the parameter estimates.</p><h2 id="General-Workflow"><a class="docs-heading-anchor" href="#General-Workflow">General Workflow</a><a id="General-Workflow-1"></a><a class="docs-heading-anchor-permalink" href="#General-Workflow" title="Permalink"></a></h2><p>A more detailed workflow that processes multiple SPR inputs, includes monovalent fits, and systematically writes output files for each fit can be downloaded <a href="../fitting_workflow/Fitting_Examples.zip">here</a>. This file contains three sub-folders:</p><ol><li><em>Experiments</em> contains a set of CSVs corresponding to processed SPR experiments for fitting.</li><li><em>Code</em> contains a file &quot;readme.md&quot; with instructions on how to use/modify the included &quot;ParameterFitting_Example.jl&quot; script to fit a collection of experiments.</li><li><em>Surrogates</em> is where you should place the downloaded surrogate from the manuscript, which is available <a href="https://doi.org/10.6084/m9.figshare.26936854">here</a> (or place whatever surrogate you wish to use).</li></ol><h2 id="Bibliography"><a class="docs-heading-anchor" href="#Bibliography">Bibliography</a><a id="Bibliography-1"></a><a class="docs-heading-anchor-permalink" href="#Bibliography" title="Permalink"></a></h2><ol><li>A. Huhn, D. Nissley, ..., C. M. Deane, S. A. Isaacson, and O. Dushek, <em>Analysis of emergent bivalent antibody binding identifies the molecular reach as a critical determinant of SARS-CoV-2 neutralisation potency</em>, in review, <a href="https://www.biorxiv.org/content/10.1101/2023.09.06.556503v2">available on bioRxiv</a> (2024).</li></ol></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../surrogate_construction/">« Surrogate Construction</a><a class="docs-footer-nextpage" href="../SPRFitting_api/">API »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 10 September 2024 22:51">Tuesday 10 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
visualisefit(optsol, aligneddat, surrogate, simpars, figfile)</code></pre><p>Which gives</p><p><img src="../fitting_data/fit_curves.png" alt="spr_fit"/></p><p>Here the SPR data is shown in black, and the average predicted responses from forward simulations using the best fit parameters in color. Finally, we can save a spreadsheet with our fits and parameter estimates via</p><pre><code class="language-julia hljs">curvefile = joinpath(OUTDIR, &quot;parameters.xlsx&quot;)
savefit(optsol, aligneddat, surrogate, simpars, curvefile)</code></pre><p>For this example the file <a href="../fitting_data/parameters.xlsx_fit.xlsx">here</a> shows the resulting Excel spreadsheet. Note that the second sheet within it shows the parameter estimates.</p><h2 id="General-Workflow"><a class="docs-heading-anchor" href="#General-Workflow">General Workflow</a><a id="General-Workflow-1"></a><a class="docs-heading-anchor-permalink" href="#General-Workflow" title="Permalink"></a></h2><p>A more detailed workflow that processes multiple SPR inputs, includes monovalent fits, and systematically writes output files for each fit can be downloaded <a href="../fitting_workflow/Fitting_Examples.zip">here</a>. This file contains three sub-folders:</p><ol><li><em>Experiments</em> contains a set of CSVs corresponding to processed SPR experiments that have been prepared for fitting.</li><li><em>Code</em> contains a file &quot;readme.md&quot; with instructions on how to use/modify the included &quot;ParameterFitting_Example.jl&quot; script to fit a collection of experiments.</li><li><em>Surrogates</em> is where you should place the downloaded surrogate from the manuscript, which is available <a href="https://doi.org/10.6084/m9.figshare.26936854">here</a> (or place whatever surrogate you wish to use).</li></ol><h2 id="Bibliography"><a class="docs-heading-anchor" href="#Bibliography">Bibliography</a><a id="Bibliography-1"></a><a class="docs-heading-anchor-permalink" href="#Bibliography" title="Permalink"></a></h2><ol><li>A. Huhn, D. Nissley, ..., C. M. Deane, S. A. Isaacson, and O. Dushek, <em>Analysis of emergent bivalent antibody binding identifies the molecular reach as a critical determinant of SARS-CoV-2 neutralisation potency</em>, in review, <a href="https://www.biorxiv.org/content/10.1101/2023.09.06.556503v2">available on bioRxiv</a> (2024).</li></ol></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../surrogate_construction/">« Surrogate Construction</a><a class="docs-footer-nextpage" href="../SPRFitting_api/">API »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 10 September 2024 22:55">Tuesday 10 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
54 changes: 0 additions & 54 deletions dev/forward_simulation/1aa5466b.svg

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions dev/forward_simulation/6e5bdbcb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions dev/forward_simulation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
label = &quot;[Ab] = $(biopars.antibodyconcen) (simulation)&quot;)
end

plt</code></pre><img src="cb0a7a8b.svg" alt="Example block output"/><p>Here <code>means</code> finalizes calculating the average number of bound antibodies across the 1000 simulations that were run for each antibody concentration. It then returns the <code>CP</code> scaled average number of antibodies bound to the surface at each time in <code>tsave</code> divided by the number of antigen in the system (i.e. <code>N = 1000</code> here). See the <a href="../SPRFitting_api/#SPRFittingPaper2023.run_spr_sim!"><code>run_spr_sim!</code></a> docs and the docs for the terminators <a href="../SPRFitting_api/#SPRFittingPaper2023.VarianceTerminator"><code>SPRFittingPaper2023.VarianceTerminator</code></a> or <a href="../SPRFitting_api/#SPRFittingPaper2023.SimNumberTerminator"><code>SPRFittingPaper2023.SimNumberTerminator</code></a> for more information on terminating simulations in relation to the number / accuracy of the desired averages.</p><p>Finally, let&#39;s load and plot the corresponding aligned SPR data that we originally estimated these parameters from to confirm the good fit. </p><pre><code class="language-julia hljs">datadir = joinpath(@__DIR__, &quot;..&quot;, &quot;..&quot;, &quot;data&quot;)
plt</code></pre><img src="4afa0ad6.svg" alt="Example block output"/><p>Here <code>means</code> finalizes calculating the average number of bound antibodies across the 1000 simulations that were run for each antibody concentration. It then returns the <code>CP</code> scaled average number of antibodies bound to the surface at each time in <code>tsave</code> divided by the number of antigen in the system (i.e. <code>N = 1000</code> here). See the <a href="../SPRFitting_api/#SPRFittingPaper2023.run_spr_sim!"><code>run_spr_sim!</code></a> docs and the docs for the terminators <a href="../SPRFitting_api/#SPRFittingPaper2023.VarianceTerminator"><code>SPRFittingPaper2023.VarianceTerminator</code></a> or <a href="../SPRFitting_api/#SPRFittingPaper2023.SimNumberTerminator"><code>SPRFittingPaper2023.SimNumberTerminator</code></a> for more information on terminating simulations in relation to the number / accuracy of the desired averages.</p><p>Finally, let&#39;s load and plot the corresponding aligned SPR data that we originally estimated these parameters from to confirm the good fit. </p><pre><code class="language-julia hljs">datadir = joinpath(@__DIR__, &quot;..&quot;, &quot;..&quot;, &quot;data&quot;)
fname = joinpath(datadir, &quot;Data_FC4_10-05-22_Protein07_FD-11A_RBD-13.8_aligned.csv&quot;)
ad = get_aligned_data(fname)
for (i, times) in enumerate(ad.times)
plot!(plt, times, ad.refdata[i]; linestyle = :dash, lw = 2,
label = &quot;[Ab] = $(ad.antibodyconcens[i]), (data)&quot;)
end
plt</code></pre><img src="1aa5466b.svg" alt="Example block output"/></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Home</a><a class="docs-footer-nextpage" href="../surrogate_construction/">Surrogate Construction »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 10 September 2024 22:51">Tuesday 10 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
plt</code></pre><img src="6e5bdbcb.svg" alt="Example block output"/></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Home</a><a class="docs-footer-nextpage" href="../surrogate_construction/">Surrogate Construction »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 10 September 2024 22:55">Tuesday 10 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit eddfa4a

Please sign in to comment.