Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

OneGeneInhibitoryNetworkMinimizableDirector.cpp

Go to the documentation of this file.
00001 // OneGeneInhibitoryNetworkMinimizableDirector.cpp: implementation of the OneGeneInhibitoryNetworkMinimizableDirector class.
00002 //
00004 
00005 #include "OneGeneInhibitoryNetworkMinimizableDirector.h"
00006 #include "SharedBFactorNetworkMinimizable.h"
00007 #include "GnuPlotterTimeSeriesSharedBFactorObserver.h"
00008 
00010 // Construction/Destruction
00012 
00013 COneGeneInhibitoryNetworkMinimizableDirector::COneGeneInhibitoryNetworkMinimizableDirector()
00014 {
00015         double maxSimTime = 91.0;
00016         double stepSize = 0.0001;
00017         double frequency = 1.0;
00018         int nCells = 1;
00019         double moveTol = 1.0e-06;
00020 
00021         bool rateFlag = true;
00022         bool chemFlag = false;
00023         bool logsFlag = false;
00024         double timeWeight = 1.0;
00025         double rateWeight = 0.0;
00026         double chemWeight = 0.0;
00027 
00028         m_dGammaSquared = 1.0e-07;
00029 
00030         const char* foundFileName;
00031 
00032         // fake experiment 1 - 1 free promoter, no mRNA or protein
00033         _networkList.push_back(new OneGeneInhibitoryNetwork());
00034         _experimentList.push_back(new Experiment(_networkList[0],"SmallNetwork"));
00035         // data files
00036         LocateInputFileDirectory locate1("smallOneGeneDS1.dat");
00037         foundFileName = locate1.Get("smallOneGeneDS1.dat");
00038         _experimentList[0]->AddDataFileToList(foundFileName);
00039         // mover and plotter
00040         _moverList.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol));
00041 
00042         // fake experiment 2 - 1 free promoter, no mRNA or protein
00043         _networkList.push_back(new OneGeneInhibitoryNetwork());
00044         _experimentList.push_back(new Experiment(_networkList[1],"SmallNetwork"));
00045         // data files
00046         LocateInputFileDirectory locate2("smallOneGeneDS2.dat");
00047         foundFileName = locate2.Get("smallOneGeneDS2.dat");
00048         _experimentList[1]->AddDataFileToList(foundFileName);
00049         // mover and plotter
00050         _moverList.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol));
00051 
00052         // minimizable
00053         _minimizableList.push_back(new SharedBFactorNetworkMinimizable());
00054         // parameters
00055         _minimizableList[0]->Initialize(_experimentList,_moverList,nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00056         _minimizableList[0]->SetRateConstantsWeight(0.0);
00057 
00058 /*      // attach observer
00059         m_vpPlotterList.push_back(new GnuPlotterTimeSeriesSharedBFactorObserver());
00060         // title
00061         m_vpPlotterList[0]->SetTitle("Small OGN:1 Free Promoter:ODE");
00062         _minimizableList[0]->Attach(m_vpPlotterList[0]);
00063 */
00064 
00065 
00066         // parameters which need a prior
00067         m_iPriorList.push_back(0);
00068         m_iPriorList.push_back(1);
00069         m_iPriorList.push_back(2);
00070         m_iPriorList.push_back(3);
00071         m_iPriorList.push_back(4);
00072         m_iPriorList.push_back(5);
00073 
00074 
00075 /*
00076         // fake experiment 2 - 1 free promoter, no mRNA or protein
00077         _networkList.push_back(new OneGeneInhibitoryNetwork());
00078         _experimentList.push_back(new Experiment(_networkList[1],"SmallNetwork"));
00079         // data files
00080         _experimentList[1]->AddDataFileToList("smallOneGeneDS2.dat");
00081         // mover and plotter
00082         _moverList.push_back(new CQualityControlCashKarpMover(frequency,stepSize,moveTol));
00083         // minimizable
00084         _minimizableList.push_back(new SharedBFactorNetworkMinimizable());
00085         // parameters
00086         _minimizableList[1]->Initialize(_experimentList[1],_moverList[1],nCells,rateFlag,chemFlag,logsFlag,timeWeight,rateWeight,chemWeight);
00087         _minimizableList[1]->SetRateConstantsWeight(0.0);
00088         // attach observer
00089 //      m_vpPlotterList.push_back(new GnuPlotterTimeSeriesObserver());
00090         // title
00091 //      m_vpPlotterList[1]->SetTitle("Small OGN2:1 Free Promoter:ODE");
00092 //      _minimizableList[1]->Attach(m_vpPlotterList[1]);
00093 
00094         // parameters which need a prior
00095 //      m_iPriorList.push_back(0);
00096 //      m_iPriorList.push_back(1);
00097 //      m_iPriorList.push_back(2);
00098 //      m_iPriorList.push_back(3);
00099 //      m_iPriorList.push_back(4);
00100 //      m_iPriorList.push_back(5);
00101 
00102 */
00103 
00104         // allocate the master residuals list
00105         int masterResidualsSize = 0;
00106         for(int i = 0; i < _minimizableList.size(); i++)
00107         {
00108                 int subRes = _minimizableList[i]->GetNResiduals();
00109                 masterResidualsSize += subRes;
00110                 cout << subRes << " residuals in minimizable " << i << endl;
00111         }
00112         // add residuals for prior parameter costs, if applicable
00113         masterResidualsSize += m_iPriorList.size();
00114         cout << m_iPriorList.size() << " parameters are constrained by a prior " << endl;
00115         if(m_dGammaSquared > 0.0)
00116         {
00117                 masterResidualsSize += 1;
00118         }
00119         Allocate(masterResidualsSize);
00120 
00121         cout << "Master Residuals size : " << masterResidualsSize << endl;
00122 
00123         // define the experiments
00124         DefineExperiments();
00125 
00126         // dump info about residuals
00127         //DumpResidualInfo();
00128 }
00129 
00130 COneGeneInhibitoryNetworkMinimizableDirector::~COneGeneInhibitoryNetworkMinimizableDirector()
00131 {
00132         for(int i = 0; i < m_vpPlotterList.size(); i++)
00133         {
00134                 _minimizableList[i]->Detach(m_vpPlotterList[i]);
00135                 delete m_vpPlotterList[i];
00136         }
00137 }
00138 
00139 void COneGeneInhibitoryNetworkMinimizableDirector::DefineExperiments()
00140 {
00141         // 1 free promoter region, no bound, no mRNA, no protein
00142         _minimizableList[0]->GetExperiment(0)->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.0);
00143         _minimizableList[0]->GetExperiment(0)->GetReactionNetwork()->GetChemical(0)->Reset();
00144         _minimizableList[0]->GetExperiment(0)->GetReactionNetwork()->GetChemical(1)->SetInitialAmount(0.0);
00145         _minimizableList[0]->GetExperiment(0)->GetReactionNetwork()->GetChemical(1)->Reset();
00146 
00147         // 1 free promoter region, no bound, no mRNA, no protein
00148         _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.0);
00149         _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->GetChemical(0)->Reset();
00150         _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->GetChemical(1)->SetInitialAmount(0.0);
00151         _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->GetChemical(1)->Reset();
00152 //      _minimizableList[0]->GetExperiment(1)->GetReactionNetwork()->RemoveReaction(2);
00153 
00154 /*
00155         // 1 free promoter region, no bound, no mRNA, no protein
00156         _minimizableList[1]->GetExperiment(1)->GetReactionNetwork()->GetChemical(0)->SetInitialAmount(1.0);
00157         _minimizableList[1]->GetExperiment(1)->GetReactionNetwork()->GetChemical(0)->Reset();
00158         _minimizableList[1]->GetExperiment(1)->GetReactionNetwork()->GetChemical(1)->SetInitialAmount(0.0);
00159         _minimizableList[1]->GetExperiment(1)->GetReactionNetwork()->GetChemical(1)->Reset();
00160 */
00161 }
00162 
00163 double COneGeneInhibitoryNetworkMinimizableDirector::GetParameter(int parIndex)
00164 {
00165         // Just return the first set (they are all the same)
00166         return _minimizableList[0]->GetParameter(parIndex);
00167 }
00168 
00169 int COneGeneInhibitoryNetworkMinimizableDirector::GetNParameters()
00170 {
00171         // Return the size of the first set (all have the same size)
00172         return _minimizableList[0]->GetNParameters();
00173 }
00174 

Generated on Mon Nov 3 09:38:04 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002