Chaste Release::3.1
AbstractCellCycleModel.cpp
00001 /*
00002 
00003 Copyright (c) 2005-2012, University of Oxford.
00004 All rights reserved.
00005 
00006 University of Oxford means the Chancellor, Masters and Scholars of the
00007 University of Oxford, having an administrative office at Wellington
00008 Square, Oxford OX1 2JD, UK.
00009 
00010 This file is part of Chaste.
00011 
00012 Redistribution and use in source and binary forms, with or without
00013 modification, are permitted provided that the following conditions are met:
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019  * Neither the name of the University of Oxford nor the names of its
00020    contributors may be used to endorse or promote products derived from this
00021    software without specific prior written permission.
00022 
00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 
00034 */
00035 
00036 #include "AbstractCellCycleModel.hpp"
00037 
00038 AbstractCellCycleModel::AbstractCellCycleModel()
00039     : mBirthTime(SimulationTime::Instance()->GetTime()),
00040       mCurrentCellCyclePhase(M_PHASE),
00041       mG1Duration(DOUBLE_UNSET),
00042       mReadyToDivide(false),
00043       mDimension(UNSIGNED_UNSET),
00044       mMinimumGapDuration(0.01), // an educated guess
00045       // Default parameter values all have units of hours.
00046       mStemCellG1Duration(14.0),
00047       mTransitCellG1Duration(2.0),
00048       mSDuration(5.0),               // apparently between 5-6 hours normally
00049       mG2Duration(4.0),              // apparently 3-4 hours normally
00050       mMDuration(1.0)               // taken from Meineke et al, 2001 (doi:10.1046/j.0960-7722.2001.00216.x)
00051 {
00052 }
00053 
00054 AbstractCellCycleModel::~AbstractCellCycleModel()
00055 {
00056 }
00057 
00058 void AbstractCellCycleModel::Initialise()
00059 {
00060 }
00061 
00062 void AbstractCellCycleModel::InitialiseDaughterCell()
00063 {
00064 }
00065 
00066 void AbstractCellCycleModel::SetCell(CellPtr pCell)
00067 {
00068     mpCell = pCell;
00069 }
00070 
00071 CellPtr AbstractCellCycleModel::GetCell()
00072 {
00073     assert(mpCell != NULL);
00074     return mpCell;
00075 }
00076 
00077 void AbstractCellCycleModel::SetBirthTime(double birthTime)
00078 {
00079     mBirthTime = birthTime;
00080 }
00081 
00082 double AbstractCellCycleModel::GetBirthTime() const
00083 {
00084     return mBirthTime;
00085 }
00086 
00087 double AbstractCellCycleModel::GetAge()
00088 {
00089     return SimulationTime::Instance()->GetTime() - mBirthTime;
00090 }
00091 
00092 CellCyclePhase AbstractCellCycleModel::GetCurrentCellCyclePhase()
00093 {
00094     return mCurrentCellCyclePhase;
00095 }
00096 
00097 void AbstractCellCycleModel::ResetForDivision()
00098 {
00099     assert(mReadyToDivide);
00100     mCurrentCellCyclePhase = M_PHASE;
00101     mReadyToDivide = false;
00102 }
00103 
00104 double AbstractCellCycleModel::GetG1Duration()
00105 {
00106     return mG1Duration;
00107 }
00108 
00110 // Getter methods
00112 
00113 double AbstractCellCycleModel::GetStemCellG1Duration()
00114 {
00115     return mStemCellG1Duration;
00116 }
00117 
00118 double AbstractCellCycleModel::GetTransitCellG1Duration()
00119 {
00120     return mTransitCellG1Duration;
00121 }
00122 
00123 double AbstractCellCycleModel::GetSG2MDuration()
00124 {
00125     return mSDuration + mG2Duration + mMDuration;
00126 }
00127 
00128 double AbstractCellCycleModel::GetSDuration()
00129 {
00130     return mSDuration;
00131 }
00132 
00133 double AbstractCellCycleModel::GetG2Duration()
00134 {
00135     return mG2Duration;
00136 }
00137 
00138 double AbstractCellCycleModel::GetMDuration()
00139 {
00140     return mMDuration;
00141 }
00142 
00144 // Setter methods
00146 
00147 void AbstractCellCycleModel::SetStemCellG1Duration(double stemCellG1Duration)
00148 {
00149     assert(stemCellG1Duration > 0.0);
00150     mStemCellG1Duration = stemCellG1Duration;
00151 }
00152 void AbstractCellCycleModel::SetTransitCellG1Duration(double transitCellG1Duration)
00153 {
00154     assert(transitCellG1Duration > 0.0);
00155     mTransitCellG1Duration = transitCellG1Duration;
00156 }
00157 void AbstractCellCycleModel::SetSDuration(double SDuration)
00158 {
00159     assert(SDuration > 0.0);
00160     mSDuration = SDuration;
00161 }
00162 void AbstractCellCycleModel::SetG2Duration(double G2Duration)
00163 {
00164     assert(G2Duration > 0.0);
00165     mG2Duration = G2Duration;
00166 }
00167 void AbstractCellCycleModel::SetMDuration(double MDuration)
00168 {
00169     assert(MDuration > 0.0);
00170     mMDuration = MDuration;
00171 }
00172 
00173 bool AbstractCellCycleModel::ReadyToDivide()
00174 {
00175     assert(mpCell != NULL);
00176 
00177     if (!mReadyToDivide)
00178     {
00179         UpdateCellCyclePhase();
00180         if ( (mCurrentCellCyclePhase != G_ZERO_PHASE) &&
00181              (GetAge() >= GetMDuration() + GetG1Duration() + GetSDuration() + GetG2Duration()) )
00182         {
00183             mReadyToDivide = true;
00184         }
00185     }
00186     return mReadyToDivide;
00187 }
00188 
00189 void AbstractCellCycleModel::SetDimension(unsigned dimension)
00190 {
00191     if (dimension != 1 && dimension !=2 && dimension != 3)
00192     {
00193         EXCEPTION("Dimension must be 1, 2 or 3");
00194     }
00195     mDimension = dimension;
00196 }
00197 
00198 unsigned AbstractCellCycleModel::GetDimension()
00199 {
00200     return mDimension;
00201 }
00202 
00203 double AbstractCellCycleModel::GetAverageTransitCellCycleTime()
00204 {
00205     return mTransitCellG1Duration + GetSG2MDuration();
00206 }
00207 
00208 double AbstractCellCycleModel::GetAverageStemCellCycleTime()
00209 {
00210     return mStemCellG1Duration + GetSG2MDuration();
00211 }
00212 
00213 bool AbstractCellCycleModel::CanCellTerminallyDifferentiate()
00214 {
00215     return true;
00216 }
00217 
00218 void AbstractCellCycleModel::SetMinimumGapDuration(double minimumGapDuration)
00219 {
00220     assert(minimumGapDuration > 0.0);
00221     mMinimumGapDuration = minimumGapDuration;
00222 }
00223 
00224 double AbstractCellCycleModel::GetMinimumGapDuration()
00225 {
00226     return mMinimumGapDuration;
00227 }
00228 
00229 void AbstractCellCycleModel::OutputCellCycleModelInfo(out_stream& rParamsFile)
00230 {
00231     std::string cell_cycle_model_type = GetIdentifier();
00232 
00233     *rParamsFile << "\t\t<" << cell_cycle_model_type << ">\n";
00234     OutputCellCycleModelParameters(rParamsFile);
00235     *rParamsFile << "\t\t</" << cell_cycle_model_type << ">\n";
00236 }
00237 
00238 void AbstractCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile)
00239 {
00240     *rParamsFile << "\t\t\t<StemCellG1Duration>" << mStemCellG1Duration << "</StemCellG1Duration>\n";
00241     *rParamsFile << "\t\t\t<TransitCellG1Duration>" << mTransitCellG1Duration << "</TransitCellG1Duration>\n";
00242     *rParamsFile << "\t\t\t<SDuration>" << mSDuration << "</SDuration>\n";
00243     *rParamsFile << "\t\t\t<G2Duration>" << mG2Duration << "</G2Duration>\n";
00244     *rParamsFile << "\t\t\t<MDuration>" << mMDuration << "</MDuration>\n";
00245 }