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

Generated by  doxygen 1.6.2