00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "WntCellCycleModel.hpp"
00029
00030
00031 WntCellCycleModel::WntCellCycleModel(AbstractOdeSystem* pParentOdeSystem,
00032 const CellMutationState& rMutationState,
00033 double birthTime,
00034 double lastTime,
00035 bool inSG2MPhase,
00036 bool readyToDivide,
00037 double divideTime)
00038 : AbstractWntOdeBasedCellCycleModel(lastTime)
00039 {
00040 if (pParentOdeSystem != NULL)
00041 {
00042 std::vector<double> parent_protein_concs = pParentOdeSystem->rGetStateVariables();
00043 mpOdeSystem = new WntCellCycleOdeSystem(parent_protein_concs[8], rMutationState);
00044
00045
00046 mpOdeSystem->rGetStateVariables() = parent_protein_concs;
00047 }
00048 else
00049 {
00050 mpOdeSystem = NULL;
00051 }
00052
00053 if (SimulationTime::Instance()->IsStartTimeSetUp()==false)
00054 {
00055 #define COVERAGE_IGNORE
00056 EXCEPTION("WntCellCycleModel is being created but SimulationTime has not been set up");
00057 #undef COVERAGE_IGNORE
00058 }
00059 mBirthTime = birthTime;
00060 mFinishedRunningOdes = inSG2MPhase;
00061 mReadyToDivide = readyToDivide;
00062 mDivideTime = divideTime;
00063 }
00064
00065
00066 WntCellCycleModel::WntCellCycleModel(const std::vector<double>& rParentProteinConcentrations,
00067 const CellMutationState& rMutationState)
00068 {
00069 mpOdeSystem = new WntCellCycleOdeSystem(rParentProteinConcentrations[8], rMutationState);
00070
00071
00072 mpOdeSystem->rGetStateVariables() = rParentProteinConcentrations;
00073 }
00074
00075
00076 AbstractCellCycleModel* WntCellCycleModel::CreateDaughterCellCycleModel()
00077 {
00078 assert(mpCell!=NULL);
00079
00080
00081
00082
00083
00084
00085 return new WntCellCycleModel(mpOdeSystem,
00086 mpCell->GetMutationState(),
00087 mBirthTime,
00088 mLastTime,
00089 mFinishedRunningOdes,
00090 mReadyToDivide,
00091 mDivideTime);
00092 }
00093
00094
00095 void WntCellCycleModel::ChangeCellTypeDueToCurrentBetaCateninLevel()
00096 {
00097 assert(mpOdeSystem!=NULL);
00098 assert(mpCell!=NULL);
00099 double beta_catenin_level = mpOdeSystem->rGetStateVariables()[6] + mpOdeSystem->rGetStateVariables()[7];
00100
00101 CellType cell_type=TRANSIT;
00102
00103
00104 if (beta_catenin_level < 0.4127)
00105 {
00106 cell_type = DIFFERENTIATED;
00107 }
00108
00109 mpCell->SetCellType(cell_type);
00110 }
00111
00112
00113 void WntCellCycleModel::Initialise()
00114 {
00115 assert(mpOdeSystem==NULL);
00116 assert(mpCell!=NULL);
00117 mpOdeSystem = new WntCellCycleOdeSystem(WntConcentration::Instance()->GetWntLevel(mpCell), mpCell->GetMutationState());
00118 mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00119 ChangeCellTypeDueToCurrentBetaCateninLevel();
00120 }
00121
00122
00123 bool WntCellCycleModel::SolveOdeToTime(double currentTime)
00124 {
00125
00126 #ifdef CHASTE_CVODE
00127 const double dt = SimulationTime::Instance()->GetTimeStep();
00128 #else
00129 double dt = 0.0001;
00130 #endif // CHASTE_CVODE
00131
00132
00133 mpOdeSystem->rGetStateVariables()[8] = WntConcentration::Instance()->GetWntLevel(mpCell);
00134
00135
00136 static_cast<WntCellCycleOdeSystem*>(mpOdeSystem)->SetMutationState(mpCell->GetMutationState());
00137
00138 msSolver.SolveAndUpdateStateVariable(mpOdeSystem, mLastTime, currentTime, dt);
00139
00140 mLastTime = currentTime;
00141 UpdateCellType();
00142 return msSolver.StoppingEventOccurred();
00143 }