00001
00002
00004
00005 #include "EGFRTraffickingNIH3T3MinimizableDirector.h"
00006
00008
00010
00011 CEGFRTraffickingNIH3T3MinimizableDirector::CEGFRTraffickingNIH3T3MinimizableDirector()
00012 {
00013
00014 double maxSimTime = 361.0;
00015 double stepSize = 0.0001;
00016 double frequency = 1.0;
00017 int nCells = 1;
00018 double moveTol = 1.0e-06;
00019
00020 m_dGammaSquared = 0.0;
00021
00022
00023 bool rateFlag = true;
00024 bool chemFlag = false;
00025 bool logsFlag = false;
00026 double timeWeight = 1.0;
00027 double rateWeight = 0.0;
00028 double chemWeight = 0.0;
00029
00030 int cnt = 0;
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 _networkList.push_back(new CEGFRTraffickingNetwork());
00063 _experimentList.push_back(new Experiment(_networkList[cnt],"20 Percent Initial Occupancy, Helin 1991"));
00064
00065 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/EGFHelinOccupied.dat");
00066
00067
00068 _moverList.push_back(new CStiffBulirschStoerMover(frequency,stepSize,moveTol));
00069
00070 _minimizableList.push_back(new SingleNetworkMinimizable());
00071
00072 _minimizableList[cnt]->Initialize(_experimentList[cnt],_moverList[cnt],nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00073 _minimizableList[cnt]->GetConversionFactor(68)->SetFactorFixed(true);
00074 _minimizableList[cnt]->GetConversionFactor(68)->SetFactorValue(100.0/20000.0);
00075 _minimizableList[cnt]->SetRateConstantsWeight(0.0);
00076
00077
00078 _plotterList.push_back(new GnuPlotterTimeSeriesObserver());
00079 _plotterList[cnt]->SetTitle("EGFR Trafficking Network:20 Percent Initial EGFR Occupancy (Helin 1991):ODE");
00080 _minimizableList[cnt]->Attach(_plotterList[cnt]);
00081
00082 cnt++;
00083
00084
00085
00086 _networkList.push_back(new CEGFRTraffickingNetwork());
00087 _experimentList.push_back(new Experiment(_networkList[cnt],"EGF at 100 ng/ml wt1, Carter 1998"));
00088
00089 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/SurfaceEGFREGFwt1Carter.dat");
00090 _experimentList[cnt]->AddForcingFileToList("../DataFiles/TimeSeries/TwoHourEGF.dat");
00091
00092
00093 _moverList.push_back(new CStiffBulirschStoerMover(frequency,stepSize,moveTol));
00094
00095 _minimizableList.push_back(new SingleNetworkMinimizable());
00096
00097 _minimizableList[cnt]->Initialize(_experimentList[cnt],_moverList[cnt],nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00098 _minimizableList[cnt]->GetConversionFactor(67)->SetFactorFixed(true);
00099 _minimizableList[cnt]->GetConversionFactor(67)->SetFactorValue(100.0/100000.0);
00100 _minimizableList[cnt]->SetRateConstantsWeight(0.0);
00101
00102
00103 _plotterList.push_back(new GnuPlotterTimeSeriesObserver());
00104 _plotterList[cnt]->SetTitle("EGFR Trafficking Network:EGF at 100 ng/ml, wt1 (Carter 1998):ODE");
00105 _minimizableList[cnt]->Attach(_plotterList[cnt]);
00106
00107 cnt++;
00108
00109
00110
00111 _networkList.push_back(new CEGFRTraffickingNetwork());
00112 _experimentList.push_back(new Experiment(_networkList[cnt],"EGF at 100 ng/ml wt2, Carter 1998"));
00113
00114 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/SurfaceEGFREGFwt2Carter.dat");
00115 _experimentList[cnt]->AddForcingFileToList("../DataFiles/TimeSeries/TwoHourEGF.dat");
00116
00117
00118 _moverList.push_back(new CStiffBulirschStoerMover(frequency,stepSize,moveTol));
00119
00120 _minimizableList.push_back(new SingleNetworkMinimizable());
00121
00122 _minimizableList[cnt]->Initialize(_experimentList[cnt],_moverList[cnt],nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00123 _minimizableList[cnt]->GetConversionFactor(67)->SetFactorFixed(true);
00124 _minimizableList[cnt]->GetConversionFactor(67)->SetFactorValue(100.0/275000.0);
00125 _minimizableList[cnt]->SetRateConstantsWeight(0.0);
00126
00127
00128 _plotterList.push_back(new GnuPlotterTimeSeriesObserver());
00129 _plotterList[cnt]->SetTitle("EGFR Trafficking Network:EGF at 100 ng/ml, wt2 (Carter 1998):ODE");
00130 _minimizableList[cnt]->Attach(_plotterList[cnt]);
00131
00132 cnt++;
00133
00134
00135 _networkList.push_back(new CEGFRTraffickingNetwork());
00136 _experimentList.push_back(new Experiment(_networkList[cnt],"EGF at 100 ng/ml (Wu 2002)"));
00137
00138 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/TotalEGFRWuVector.dat");
00139 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/ErkEGFWuVector.dat");
00140 _experimentList[cnt]->AddForcingFileToList("../DataFiles/TimeSeries/TwoHourEGF.dat");
00141
00142
00143 _moverList.push_back(new CStiffBulirschStoerMover(frequency,stepSize,moveTol));
00144
00145 _minimizableList.push_back(new SingleNetworkMinimizable());
00146
00147 _minimizableList[cnt]->Initialize(_experimentList[cnt],_moverList[cnt],nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00148 _minimizableList[cnt]->GetConversionFactor(77)->SetFactorFixed(true);
00149 _minimizableList[cnt]->GetConversionFactor(77)->SetFactorValue(1.0/8000.0);
00150 _minimizableList[cnt]->SetRateConstantsWeight(0.0);
00151
00152
00153 _plotterList.push_back(new GnuPlotterTimeSeriesObserver());
00154 _plotterList[cnt]->SetTitle("EGFR Trafficking Network:EGF at 100 ng/ml, Endogenous EGFR (Wu 2002):ODE");
00155 _minimizableList[cnt]->Attach(_plotterList[cnt]);
00156
00157 cnt++;
00158
00159
00160
00161 _networkList.push_back(new CEGFRTraffickingNetwork());
00162 _experimentList.push_back(new Experiment(_networkList[cnt],"EGF at 100 ng/ml, stable F28L (Wu 2002)"));
00163
00164 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/TotalEGFRWuF28L.dat");
00165 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/ErkEGFWuF28L.dat");
00166 _experimentList[cnt]->AddForcingFileToList("../DataFiles/TimeSeries/TwoHourEGF.dat");
00167
00168
00169 _moverList.push_back(new CStiffBulirschStoerMover(frequency,stepSize,moveTol));
00170
00171 _minimizableList.push_back(new SingleNetworkMinimizable());
00172
00173 _minimizableList[cnt]->Initialize(_experimentList[cnt],_moverList[cnt],nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00174 _minimizableList[cnt]->GetConversionFactor(77)->SetFactorFixed(true);
00175 _minimizableList[cnt]->GetConversionFactor(77)->SetFactorValue(1.0/8000.0);
00176 _minimizableList[cnt]->SetRateConstantsWeight(0.0);
00177
00178
00179 _plotterList.push_back(new GnuPlotterTimeSeriesObserver());
00180 _plotterList[cnt]->SetTitle("EGFR Trafficking Network:EGF at 100 ng/ml, stable F28L (Wu 2002):ODE");
00181 _minimizableList[cnt]->Attach(_plotterList[cnt]);
00182
00183 cnt++;
00184
00185
00186
00187 _networkList.push_back(new CEGFRTraffickingNetwork());
00188 _experimentList.push_back(new Experiment(_networkList[cnt],"EGF at 100 ng/ml, stable F28L/dL8 (Wu 2002)"));
00189
00190 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/TotalEGFRWuF28LdL8.dat");
00191 _experimentList[cnt]->AddDataFileToList("../DataFiles/TimeSeries/ErkEGFWuF28LdL8.dat");
00192 _experimentList[cnt]->AddForcingFileToList("../DataFiles/TimeSeries/TwoHourEGF.dat");
00193
00194
00195 _moverList.push_back(new CStiffBulirschStoerMover(frequency,stepSize,moveTol));
00196
00197 _minimizableList.push_back(new SingleNetworkMinimizable());
00198
00199 _minimizableList[cnt]->Initialize(_experimentList[cnt],_moverList[cnt],nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00200 _minimizableList[cnt]->GetConversionFactor(77)->SetFactorFixed(true);
00201 _minimizableList[cnt]->GetConversionFactor(77)->SetFactorValue(1.0/8000.0);
00202 _minimizableList[cnt]->SetRateConstantsWeight(0.0);
00203
00204
00205 _plotterList.push_back(new GnuPlotterTimeSeriesObserver());
00206 _plotterList[cnt]->SetTitle("EGFR Trafficking Network:EGF at 100 ng/ml, stable F28L/dL8 (Wu 2002):ODE");
00207 _minimizableList[cnt]->Attach(_plotterList[cnt]);
00208
00209 cnt++;
00210
00211
00212
00213
00214
00215
00216
00217
00218 int masterResidualsSize = 0;
00219 for(int i = 0; i < _minimizableList.size(); i++)
00220 {
00221 int subRes = _minimizableList[i]->GetNResiduals();
00222 masterResidualsSize += subRes;
00223 cout << subRes << " residuals in minimizable " << i << endl;
00224 }
00225
00226 masterResidualsSize += m_iPriorList.size();
00227 cout << m_iPriorList.size() << " parameters are constrained by a prior " << endl;
00228 if(m_dGammaSquared > 0.0)
00229 {
00230 masterResidualsSize += 1;
00231 }
00232 Allocate(masterResidualsSize);
00233
00234 cout << "Master Residuals size : " << masterResidualsSize << endl;
00235
00236
00237 DefineExperiments();
00238
00239
00240
00241 }
00242
00243 CEGFRTraffickingNIH3T3MinimizableDirector::~CEGFRTraffickingNIH3T3MinimizableDirector()
00244 {
00245 for(int i = 0; i < _plotterList.size(); i++)
00246 {
00247 _minimizableList[i]->Detach(_plotterList[i]);
00248 delete _plotterList[i];
00249 }
00250 m_iPriorList.erase(m_iPriorList.begin(),m_iPriorList.end());
00251 }
00252
00253 void CEGFRTraffickingNIH3T3MinimizableDirector::DefineExperiments()
00254 {
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266 _minimizableList[0]->GetExperiment()->GetReactionNetwork()->RemoveReaction(115);
00267 _minimizableList[0]->GetExperiment()->GetReactionNetwork()->GetChemical(3)->SetInitialAmount(10000.0);
00268 _minimizableList[0]->GetExperiment()->GetReactionNetwork()->GetChemical(4)->SetInitialAmount(70000.0);
00269 _minimizableList[0]->GetExperiment()->GetReactionNetwork()->GetChemical(5)->SetInitialAmount(10000.0);
00270 _minimizableList[0]->GetExperiment()->GetReactionNetwork()->GetChemical(6)->SetInitialAmount(10000.0);
00271 _minimizableList[0]->GetExperiment()->GetReactionNetwork()->ChemicalReset();
00272
00273
00274 _minimizableList[1]->GetExperiment()->GetReactionNetwork()->RemoveReaction(115);
00275 _minimizableList[1]->GetExperiment()->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.2e+007);
00276 _minimizableList[1]->GetExperiment()->GetReactionNetwork()->GetChemical(3)->SetInitialAmount(10000);
00277 _minimizableList[1]->GetExperiment()->GetReactionNetwork()->GetChemical(4)->SetInitialAmount(90000);
00278 _minimizableList[1]->GetExperiment()->GetReactionNetwork()->ChemicalReset();
00279
00280
00281 _minimizableList[2]->GetExperiment()->GetReactionNetwork()->RemoveReaction(115);
00282 _minimizableList[2]->GetExperiment()->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.2e+007);
00283 _minimizableList[2]->GetExperiment()->GetReactionNetwork()->GetChemical(3)->SetInitialAmount(10000);
00284 _minimizableList[2]->GetExperiment()->GetReactionNetwork()->GetChemical(4)->SetInitialAmount(265000);
00285 _minimizableList[2]->GetExperiment()->GetReactionNetwork()->ChemicalReset();
00286
00287
00288 _minimizableList[3]->GetExperiment()->GetReactionNetwork()->RemoveReaction(115);
00289 _minimizableList[3]->GetExperiment()->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.2e+007);
00290 _minimizableList[3]->GetExperiment()->GetReactionNetwork()->GetChemical(3)->SetInitialAmount(8000);
00291 _minimizableList[3]->GetExperiment()->GetReactionNetwork()->GetChemical(4)->SetInitialAmount(0.0);
00292 _minimizableList[3]->GetExperiment()->GetReactionNetwork()->ChemicalReset();
00293
00294
00295 _minimizableList[4]->GetExperiment()->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(0.0);
00296 _minimizableList[4]->GetExperiment()->GetReactionNetwork()->GetChemical(3)->SetInitialAmount(8000);
00297 _minimizableList[4]->GetExperiment()->GetReactionNetwork()->GetChemical(4)->SetInitialAmount(0.0);
00298
00299 _minimizableList[4]->GetExperiment()->GetReactionNetwork()->GetChemical(46)->SetInitialAmount(0.0);
00300 _minimizableList[4]->GetExperiment()->GetReactionNetwork()->GetChemical(47)->SetInitialAmount(0.5*600000);
00301 _minimizableList[4]->GetExperiment()->GetReactionNetwork()->GetChemical(48)->SetInitialAmount(0.0);
00302 _minimizableList[4]->GetExperiment()->GetReactionNetwork()->GetChemical(49)->SetInitialAmount(0.5*600000);
00303 _minimizableList[4]->GetExperiment()->GetReactionNetwork()->ChemicalReset();
00304
00305
00306 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->RemoveReaction(53);
00307 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->RemoveReaction(51);
00308 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(0.0);
00309 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->GetChemical(3)->SetInitialAmount(8000);
00310 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->GetChemical(4)->SetInitialAmount(0.0);
00311
00312 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->GetChemical(46)->SetInitialAmount(0.0);
00313 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->GetChemical(47)->SetInitialAmount(0.5*600000);
00314 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->GetChemical(48)->SetInitialAmount(0.0);
00315 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->GetChemical(49)->SetInitialAmount(0.5*600000);
00316 _minimizableList[5]->GetExperiment()->GetReactionNetwork()->ChemicalReset();
00317 }
00318
00319 double CEGFRTraffickingNIH3T3MinimizableDirector::GetParameter(int parIndex)
00320 {
00321
00322
00323
00324
00325 if(parIndex < _minimizableList[0]->GetNParameters())
00326 {
00327 return _minimizableList[0]->GetParameter(parIndex);
00328 }
00329 }
00330
00331 int CEGFRTraffickingNIH3T3MinimizableDirector::GetNParameters()
00332 {
00333
00334
00335
00336
00337 return _minimizableList[0]->GetNParameters() + 9;
00338 }
00339
00340 double CEGFRTraffickingNIH3T3MinimizableDirector::ComputeResiduals(double *parameters)
00341 {
00342 int lastrc = _minimizableList[0]->GetNParameters();
00343
00344 for(int i = 0; i < 4; i++)
00345 {
00346 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(45)->SetInitialAmount(parameters[lastrc]);
00347 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(46)->SetInitialAmount(parameters[lastrc+1]);
00348 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(48)->SetInitialAmount(parameters[lastrc+2]);
00349 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(51)->SetInitialAmount(parameters[lastrc+3]);
00350 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(57)->SetInitialAmount(parameters[lastrc+4]);
00351 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(58)->SetInitialAmount(parameters[lastrc+5]);
00352 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(63)->SetInitialAmount(parameters[lastrc+6]);
00353 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(71)->SetInitialAmount(parameters[lastrc+7]);
00354 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->ChemicalReset();
00355
00356 }
00357 for(i = 4; i < 6; i++)
00358 {
00359 double mult = 1.0 + parameters[lastrc + 8];
00360 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(45)->SetInitialAmount(parameters[lastrc]);
00361 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(46)->SetInitialAmount(0.0);
00362 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(48)->SetInitialAmount(0.0);
00363 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(51)->SetInitialAmount(parameters[lastrc+3]);
00364 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(57)->SetInitialAmount(parameters[lastrc+4]);
00365 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(58)->SetInitialAmount(parameters[lastrc+5]);
00366 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(63)->SetInitialAmount(parameters[lastrc+6]);
00367 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(71)->SetInitialAmount(parameters[lastrc+6]);
00368 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(47)->SetInitialAmount(mult*parameters[lastrc+1]);
00369 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->GetChemical(49)->SetInitialAmount(mult*parameters[lastrc+2]);
00370 _minimizableList[i]->GetExperiment()->GetReactionNetwork()->ChemicalReset();
00371 }
00372
00373
00374
00375
00376 double summedCost = 0.0;
00377 double timeCost = 0.0;
00378 double pcost = 0.0;
00379
00380
00381 for(int i = 0; i < _minimizableList.size(); i++)
00382 {
00383 summedCost += _minimizableList[i]->ObjectiveFunction(parameters);
00384 }
00385
00386
00387 int nextResidual = 0;
00388 for(i = 0; i < _minimizableList.size(); i++)
00389 {
00390 int nRes = _minimizableList[i]->GetNResiduals();
00391 for(int j = 0; j < nRes; j++)
00392 {
00393 residuals[nextResidual+j] = (_minimizableList[i]->GetResiduals())[j];
00394 }
00395 nextResidual += nRes;
00396 }
00397
00398
00399 for(i = 0; i < m_iPriorList.size(); i++)
00400 {
00401 int which = m_iPriorList[i];
00402 double presid = _networkList[0]->GetRateConstant(which)->GetValue() - _networkList[0]->GetRateConstant(which)->GetInitialValue();
00403 presid = presid/(sqrt(2.0)*_networkList[0]->GetRateConstant(which)->GetErrorInInitialValue());
00404 residuals[nextResidual + i] = presid;
00405 pcost += presid*presid;
00406 }
00407 nextResidual += m_iPriorList.size();
00408
00409
00410
00411 if(m_dGammaSquared > 0.0)
00412 {
00413 double totalSteps = 0.0;
00414 for(int l = 0; l < _moverList.size(); l++)
00415 {
00416 totalSteps += _moverList[l]->GetTotalStepsTaken();
00417 }
00418 residuals[nResiduals - 1] = sqrt(m_dGammaSquared/2.0)*totalSteps;
00419 timeCost = residuals[nResiduals - 1]*residuals[nResiduals - 1];
00420 }
00421 return summedCost + pcost + timeCost;
00422 }