-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create SPR_fitting.md #704
base: master
Are you sure you want to change the base?
Conversation
This needs to be added to the make.jl of the docs in order to show up. |
Will continue going through it tomorrow, but so far it looks good :) |
I have gone through the first half. Unfortunately I get an error after that due to not being sure which combination of optimization packages to use. Once that is figured out, I will go through the last bit :) |
@tstrey this needs to have master merged into it as it is out of date. (The pages.jl needs updating.) |
@tstrey this should probably be moved to be an inverse problem example now instead of a model creation example given the new doc structure. Can you update that? |
@@ -0,0 +1,110 @@ | |||
# [Surface Plasmon Resonance Model Example](@id surface_plasmon_resonance_model_Example) | |||
This tutorial shows how to programmatically construct a ['ReactionSystem'](@ref) corresponding to the chemistry underlying the [Surface Plasmon Resonance Model](https://en.wikipedia.org/wiki/Surface_plasmon_resonance) using [ModelingToolkit](http://docs.sciml.ai/ModelingToolkit/stable/)/[Catalyst](http://docs.sciml.ai/Catalyst/stable/). You can find a simpler constructruction of this model [here](https://docs.sciml.ai/Catalyst/stable/catalyst_applications/parameter_estimation/) in the example of parameter estimation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.sciml.ai/Catalyst/stable/catalyst_applications/parameter_estimation/
This seems to be a link from an older version of the docs that no longer works / exists.
Using the symbolic interface, we will create our states/species, define our reactions, and add a discrete event. This model is simulated and used to generate sample data points with added noise and then used to fit parameters in iterations. This event will correspond to the time at which the antibody stop binding to antigen and switch to dissociating. | ||
|
||
We begin by importing some necessary packages. | ||
```julia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```julia | |
```@example spr_ex |
All of these should be @example
blocks so that they run dynamically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check out the Documenter.jl documentation for information on how to use such blocks, or look at the other Catalyst tutorials.
using Optimization, OptimizatizationOptimJL | ||
using Plots | ||
``` | ||
In this example, the concentration of antigen,`\beta` is varied to determine the constant of proportionality, `\alpha`, `k_{on}`(association rate constant), and `k_{off}` (dissociation rate constant) which characterized the binding interaction between the antigen and the immobilized receptor molecules on the sensor slide. We start by defining our reaction equations, parameters, variables, event, and states. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that single quotes are for code rendering not math. They won't render \beta as
# [Surface Plasmon Resonance Model Example](@id surface_plasmon_resonance_model_Example) | ||
This tutorial shows how to programmatically construct a ['ReactionSystem'](@ref) corresponding to the chemistry underlying the [Surface Plasmon Resonance Model](https://en.wikipedia.org/wiki/Surface_plasmon_resonance) using [ModelingToolkit](http://docs.sciml.ai/ModelingToolkit/stable/)/[Catalyst](http://docs.sciml.ai/Catalyst/stable/). You can find a simpler constructruction of this model [here](https://docs.sciml.ai/Catalyst/stable/catalyst_applications/parameter_estimation/) in the example of parameter estimation. | ||
|
||
Using the symbolic interface, we will create our states/species, define our reactions, and add a discrete event. This model is simulated and used to generate sample data points with added noise and then used to fit parameters in iterations. This event will correspond to the time at which the antibody stop binding to antigen and switch to dissociating. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the symbolic interface, we will create our states/species, define our reactions, and add a discrete event. This model is simulated and used to generate sample data points with added noise and then used to fit parameters in iterations. This event will correspond to the time at which the antibody stop binding to antigen and switch to dissociating. | |
Using the DSL interface, we will create our states/species, define our reactions, and add a discrete event. This model is simulated and used to generate sample data points with added noise and then used to fit parameters in iterations. This event will correspond to the time at which the antibody stop binding to antigen and switch to dissociating. |
plot(p, sample_times, results_list[1][2,:]) | ||
plot!(p, sample_times, results_list[2][2,:]) | ||
plot!(p, sample_times, results_list[3][2,:]) | ||
plot!(p, sample_times, results_list[4][2,:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use a loop.
return sol.u | ||
end | ||
|
||
p_estimate = optimise_p([100.0, 10.0, 1.0], 1.5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p_estimate = optimise_p([100.0, 10.0, 1.0], 1.5) | |
p_estimate = optimise_p([100.0, 10.0, 1.0], 1.5) |
Shouldn't tend
here by switch_time
? Why are you setting it to be smaller?
|
||
p_estimate = optimise_p([100.0, 10.0, 1.0], 1.5) | ||
``` | ||
Finally, we remake the solution using the estimate, fit the entire time span for some `alpha`, and plot the solution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you don't seem to be fitting a second time using the parameters from the first fit?
No description provided.