SingleOdeWntCellCycleModel.cpp
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 "UblasIncludes.hpp"
00029 #include "SingleOdeWntCellCycleModel.hpp"
00030
00031 #ifdef CHASTE_CVODE
00032 CvodeAdaptor SingleOdeWntCellCycleModel::msSolver;
00033 #else
00034 RungeKutta4IvpOdeSolver SingleOdeWntCellCycleModel::msSolver;
00035 #endif //CHASTE_CVODE
00036
00037 SingleOdeWntCellCycleModel::~SingleOdeWntCellCycleModel()
00038 {
00039 delete mpOdeSystem;
00040 }
00041
00042 AbstractCellCycleModel* SingleOdeWntCellCycleModel::CreateCellCycleModel()
00043 {
00044 return new SingleOdeWntCellCycleModel(*this);
00045 }
00046
00047 SingleOdeWntCellCycleModel::SingleOdeWntCellCycleModel(const SingleOdeWntCellCycleModel& rOtherModel)
00048 : SimpleWntCellCycleModel(rOtherModel),
00049 mpOdeSystem(NULL)
00050 {
00051 mBetaCateninDivisionThreshold = rOtherModel.mBetaCateninDivisionThreshold;
00052 mLastTime = rOtherModel.mLastTime;
00053 if (rOtherModel.mpOdeSystem != NULL)
00054 {
00055 mpOdeSystem = new Mirams2010WntOdeSystem(*static_cast<Mirams2010WntOdeSystem*>(rOtherModel.mpOdeSystem));
00056 }
00057 }
00058
00059 void SingleOdeWntCellCycleModel::UpdateCellCyclePhase()
00060 {
00061 assert(SimulationTime::Instance()->IsStartTimeSetUp());
00062 UpdateBetaCateninLevel();
00063 ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00064 AbstractSimpleCellCycleModel::UpdateCellCyclePhase();
00065 }
00066
00067
00068 SingleOdeWntCellCycleModel::SingleOdeWntCellCycleModel(std::vector<double>& rParentProteinConcentrations,
00069 boost::shared_ptr<AbstractCellMutationState> pMutationState,
00070 unsigned& rDimension,
00071 bool useTypeDependentG1)
00072 : mLastTime(DBL_MAX)
00073 {
00074 SetDimension(rDimension),
00075 SetUseCellProliferativeTypeDependentG1Duration(useTypeDependentG1);
00076 #ifdef CHASTE_CVODE
00077 msSolver.SetMaxSteps(10000);
00078 #endif // CHASTE_CVODE
00079
00080 mpOdeSystem = new Mirams2010WntOdeSystem(rParentProteinConcentrations[2], pMutationState);
00081 mpOdeSystem->rGetStateVariables() = rParentProteinConcentrations;
00082 }
00083
00084
00085 void SingleOdeWntCellCycleModel::Initialise()
00086 {
00087 assert(mpOdeSystem == NULL);
00088 assert(mpCell != NULL);
00089
00090 double wnt_level = this->GetWntLevel();
00091 mpOdeSystem = new Mirams2010WntOdeSystem(wnt_level, mpCell->GetMutationState());
00092 mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00093
00094
00095 mBetaCateninDivisionThreshold = 100.0;
00096
00097
00098 SimpleWntCellCycleModel::Initialise();
00099
00100 mLastTime = mBirthTime;
00101
00102 ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00103 }
00104
00105 void SingleOdeWntCellCycleModel::UpdateBetaCateninLevel()
00106 {
00107 assert(mpOdeSystem!=NULL);
00108 assert(mpCell!=NULL);
00109 assert(mLastTime < DBL_MAX - 1e5);
00110
00111
00112 #ifdef CHASTE_CVODE
00113 const double dt = SimulationTime::Instance()->GetTimeStep();
00114 #else
00115 double dt = 0.001;
00116 #endif // CHASTE_CVODE
00117
00118
00119 mpOdeSystem->rGetStateVariables()[2] = this->GetWntLevel();
00120
00121
00122 static_cast<Mirams2010WntOdeSystem*>(mpOdeSystem)->SetMutationState(mpCell->GetMutationState());
00123
00124 double current_time = SimulationTime::Instance()->GetTime();
00125 if (mLastTime < current_time)
00126 {
00127 msSolver.SolveAndUpdateStateVariable(mpOdeSystem, mLastTime, current_time, dt);
00128 mLastTime = current_time;
00129 }
00130 }
00131
00132 void SingleOdeWntCellCycleModel::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel()
00133 {
00134 assert(mpOdeSystem!=NULL);
00135 assert(mpCell!=NULL);
00136
00137 CellProliferativeType cell_type = TRANSIT;
00138 if (GetBetaCateninConcentration() < GetBetaCateninDivisionThreshold())
00139 {
00140 cell_type = DIFFERENTIATED;
00141 }
00142
00143 mpCell->SetCellProliferativeType(cell_type);
00144 }
00145
00146 double SingleOdeWntCellCycleModel::GetBetaCateninConcentration()
00147 {
00148 return mpOdeSystem->rGetStateVariables()[0] + mpOdeSystem->rGetStateVariables()[1];
00149 }
00150
00151 void SingleOdeWntCellCycleModel::SetBetaCateninDivisionThreshold(double betaCateninDivisionThreshold)
00152 {
00153 mBetaCateninDivisionThreshold = betaCateninDivisionThreshold;
00154 }
00155
00156 double SingleOdeWntCellCycleModel::GetBetaCateninDivisionThreshold()
00157 {
00158 return mBetaCateninDivisionThreshold;
00159 }
00160
00161
00162 #include "SerializationExportWrapperForCpp.hpp"
00163 CHASTE_CLASS_EXPORT(SingleOdeWntCellCycleModel)