WntCellCycleModel.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 #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     /*
00054      * Set each member variable of the new cell-cycle model that inherits
00055      * its value from the parent.
00056      * 
00057      * Note 1: some of the new cell-cycle model's member variables (namely
00058      * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide, mDt, mpOdeSolver)
00059      * will already have been correctly initialized in its constructor.
00060      * 
00061      * Note 2: one or more of the new cell-cycle model's member variables
00062      * may be set/overwritten as soon as InitialiseDaughterCell() is called on
00063      * the new cell-cycle model.
00064      */
00065     p_model->SetBirthTime(mBirthTime);
00066     p_model->SetDimension(mDimension);
00067     p_model->SetCellProliferativeType(mCellProliferativeType);
00068     p_model->SetMinimumGapDuration(mMinimumGapDuration);
00069     p_model->SetStemCellG1Duration(mStemCellG1Duration);
00070     p_model->SetTransitCellG1Duration(mTransitCellG1Duration);
00071     p_model->SetSDuration(mSDuration);
00072     p_model->SetG2Duration(mG2Duration);
00073     p_model->SetMDuration(mMDuration);
00074     p_model->SetDivideTime(mDivideTime);
00075     p_model->SetFinishedRunningOdes(mFinishedRunningOdes);
00076     p_model->SetG2PhaseStartTime(mG2PhaseStartTime);
00077     p_model->SetLastTime(mLastTime);
00078 
00079     /*
00080      * Create the new cell-cycle model's ODE system and use the current values
00081      * of the state variables in mpOdeSystem as an initial condition.
00082      */
00083     assert(mpOdeSystem);
00084     double wnt_level = GetWntLevel();
00085     p_model->SetOdeSystem(new WntCellCycleOdeSystem(wnt_level, mpCell->GetMutationState()));
00086     p_model->SetStateVariables(mpOdeSystem->rGetStateVariables());
00087 
00088     return p_model;
00089 }
00090 
00091 void WntCellCycleModel::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel()
00092 {
00093     assert(mpOdeSystem != NULL);
00094     assert(mpCell != NULL);
00095     double beta_catenin_level = mpOdeSystem->rGetStateVariables()[6] + mpOdeSystem->rGetStateVariables()[7];
00096 
00097     CellProliferativeType cell_type = TRANSIT;
00098 
00099     // For mitogenic stimulus of 6x10^-4 in Wnt equations
00100     if (beta_catenin_level < 0.4127)
00101     {
00102         cell_type = DIFFERENTIATED;
00103     }
00104 
00105     mCellProliferativeType = cell_type;
00106 }
00107 
00108 void WntCellCycleModel::Initialise()
00109 {
00110     assert(mpOdeSystem == NULL);
00111     assert(mpCell != NULL);
00112     double wnt_level = GetWntLevel();
00113 
00114     mpOdeSystem = new WntCellCycleOdeSystem(wnt_level, mpCell->GetMutationState());
00115     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00116 
00117     ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00118 }
00119 
00120 void WntCellCycleModel::AdjustOdeParameters(double currentTime)
00121 {
00122     double wnt_level = GetWntLevel();
00123 
00124     // Pass this time step's Wnt stimulus into the solver as a constant over this timestep.
00125     mpOdeSystem->rGetStateVariables()[8] = wnt_level;
00126 
00127     // Use the cell's current mutation status as another input
00128     static_cast<WntCellCycleOdeSystem*>(mpOdeSystem)->SetMutationState(mpCell->GetMutationState());
00129 }
00130 
00131 void WntCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile)
00132 {
00133     // No new parameters to output
00134 
00135     // Call method on direct parent class
00136     AbstractWntOdeBasedCellCycleModel::OutputCellCycleModelParameters(rParamsFile);
00137 }
00138 
00139 // Serialization for Boost >= 1.36
00140 #include "SerializationExportWrapperForCpp.hpp"
00141 CHASTE_CLASS_EXPORT(WntCellCycleModel)
00142 #include "CellCycleModelOdeSolverExportWrapper.hpp"
00143 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(WntCellCycleModel)

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