WntCellCycleModel.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
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(const WntCellCycleModel& rOtherModel)
00031     : AbstractWntOdeBasedCellCycleModel(rOtherModel)
00032 {
00033     if (rOtherModel.mpOdeSystem != NULL)
00034     {
00035         mpOdeSystem = new WntCellCycleOdeSystem(*static_cast<WntCellCycleOdeSystem*>(rOtherModel.mpOdeSystem));
00036     }
00037 }
00038 
00039 
00040 
00041 WntCellCycleModel::WntCellCycleModel(const std::vector<double>& rParentProteinConcentrations,
00042                                      const CellMutationState& rMutationState,
00043                                      const unsigned& rDimension)
00044     : AbstractWntOdeBasedCellCycleModel(rDimension)
00045 {
00046     mpOdeSystem = new WntCellCycleOdeSystem(rParentProteinConcentrations[8], rMutationState); // Wnt pathway is reset in a couple of lines
00047 
00048     // Set the initial conditions to be the same as the parent cell
00049     mpOdeSystem->rGetStateVariables() = rParentProteinConcentrations;
00050 }
00051 
00052 
00053 AbstractCellCycleModel* WntCellCycleModel::CreateCellCycleModel()
00054 {
00055     return new WntCellCycleModel(*this);
00056 }
00057 
00058 
00059 void WntCellCycleModel::ChangeCellTypeDueToCurrentBetaCateninLevel()
00060 {
00061     assert(mpOdeSystem!=NULL);
00062     assert(mpCell!=NULL);
00063     double beta_catenin_level = mpOdeSystem->rGetStateVariables()[6] + mpOdeSystem->rGetStateVariables()[7];
00064 
00065     CellType cell_type = TRANSIT;
00066 
00067     // For mitogenic stimulus of 6x10^-4 in Wnt equations
00068     if (beta_catenin_level < 0.4127)
00069     {
00070         cell_type = DIFFERENTIATED;
00071     }
00072 
00073     mpCell->SetCellType(cell_type);
00074 }
00075 
00076 
00077 void WntCellCycleModel::Initialise()
00078 {
00079     assert(mpOdeSystem == NULL);
00080     assert(mpCell != NULL);
00081 
00082     double wnt_level = GetWntLevel();
00083 
00084     mpOdeSystem = new WntCellCycleOdeSystem(wnt_level, mpCell->GetMutationState());
00085     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00086 
00087     ChangeCellTypeDueToCurrentBetaCateninLevel();
00088 }
00089 
00090 
00091 bool WntCellCycleModel::SolveOdeToTime(double currentTime)
00092 {
00093     // We are in G0 or G1 phase - running cell cycle ODEs
00094 #ifdef CHASTE_CVODE
00095     const double dt = SimulationTime::Instance()->GetTimeStep();
00096 #else
00097     double dt = 0.0001; // Needs to be this precise to stop crazy errors whilst we are still using rk4.
00098 #endif // CHASTE_CVODE
00099 
00100     double wnt_level = GetWntLevel();
00101 
00102     // Pass this time step's Wnt stimulus into the solver as a constant over this timestep.
00103     mpOdeSystem->rGetStateVariables()[8] = wnt_level;
00104 
00105     // Use the cell's current mutation status as another input
00106     static_cast<WntCellCycleOdeSystem*>(mpOdeSystem)->SetMutationState(mpCell->GetMutationState());
00107 
00108     msSolver.SolveAndUpdateStateVariable(mpOdeSystem, mLastTime, currentTime, dt);
00109 
00110     mLastTime = currentTime;// normally done in Abstract class, but no harm in doing it here to prevent following line throwing an error.
00111     UpdateCellType();
00112     return msSolver.StoppingEventOccurred();
00113 }

Generated on Tue Aug 4 16:10:21 2009 for Chaste by  doxygen 1.5.5