WntCellCycleModel.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 #include "WntCellCycleModel.hpp"
00029 
00030 WntCellCycleModel::WntCellCycleModel(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver)
00031     : AbstractWntOdeBasedCellCycleModel(pOdeSolver)
00032 {
00033     if (!mpOdeSolver)
00034     {
00035 #ifdef CHASTE_CVODE
00036         mpOdeSolver = CellCycleModelOdeSolver<WntCellCycleModel, CvodeAdaptor>::Instance();
00037         mpOdeSolver->Initialise();
00038         // Chaste solvers always check for stopping events, CVODE needs to be instructed to do so
00039         mpOdeSolver->CheckForStoppingEvents();
00040         mpOdeSolver->SetMaxSteps(10000);
00041 #else
00042         mpOdeSolver = CellCycleModelOdeSolver<WntCellCycleModel, RungeKutta4IvpOdeSolver>::Instance();
00043         mpOdeSolver->Initialise();
00044 #endif //CHASTE_CVODE
00045     }
00046 }
00047 
00048 AbstractCellCycleModel* WntCellCycleModel::CreateCellCycleModel()
00049 {
00050     // Create a new cell cycle model
00051     WntCellCycleModel* p_model = new WntCellCycleModel(mpOdeSolver);
00052 
00053     // Create the new cell cycle model's ODE system
00054     double wnt_level = GetWntLevel();
00055     p_model->SetOdeSystem(new WntCellCycleOdeSystem(wnt_level, mpCell->GetMutationState()));
00056 
00057     // Use the current values of the state variables in mpOdeSystem as an initial condition for the new cell cycle model's ODE system
00058     assert(mpOdeSystem);
00059     p_model->SetStateVariables(mpOdeSystem->rGetStateVariables());
00060 
00061     // Set the values of the new cell cycle model's member variables
00062     p_model->SetBirthTime(mBirthTime);
00063     p_model->SetLastTime(mLastTime);
00064     p_model->SetDivideTime(mDivideTime);
00065     p_model->SetFinishedRunningOdes(mFinishedRunningOdes);
00066     p_model->SetG2PhaseStartTime(mG2PhaseStartTime);
00067     p_model->SetDimension(mDimension);
00068     p_model->SetCellProliferativeType(mCellProliferativeType);
00069 
00070     return p_model;
00071 }
00072 
00073 void WntCellCycleModel::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel()
00074 {
00075     assert(mpOdeSystem != NULL);
00076     assert(mpCell != NULL);
00077     double beta_catenin_level = mpOdeSystem->rGetStateVariables()[6] + mpOdeSystem->rGetStateVariables()[7];
00078 
00079     CellProliferativeType cell_type = TRANSIT;
00080 
00081     // For mitogenic stimulus of 6x10^-4 in Wnt equations
00082     if (beta_catenin_level < 0.4127)
00083     {
00084         cell_type = DIFFERENTIATED;
00085     }
00086 
00087     mCellProliferativeType = cell_type;
00088 }
00089 
00090 void WntCellCycleModel::Initialise()
00091 {
00092     assert(mpOdeSystem == NULL);
00093     assert(mpCell != NULL);
00094     double wnt_level = GetWntLevel();
00095 
00096     mpOdeSystem = new WntCellCycleOdeSystem(wnt_level, mpCell->GetMutationState());
00097     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00098 
00099     ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00100 }
00101 
00102 void WntCellCycleModel::AdjustOdeParameters(double currentTime)
00103 {
00104     double wnt_level = GetWntLevel();
00105 
00106     // Pass this time step's Wnt stimulus into the solver as a constant over this timestep.
00107     mpOdeSystem->rGetStateVariables()[8] = wnt_level;
00108 
00109     // Use the cell's current mutation status as another input
00110     static_cast<WntCellCycleOdeSystem*>(mpOdeSystem)->SetMutationState(mpCell->GetMutationState());
00111 }
00112 
00113 // Serialization for Boost >= 1.36
00114 #include "SerializationExportWrapperForCpp.hpp"
00115 CHASTE_CLASS_EXPORT(WntCellCycleModel)
00116 #include "CellCycleModelOdeSolverExportWrapper.hpp"
00117 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(WntCellCycleModel)

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