SingleOdeWntCellCycleModel.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2010
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     // Create the new cell cycle model's ODE system
00056     double wnt_level = this->GetWntLevel();
00057     p_model->SetOdeSystem(new Mirams2010WntOdeSystem(wnt_level, mpCell->GetMutationState()));
00058 
00059     // Use the current values of the state variables in mpOdeSystem as an initial condition for the new cell cycle model's ODE system
00060     assert(mpOdeSystem);
00061     p_model->SetStateVariables(mpOdeSystem->rGetStateVariables());
00062 
00063     // Set the values of the new cell cycle model's member variables
00064     p_model->SetCellProliferativeType(mCellProliferativeType);
00065     p_model->SetBirthTime(mBirthTime);
00066     p_model->SetLastTime(mLastTime);
00067     p_model->SetBetaCateninDivisionThreshold(mBetaCateninDivisionThreshold);
00068     p_model->SetDimension(mDimension);
00069 
00070     return p_model;
00071 }
00072 
00073 void SingleOdeWntCellCycleModel::UpdateCellCyclePhase()
00074 {
00075     assert(SimulationTime::Instance()->IsStartTimeSetUp());
00076     SolveOdeToTime(SimulationTime::Instance()->GetTime());
00077     ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00078     AbstractSimpleCellCycleModel::UpdateCellCyclePhase(); 
00079 }
00080 
00081 void SingleOdeWntCellCycleModel::Initialise()
00082 {
00083     assert(mpOdeSystem == NULL);
00084     assert(mpCell != NULL);
00085 
00086     double wnt_level = this->GetWntLevel();
00087     mpOdeSystem = new Mirams2010WntOdeSystem(wnt_level, mpCell->GetMutationState());
00088     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00089 
00090     // MAGIC NUMBER!
00091     mBetaCateninDivisionThreshold = 100.0;
00092 
00093     // This call actually sets up the G1 phase to something sensible (random number generated)
00094     SimpleWntCellCycleModel::Initialise();
00095 
00096     SetLastTime(mBirthTime);
00097 
00098     ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00099 }
00100 
00101 void SingleOdeWntCellCycleModel::AdjustOdeParameters(double currentTime)
00102 {
00103     // Pass this time step's Wnt stimulus into the solver as a constant over this timestep.
00104     mpOdeSystem->rGetStateVariables()[2] = this->GetWntLevel();
00105 
00106     // Use the cell's current mutation status as another input
00107     static_cast<Mirams2010WntOdeSystem*>(mpOdeSystem)->SetMutationState(mpCell->GetMutationState());
00108 }
00109 
00110 void SingleOdeWntCellCycleModel::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel()
00111 {
00112     assert(mpOdeSystem != NULL);
00113     assert(mpCell != NULL);
00114 
00115     CellProliferativeType cell_type = TRANSIT;
00116     if (GetBetaCateninConcentration() < GetBetaCateninDivisionThreshold())
00117     {
00118         cell_type = DIFFERENTIATED;
00119     }
00120 
00121     mCellProliferativeType = cell_type;
00122 }
00123 
00124 double SingleOdeWntCellCycleModel::GetBetaCateninConcentration()
00125 {
00126     return mpOdeSystem->rGetStateVariables()[0] + mpOdeSystem->rGetStateVariables()[1];
00127 }
00128 
00129 void SingleOdeWntCellCycleModel::SetBetaCateninDivisionThreshold(double betaCateninDivisionThreshold)
00130 {
00131     mBetaCateninDivisionThreshold = betaCateninDivisionThreshold;
00132 }
00133 
00134 double SingleOdeWntCellCycleModel::GetBetaCateninDivisionThreshold()
00135 {
00136     return mBetaCateninDivisionThreshold;
00137 }
00138 
00139 // Declare identifier for the serializer
00140 #include "SerializationExportWrapperForCpp.hpp"
00141 CHASTE_CLASS_EXPORT(SingleOdeWntCellCycleModel)
00142 #include "CellCycleModelOdeSolverExportWrapper.hpp"
00143 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(SingleOdeWntCellCycleModel)

Generated on Mon Nov 1 12:35:16 2010 for Chaste by  doxygen 1.5.5