SingleOdeWntCellCycleModel.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 
00029 #include "UblasIncludes.hpp"
00030 #include "SingleOdeWntCellCycleModel.hpp"
00031 
00032 SingleOdeWntCellCycleModel::SingleOdeWntCellCycleModel(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver)
00033     : CellCycleModelOdeHandler(DOUBLE_UNSET, pOdeSolver)
00034 {
00035     if (mpOdeSolver == boost::shared_ptr<AbstractCellCycleModelOdeSolver>())
00036     {
00037 #ifdef CHASTE_CVODE
00038         mpOdeSolver = CellCycleModelOdeSolver<SingleOdeWntCellCycleModel, CvodeAdaptor>::Instance();
00039         mpOdeSolver->Initialise();
00040         mpOdeSolver->SetMaxSteps(10000);
00041 #else
00042         mpOdeSolver = CellCycleModelOdeSolver<SingleOdeWntCellCycleModel, RungeKutta4IvpOdeSolver>::Instance();
00043         mpOdeSolver->Initialise();
00044         SetDt(0.001);
00045 #endif //CHASTE_CVODE
00046     }
00047     assert(mpOdeSolver->IsSetUp());
00048 }
00049 
00050 AbstractCellCycleModel* SingleOdeWntCellCycleModel::CreateCellCycleModel()
00051 {
00052     // Create a new cell-cycle model
00053     SingleOdeWntCellCycleModel* p_model = new SingleOdeWntCellCycleModel(this->mpOdeSolver);
00054 
00055     /*
00056      * Set each member variable of the new cell-cycle model that inherits
00057      * its value from the parent.
00058      * 
00059      * Note 1: some of the new cell-cycle model's member variables (namely
00060      * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide, mDt, mpOdeSolver)
00061      * will already have been correctly initialized in its constructor.
00062      * 
00063      * Note 2: one or more of the new cell-cycle model's member variables
00064      * may be set/overwritten as soon as InitialiseDaughterCell() is called on
00065      * the new cell-cycle model.
00066      */
00067     p_model->SetBirthTime(mBirthTime);
00068     p_model->SetDimension(mDimension);
00069     p_model->SetCellProliferativeType(mCellProliferativeType);
00070     p_model->SetMinimumGapDuration(mMinimumGapDuration);
00071     p_model->SetStemCellG1Duration(mStemCellG1Duration);
00072     p_model->SetTransitCellG1Duration(mTransitCellG1Duration);
00073     p_model->SetSDuration(mSDuration);
00074     p_model->SetG2Duration(mG2Duration);
00075     p_model->SetMDuration(mMDuration);
00076     p_model->SetUseCellProliferativeTypeDependentG1Duration(mUseCellProliferativeTypeDependentG1Duration);
00077     p_model->SetWntStemThreshold(mWntStemThreshold);
00078     p_model->SetWntTransitThreshold(mWntTransitThreshold);
00079     p_model->SetWntLabelledThreshold(mWntLabelledThreshold);
00080     p_model->SetLastTime(mLastTime);
00081     p_model->SetBetaCateninDivisionThreshold(mBetaCateninDivisionThreshold);
00082 
00083     /*
00084      * Create the new cell-cycle model's ODE system and use the current values
00085      * of the state variables in mpOdeSystem as an initial condition.
00086      */
00087     assert(mpOdeSystem);
00088     double wnt_level = this->GetWntLevel();
00089     p_model->SetOdeSystem(new Mirams2010WntOdeSystem(wnt_level, mpCell->GetMutationState()));
00090     p_model->SetStateVariables(mpOdeSystem->rGetStateVariables());
00091 
00092     return p_model;
00093 }
00094 
00095 void SingleOdeWntCellCycleModel::UpdateCellCyclePhase()
00096 {
00097     assert(SimulationTime::Instance()->IsStartTimeSetUp());
00098     SolveOdeToTime(SimulationTime::Instance()->GetTime());
00099     ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00100     AbstractSimpleCellCycleModel::UpdateCellCyclePhase(); 
00101 }
00102 
00103 void SingleOdeWntCellCycleModel::Initialise()
00104 {
00105     assert(mpOdeSystem == NULL);
00106     assert(mpCell != NULL);
00107 
00108     double wnt_level = this->GetWntLevel();
00109     mpOdeSystem = new Mirams2010WntOdeSystem(wnt_level, mpCell->GetMutationState());
00110     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00111 
00112     // MAGIC NUMBER!
00113     mBetaCateninDivisionThreshold = 100.0;
00114 
00115     // This call actually sets up the G1 phase to something sensible (random number generated)
00116     SimpleWntCellCycleModel::Initialise();
00117 
00118     SetLastTime(mBirthTime);
00119 
00120     ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00121 }
00122 
00123 void SingleOdeWntCellCycleModel::AdjustOdeParameters(double currentTime)
00124 {
00125     // Pass this time step's Wnt stimulus into the solver as a constant over this timestep.
00126     mpOdeSystem->rGetStateVariables()[2] = this->GetWntLevel();
00127 
00128     // Use the cell's current mutation status as another input
00129     static_cast<Mirams2010WntOdeSystem*>(mpOdeSystem)->SetMutationState(mpCell->GetMutationState());
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     mCellProliferativeType = 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 void SingleOdeWntCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile)
00162 {
00163     // No new parameters to output
00164 
00165     // Call method on direct parent class
00166     SimpleWntCellCycleModel::OutputCellCycleModelParameters(rParamsFile);
00167 }
00168 
00169 // Declare identifier for the serializer
00170 #include "SerializationExportWrapperForCpp.hpp"
00171 CHASTE_CLASS_EXPORT(SingleOdeWntCellCycleModel)
00172 #include "CellCycleModelOdeSolverExportWrapper.hpp"
00173 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(SingleOdeWntCellCycleModel)

Generated on Mon Apr 18 11:35:28 2011 for Chaste by  doxygen 1.5.5