Skip to content

Commit

Permalink
Fix bug in model constraints for Dusp1 model.
Browse files Browse the repository at this point in the history
  • Loading branch information
Munsky committed Oct 22, 2024
1 parent d71de53 commit ac3efa3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions WorkSpace/EricModel/a0_Fit_GR_and_DUSP1_models.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
close all
addpath(genpath('../../src'));

loadPrevious = true;
savedWorkspace = 'workspaceJuly24';
loadPrevious = false;
savedWorkspace = 'workspaceOct22_2024';
addpath('tmpPropensityFunctions');

%% STEP 0 -- Preliminaries.
Expand Down Expand Up @@ -88,7 +88,7 @@
for i=1:3
ModelGRfit{i} = ModelGR.loadData("EricData/Gated_dataframe_Ron_020224_NormalizedGR_bins.csv",...
{'nucGR','normgrnuc';'cytGR','normgrcyt'},...
{'Condition','GR_timesweep';'Dex_Conc',GRfitCases{i,2}});
{'Dex_Conc',GRfitCases{i,2}});
ModelGRfit{i}.parameters(13,:) = {'Dex0', str2num(GRfitCases{i,1})};
ModelGRparameterMap(i) = {(1:8)};
% parameters 1 - 8 refer to the parameter set that is relevant to
Expand Down Expand Up @@ -180,6 +180,7 @@
ModelGRDusp100nM.useHybrid = true;
ModelGRDusp100nM.hybridOptions.upstreamODEs = {'cytGR','nucGR'};
ModelGRDusp100nM.solutionScheme = 'FSP';
ModelGRDusp100nM.customConstraintFuns = [];
ModelGRDusp100nM.fspOptions.bounds = [0;0;0;2;2;400];
ModelGRDusp100nM.fittingOptions.modelVarsToFit = 1:4;
ModelGRDusp100nM = ModelGRDusp100nM.formPropensitiesGeneral('EricModDusp1');
Expand Down Expand Up @@ -235,7 +236,6 @@
%% STEP 2.D.2. -- Compute FIM
% define which species in model are not observed.
ModelGRDusp100nM.pdoOptions.unobservedSpecies = {'offGene';'onGene'};
% TODO - Make this automated when you load data.

% compute the FIM
fimResults = ModelGRDusp100nM.computeFIM(sensSoln.sens,'log');
Expand All @@ -262,7 +262,7 @@
else
MHFitOptions.proposalDistribution=@(x)mvnrnd(x,covFree);
MHFitOptions.thin=1;
MHFitOptions.numberOfSamples=10000;
MHFitOptions.numberOfSamples=1000;
MHFitOptions.burnIn=0;
MHFitOptions.progress=true;
MHFitOptions.numChains = 1;
Expand Down Expand Up @@ -545,7 +545,7 @@
%'DUSP1parsIntensity'
});

save('workspaceJuly24',varNames{:})
save('workspaceOct22_2024',varNames{:})

%% Extra Function

Expand Down
14 changes: 7 additions & 7 deletions WorkSpace/EricModel/a1_Apply_PDO_to_DUSP1_data_and_model.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
addpath(genpath('../../src'));

loadPrevious = true;
savedWorkspace = 'workspaceJuly24';
savedWorkspace = 'workspaceOct22_2024';
addpath('tmpPropensityFunctions');

load('workspaceJuly24.mat');
load(savedWorkspace);

figNew = figure;

Expand Down Expand Up @@ -168,7 +168,7 @@
DUSP1parsFIMDesign = ModelGRDusp100nM_FIMDesign.maximizeLikelihood(...
DUSP1parsFIMDesign, fitOptions);
ModelGRDusp100nM_FIMDesign.parameters(1:4,2) = num2cell(DUSP1parsFIMDesign);
save('EricModelDusp1_MMDex','GRpars','DUSP1pars','DUSP1parsFIMDesign')
save('EricModelDusp1_MMDex_PDO','GRpars','DUSP1pars','DUSP1parsFIMDesign')
end

%% STEP XX.D.2. -- Plot fit and predicitons using FIM suggested conditions.
Expand All @@ -183,15 +183,15 @@
ModelPDOIntensEric = ModelPDOIntensEric.loadData('EricData/pdoCalibrationData_EricIntensity_DexSweeps.csv',...
{'rna','Nuc_DUSP1_avg_int_tot'},...
{'Dex_Conc','100'});
load('EricModelDusp1_MMDex','DUSP1parsIntensity')
load('EricModelDusp1_MMDex_PDO','DUSP1parsIntensity')

ModelPDOIntensEric.parameters(1:4,2) = num2cell(DUSP1parsIntensity);

for i = 1:fitIters
DUSP1parsIntensity = ModelPDOIntensEric.maximizeLikelihood(...
DUSP1parsIntensity, fitOptions);
ModelPDOIntensEric.parameters(1:4,2) = num2cell(DUSP1parsIntensity);
save('EricModelDusp1_MMDex','GRpars','DUSP1pars','DUSP1parsFIMDesign','DUSP1parsIntensity','DUSP1parsFIMDesignIntensity')
save('EricModelDusp1_MMDex_PDO','GRpars','DUSP1pars','DUSP1parsFIMDesign','DUSP1parsIntensity','DUSP1parsFIMDesignIntensity')
end
%% STEP XX.D.3.a. -- Plot predictions when fit to distorted data at ALL times.
showCases = [1,1,1,1];
Expand All @@ -209,14 +209,14 @@
% Set fitting routine only to consider the time points selected by the FIM.
ModelPDOIntensEricFIM.fittingOptions.timesToFit = nCellsOpt>0;
% Refit the model, but now with only those time points.
load('EricModelDusp1_MMDex','DUSP1parsFIMDesignIntensity')
load('EricModelDusp1_MMDex_PDO','DUSP1parsFIMDesignIntensity')
ModelPDOIntensEricFIM.parameters(1:4,2) = num2cell(DUSP1parsFIMDesignIntensity);

for i = 1:5
DUSP1parsFIMDesignIntensity = ModelPDOIntensEricFIM.maximizeLikelihood(...
DUSP1parsFIMDesignIntensity, fitOptions);
ModelPDOIntensEricFIM.parameters(1:4,2) = num2cell(DUSP1parsFIMDesignIntensity);
save('EricModelDusp1_MMDex','GRpars','DUSP1pars','DUSP1parsFIMDesign','DUSP1parsFIMDesignIntensity')
save('EricModelDusp1_MMDex_PDO','GRpars','DUSP1pars','DUSP1parsFIMDesign','DUSP1parsFIMDesignIntensity')
end
%% STEP XX.D.5.a. -- Plot predictions when fit to distorted data at FIM times.
showCases = [1,1,1,1];
Expand Down

0 comments on commit ac3efa3

Please sign in to comment.