Skip to content

Commit

Permalink
Merge pull request #5 from MunskyGroup/main
Browse files Browse the repository at this point in the history
Catchup merge
  • Loading branch information
dmitrisvetlov authored Dec 1, 2023
2 parents da31f34 + 1719471 commit d95b175
Show file tree
Hide file tree
Showing 175 changed files with 1,149 additions and 291 deletions.
3 changes: 2 additions & 1 deletion Examples/example_ExtrinsicNoiseModels.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@
2+0.4*randn,...
1+0.2*randn];
extrinsicModel = extrinsicSSIT(Model1,parDistributions,20);
Model1.makePlot(extrinsicModel.averagedResults,'marginals',[],[],[2,3])
Model1.makePlot(extrinsicModel.averagedResults,'marginals',[],[],[2,3])
legend('Intrinsic Only','Intrinsic + Extrinsic','Location','EastOutside')
27 changes: 22 additions & 5 deletions Examples/example_FIMCalculation.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,35 @@
%% (2) Solve FSP for model
F2.solutionScheme = 'FSP'; % Set solution scheme to FSP.
[FSPsoln,F2.fspOptions.bounds] = F2.solve; % Solve the FSP analysis
% Plot the results from the FSP analysis
fig1 = figure(1);clf; set(fig1,'Name','Marginal Distributions, mRNA');
fig2 = figure(2);clf; set(fig2,'Name','Marginal Distributions, Protein');
F2.makePlot(FSPsoln,'marginals',[1:4:21],false,[fig1,fig2],{'r-','linewidth',2})

%% (3) Solve FSP Sensitivity
F2.solutionScheme = 'fspSens'; % Set solutions scheme to FSP Sensitivity
[sensSoln,bounds] = F2.solve(FSPsoln.stateSpace); % Solve the sensitivity problem
% Plot the results from the sensitivity analysis
fig3 = figure(3);clf; set(fig3,'Name','Marginal Sensitivity, mRNA');
fig4 = figure(4);clf; set(fig4,'Name','Marginal Sensitivity, Protein');
F2.makePlot(sensSoln,'marginals',[],false,[fig3,fig4],{'b','linewidth',2})

%% (4) Compute FIM using FSP Sensitivity Results
fimResults = F2.computeFIM(sensSoln.sens); % Compute the FIM for full observations and no distortion.
cellCounts = 10*ones(size(F2.tSpan)); % Number of cells in each experiment.
[fimTotal,mleCovEstimate,fimMetrics] = F2.evaluateExperiment(fimResults,cellCounts)
fig5 = figure(5);clf; set(fig5,'Name','Fim-Predicted Uncertainty Ellipses');
F2.plotMHResults([],fimTotal,'lin',[],fig5)
legend('FIM - Full Observation')

%% (5) Compute FIM for Partial Observations
F2.pdoOptions.PDO=[];
F2.pdoOptions.unobservedSpecies = 'x1';
[fimResults_partialObs] = F2.computeFIM(sensSoln.sens); % Compute the FIM for full observations and no distortion.
[fimTotal_partialObs,mleCovEstimate_partialObs,fimMetrics_partialObs] = F2.evaluateExperiment(fimResults_partialObs,cellCounts)
fig6 = figure(6);clf; set(fig6,'Name','Fim-Predicted Uncertainty Ellipses');
F2.plotMHResults([],[fimTotal,fimTotal_partialObs],'lin',[],fig6)
legend('FIM - Full Observation','FIM - Protein Only')

%% (6) Compute FIM for Distorted Observation (Probabilistic Distortion Operator)
F2.pdoOptions.unobservedSpecies = 'x1';
Expand All @@ -36,17 +50,20 @@
pdoOptions.props.CaptureProbabilityS1 = 0; % Use zero for unobserved species.
pdoOptions.props.CaptureProbabilityS2 = 0.9;

% call method to generate the PDO.
% Call method to generate the PDO.
F2.pdoOptions.PDO = F2.generatePDO(pdoOptions,[],FSPsoln.fsp);

% plot the PDO
% Plot the PDO
N = size(F2.pdoOptions.PDO.conditionalPmfs{1});
figure;
fig7 = figure(7); set(fig7,'Name','Probabilistic Distortion Operator for Protein');
contourf([0:N(1)-1],[0:N(2)-1],log10(F2.pdoOptions.PDO.conditionalPmfs{1}));
% Here we wanted the first PDO for 'x2' because 'x1' was unobserved.
xlabel('Actual');ylabel('Observable');colorbar;

% solve FIM using the specified PDO
% Solve FIM using the specified PDO
[fimResults_BinomialPDO] = F2.computeFIM(sensSoln.sens); % Compute the FIM for full observations and no distortion.
[fimTotal_BinomialPDO,mleCovEstimate_BinomialPDO,fimMetrics_BinomialPDO] =...
F2.evaluateExperiment(fimResults_BinomialPDO,cellCounts)
F2.evaluateExperiment(fimResults_BinomialPDO,cellCounts)
fig8 = figure(8);clf; set(fig8,'Name','Fim-Predicted Uncertainty Ellipses');
F2.plotMHResults([],[fimTotal,fimTotal_partialObs,fimTotal_BinomialPDO],'lin',[],fig8)
legend('FIM - Full Observation','FIM - Protein Only','FIM - Protein with Error')
3 changes: 2 additions & 1 deletion Examples/example_HybridModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Model2.hybridOptions.upstreamODEs = {'rna'};
[fspSoln2, Model2.fspOptions.bounds] = Model2.solve;
Model2.makePlot(fspSoln2,'marginals',[],[],3)
legend('Full','QSSA for (n)','Location','eastoutside')

%% Example 2 - 5-species MAPK induction Model
% In this example, we consider a model of MAPK translocation to the nucleus
Expand Down Expand Up @@ -71,4 +72,4 @@
Model5.hybridOptions.upstreamODEs = {'mapkCyt','mapkNuc'};
[fspSoln5, Model5.fspOptions.bounds] = Model5.solve;
Model5.makePlot(fspSoln5,'marginals',[],[],[11,12,15])

legend('Full','QSSA for (gene,MAKP)','QSSA for (MAKP)','Location','eastoutside')
2 changes: 2 additions & 0 deletions Examples/example_IterativeBayesianExperimentDesign.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
fitParameters = [1:4];
end

experimentDesignCriteria =

saveFileName = ['IterativeExperimentResults_',example];

%% Generate Model Propensity Functions and Solve True Model
Expand Down
9 changes: 6 additions & 3 deletions Examples/example_ModelReductionTool.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@
% Make Figures to compare the results. Here, we will plot the original
% model in blue and the reduced model in red lines.
Model1.makePlot(fspSoln,'meansAndDevs',[],[],1,{'Color',[0,0,1]})
Model1.makePlot(fspSoln,'marginals',[],[],[2,3],{'Color',[0,0,1]})

Model2.makePlot(fspSolnRed,'meansAndDevs',[],[],1,{'Color',[1,0,0]})
Model2.makePlot(fspSolnRed,'marginals',[],[],[2,3],{'Color',[1,0,0]})
figure(1);legend('Full','Reduced','Location','southeast')

Model1.makePlot(fspSoln,'marginals',[],[],[2,3],{'Color',[0,0,1]})
Model2.makePlot(fspSolnRed,'marginals',[],[],[2,3],{'Color',[1,0,0]})
figure(2);legend('Full','Reduced','Location','eastoutside')
figure(3);legend('Full','Reduced','Location','eastoutside')
6 changes: 3 additions & 3 deletions Examples/html/example_EscapeTimes.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><title>example_EscapeTimes</title><meta name="generator" content="MATLAB 9.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2023-10-21"><meta name="DC.source" content="example_EscapeTimes.m"><style type="text/css">
--><title>example_EscapeTimes</title><meta name="generator" content="MATLAB 9.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2023-11-15"><meta name="DC.source" content="example_EscapeTimes.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
Expand Down Expand Up @@ -69,7 +69,7 @@

</style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#1">example_EscapeTimes</a></li><li><a href="#2">Example 1 - a simple transcription/translation model</a></li><li><a href="#3">Next, specify a boundary for the escape calculation</a></li><li><a href="#4">Example 2 - escape time with time varying transcription rate</a></li><li><a href="#5">Here we solve for the escape time:</a></li><li><a href="#6">Example 3 - More complex escape thresholds.</a></li><li><a href="#7">Example 4 - Time until making a specific decision.</a></li></ul></div><h2 id="1">example_EscapeTimes</h2><p>In this script, we demonstrate how to create and solve a fiorst passage time problem.</p><pre class="codeinput">close <span class="string">all</span>
clear <span class="string">all</span>
addpath(<span class="string">'../CommandLine'</span>);
addpath(genpath(<span class="string">'../src'</span>));
</pre><h2 id="2">Example 1 - a simple transcription/translation model</h2><p>First create a full model (e.g., for mRNA and protein)</p><pre class="codeinput">Model1 = SSIT;
Model1.species = {<span class="string">'rna'</span>,<span class="string">'protein'</span>};
Model1.initialCondition = [0;0];
Expand Down Expand Up @@ -112,7 +112,7 @@
% time problem.
close all
clear all
addpath('../CommandLine');
addpath(genpath('../src'));
%% Example 1 - a simple transcription/translation model
% First create a full model (e.g., for mRNA and protein)
Model1 = SSIT;
Expand Down
Binary file modified Examples/html/example_EscapeTimes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/html/example_EscapeTimes_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/html/example_EscapeTimes_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/html/example_EscapeTimes_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/html/example_EscapeTimes_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions Examples/html/example_ExtrinsicNoiseModels.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><title>example_ExtrinsicNoiseModels</title><meta name="generator" content="MATLAB 9.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2023-10-21"><meta name="DC.source" content="example_ExtrinsicNoiseModels.m"><style type="text/css">
--><title>example_ExtrinsicNoiseModels</title><meta name="generator" content="MATLAB 9.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2023-11-15"><meta name="DC.source" content="example_ExtrinsicNoiseModels.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
Expand Down Expand Up @@ -69,7 +69,7 @@

</style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#1">example_ExtrinsicNoiseModels</a></li><li><a href="#2">Example 1 - transcription and translation</a></li><li><a href="#3">Generate, solve and plot results for an extrinsic noise version</a></li></ul></div><h2 id="1">example_ExtrinsicNoiseModels</h2><p>In this example, we show how to sample an FSM model over intrinsic noise in its various parameters.</p><pre class="codeinput">close <span class="string">all</span>
clear <span class="string">all</span>
addpath(<span class="string">'../CommandLine'</span>);
addpath(genpath(<span class="string">'../src'</span>));
</pre><h2 id="2">Example 1 - transcription and translation</h2><p>First create a full model (e.g., for mRNA and protein)</p><pre class="codeinput">Model1 = SSIT();
Model1.species = {<span class="string">'rna'</span>,<span class="string">'protein'</span>};
Model1.initialCondition = [0;0];
Expand All @@ -80,21 +80,23 @@
Model1.fspOptions.initApproxSS = false;
Model1.tSpan = linspace(0,5,10);
[fspSoln1,Model1.fspOptions.bounds] = Model1.solve;
Model1 = Model1.formPropensitiesGeneral(<span class="string">'Model1'</span>);
Model1.makePlot(fspSoln1,<span class="string">'marginals'</span>,[],[],[2,3])
</pre><img vspace="5" hspace="5" src="example_ExtrinsicNoiseModels_01.png" alt=""> <img vspace="5" hspace="5" src="example_ExtrinsicNoiseModels_02.png" alt=""> <h2 id="3">Generate, solve and plot results for an extrinsic noise version</h2><p>Specify the rules for the extrinsic noise. This must be a function that returns a vector of parameters, that are in the same order as the parameters provided. You can choose a different distribution for the extrinsic noise in each parameter.</p><pre class="codeinput">parDistributions = @()[10+2*randn,<span class="keyword">...</span>
0.5+0.1*randn,<span class="keyword">...</span>
2+0.4*randn,<span class="keyword">...</span>
1+0.2*randn];
extrinsicModel = extrinsicSSIT(Model1,parDistributions,20);
Model1.makePlot(extrinsicModel.averagedResults,<span class="string">'marginals'</span>,[],[],[2,3])
legend(<span class="string">'Intrinsic Only'</span>,<span class="string">'Intrinsic + Extrinsic'</span>,<span class="string">'Location'</span>,<span class="string">'EastOutside'</span>)
</pre><img vspace="5" hspace="5" src="example_ExtrinsicNoiseModels_03.png" alt=""> <img vspace="5" hspace="5" src="example_ExtrinsicNoiseModels_04.png" alt=""> <p class="footer"><br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2023a</a><br></p></div><!--
##### SOURCE BEGIN #####
%% example_ExtrinsicNoiseModels
% In this example, we show how to sample an FSM model over intrinsic noise
% in its various parameters.
close all
clear all
addpath('../CommandLine');
addpath(genpath('../src'));
%% Example 1 - transcription and translation
% First create a full model (e.g., for mRNA and protein)
Model1 = SSIT();
Expand All @@ -107,6 +109,7 @@
Model1.fspOptions.initApproxSS = false;
Model1.tSpan = linspace(0,5,10);
[fspSoln1,Model1.fspOptions.bounds] = Model1.solve;
Model1 = Model1.formPropensitiesGeneral('Model1');
Model1.makePlot(fspSoln1,'marginals',[],[],[2,3])
%% Generate, solve and plot results for an extrinsic noise version
Expand All @@ -120,5 +123,6 @@
1+0.2*randn];
extrinsicModel = extrinsicSSIT(Model1,parDistributions,20);
Model1.makePlot(extrinsicModel.averagedResults,'marginals',[],[],[2,3])
legend('Intrinsic Only','Intrinsic + Extrinsic','Location','EastOutside')
##### SOURCE END #####
--></body></html>
Binary file modified Examples/html/example_ExtrinsicNoiseModels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/html/example_ExtrinsicNoiseModels_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/html/example_ExtrinsicNoiseModels_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/html/example_ExtrinsicNoiseModels_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/html/example_ExtrinsicNoiseModels_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d95b175

Please sign in to comment.