Chaste Release::3.1
ContactInhibitionCellCycleModel.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 "ContactInhibitionCellCycleModel.hpp"
00037 #include "CellLabel.hpp"
00038 
00039 ContactInhibitionCellCycleModel::ContactInhibitionCellCycleModel()
00040     : AbstractSimpleCellCycleModel(),
00041       mQuiescentVolumeFraction(DOUBLE_UNSET),
00042       mEquilibriumVolume(DOUBLE_UNSET),
00043       mCurrentQuiescentOnsetTime(SimulationTime::Instance()->GetTime()),
00044       mCurrentQuiescentDuration(0.0)
00045 {
00046 }
00047 
00048 void ContactInhibitionCellCycleModel::UpdateCellCyclePhase()
00049 {
00050     if ((mQuiescentVolumeFraction == DOUBLE_UNSET) || (mEquilibriumVolume == DOUBLE_UNSET))
00051     {
00052         EXCEPTION("The member variables mQuiescentVolumeFraction and mEquilibriumVolume have not yet been set.");
00053     }
00054 
00055     // Get cell volume
00056     double cell_volume = mpCell->GetCellData()->GetItem("volume");
00057 
00058     // Removes the cell label
00059     mpCell->RemoveCellProperty<CellLabel>();
00060 
00061     if (mCurrentCellCyclePhase == G_ONE_PHASE)
00062     {
00063         // Update G1 duration based on cell volume
00064         double dt = SimulationTime::Instance()->GetTimeStep();
00065         double quiescent_volume = mEquilibriumVolume * mQuiescentVolumeFraction;
00066 
00067         if (cell_volume < quiescent_volume)
00068         {
00069             // Update the duration of the current period of contact inhibition.
00070             mCurrentQuiescentDuration = SimulationTime::Instance()->GetTime() - mCurrentQuiescentOnsetTime;
00071             mG1Duration += dt;
00072             mpCell->AddCellProperty(CellPropertyRegistry::Instance()->Get<CellLabel>());
00073         }
00074         else
00075         {
00076             // Reset the cell's quiescent duration and update the time at which the onset of quiescent occurs
00077             mCurrentQuiescentDuration = 0.0;
00078             mCurrentQuiescentOnsetTime = SimulationTime::Instance()->GetTime();
00079         }
00080     }
00081 
00082     double time_since_birth = GetAge();
00083     assert(time_since_birth >= 0);
00084 
00085     if (mpCell->GetCellProliferativeType()==DIFFERENTIATED)
00086     {
00087         mCurrentCellCyclePhase = G_ZERO_PHASE;
00088     }
00089     else if ( time_since_birth < GetMDuration() )
00090     {
00091         mCurrentCellCyclePhase = M_PHASE;
00092     }
00093     else if ( time_since_birth < GetMDuration() + mG1Duration)
00094     {
00095         mCurrentCellCyclePhase = G_ONE_PHASE;
00096     }
00097     else if ( time_since_birth < GetMDuration() + mG1Duration + GetSDuration())
00098     {
00099         mCurrentCellCyclePhase = S_PHASE;
00100     }
00101     else if ( time_since_birth < GetMDuration() + mG1Duration + GetSDuration() + GetG2Duration())
00102     {
00103         mCurrentCellCyclePhase = G_TWO_PHASE;
00104     }
00105 }
00106 
00107 AbstractCellCycleModel* ContactInhibitionCellCycleModel::CreateCellCycleModel()
00108 {
00109     // Create a new cell-cycle model
00110     ContactInhibitionCellCycleModel* p_model = new ContactInhibitionCellCycleModel();
00111 
00112     /*
00113      * Set each member variable of the new cell-cycle model that inherits
00114      * its value from the parent.
00115      *
00116      * Note 1: some of the new cell-cycle model's member variables (namely
00117      * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide, mTimeSpentInG1Phase,
00118      * mCurrentHypoxicDuration, mCurrentHypoxiaOnsetTime) will already have been
00119      * correctly initialized in its constructor.
00120      *
00121      * Note 2: one or more of the new cell-cycle model's member variables
00122      * may be set/overwritten as soon as InitialiseDaughterCell() is called on
00123      * the new cell-cycle model.
00124      */
00125     p_model->SetBirthTime(mBirthTime);
00126     p_model->SetDimension(mDimension);
00127     p_model->SetMinimumGapDuration(mMinimumGapDuration);
00128     p_model->SetStemCellG1Duration(mStemCellG1Duration);
00129     p_model->SetTransitCellG1Duration(mTransitCellG1Duration);
00130     p_model->SetSDuration(mSDuration);
00131     p_model->SetG2Duration(mG2Duration);
00132     p_model->SetMDuration(mMDuration);
00133     p_model->SetQuiescentVolumeFraction(mQuiescentVolumeFraction);
00134     p_model->SetEquilibriumVolume(mEquilibriumVolume);
00135     p_model->SetCurrentQuiescentOnsetTime(mCurrentQuiescentOnsetTime);
00136     p_model->SetCurrentQuiescentDuration(mCurrentQuiescentDuration);
00137 
00138     return p_model;
00139 }
00140 
00141 void ContactInhibitionCellCycleModel::SetQuiescentVolumeFraction(double quiescentVolumeFraction)
00142 {
00143     mQuiescentVolumeFraction = quiescentVolumeFraction;
00144 }
00145 
00146 double ContactInhibitionCellCycleModel::GetQuiescentVolumeFraction()
00147 {
00148     return mQuiescentVolumeFraction;
00149 }
00150 
00151 void ContactInhibitionCellCycleModel::SetEquilibriumVolume(double equilibriumVolume)
00152 {
00153     mEquilibriumVolume = equilibriumVolume;
00154 }
00155 
00156 double ContactInhibitionCellCycleModel::GetEquilibriumVolume()
00157 {
00158     return mEquilibriumVolume;
00159 }
00160 
00161 void ContactInhibitionCellCycleModel::SetCurrentQuiescentDuration(double currentQuiescentDuration)
00162 {
00163     mCurrentQuiescentDuration = currentQuiescentDuration;
00164 }
00165 
00166 double ContactInhibitionCellCycleModel::GetCurrentQuiescentDuration()
00167 {
00168     return mCurrentQuiescentDuration;
00169 }
00170 
00171 void ContactInhibitionCellCycleModel::SetCurrentQuiescentOnsetTime(double currentQuiescentOnsetTime)
00172 {
00173     mCurrentQuiescentOnsetTime = currentQuiescentOnsetTime;
00174 }
00175 
00176 double ContactInhibitionCellCycleModel::GetCurrentQuiescentOnsetTime()
00177 {
00178     return mCurrentQuiescentOnsetTime;
00179 }
00180 
00181 void ContactInhibitionCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile)
00182 {
00183     *rParamsFile << "\t\t\t<QuiescentVolumeFraction>" << mQuiescentVolumeFraction << "</QuiescentVolumeFraction>\n";
00184     *rParamsFile << "\t\t\t<EquilibriumVolume>" << mEquilibriumVolume << "</EquilibriumVolume>\n";
00185 
00186     // Call method on direct parent class
00187     AbstractSimpleCellCycleModel::OutputCellCycleModelParameters(rParamsFile);
00188 }
00189 
00190 // Serialization for Boost >= 1.36
00191 #include "SerializationExportWrapperForCpp.hpp"
00192 CHASTE_CLASS_EXPORT(ContactInhibitionCellCycleModel)