Chaste Release::3.1
SimpleOxygenBasedCellCycleModel.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 "SimpleOxygenBasedCellCycleModel.hpp"
00037 #include "RandomNumberGenerator.hpp"
00038 #include "ApoptoticCellProperty.hpp"
00039 #include "CellPropertyRegistry.hpp"
00040 #include "Exception.hpp"
00041 
00042 SimpleOxygenBasedCellCycleModel::SimpleOxygenBasedCellCycleModel()
00043     : mCurrentHypoxicDuration(0.0),
00044       mHypoxicConcentration(0.4),
00045       mQuiescentConcentration(1.0),
00046       mCriticalHypoxicDuration(2.0)
00047 {
00048     mCurrentHypoxiaOnsetTime = SimulationTime::Instance()->GetTime();
00049 }
00050 
00051 double SimpleOxygenBasedCellCycleModel::GetCurrentHypoxicDuration()
00052 {
00053     return mCurrentHypoxicDuration;
00054 }
00055 
00056 double SimpleOxygenBasedCellCycleModel::GetCurrentHypoxiaOnsetTime()
00057 {
00058     return mCurrentHypoxiaOnsetTime;
00059 }
00060 
00061 void SimpleOxygenBasedCellCycleModel::UpdateCellCyclePhase()
00062 {
00063     // mG1Duration is set when the cell-cycle model is given a cell
00064 
00065     bool cell_is_apoptotic = mpCell->HasCellProperty<ApoptoticCellProperty>();
00066 
00067     if (!cell_is_apoptotic)
00068     {
00069         UpdateHypoxicDuration();
00070 
00071         // Get cell's oxygen concentration
00072         double oxygen_concentration = mpCell->GetCellData()->GetItem("oxygen");
00073 
00074         AbstractSimpleCellCycleModel::UpdateCellCyclePhase();
00075 
00076         if (mCurrentCellCyclePhase == G_ONE_PHASE)
00077         {
00078             // Update G1 duration based on oxygen concentration
00079             double dt = SimulationTime::Instance()->GetTimeStep();
00080 
00081             if (oxygen_concentration < mQuiescentConcentration)
00082             {
00083                 mG1Duration += (1 - std::max(oxygen_concentration, 0.0)/mQuiescentConcentration)*dt;
00084             }
00085         }
00086     }
00087 }
00088 
00089 AbstractCellCycleModel* SimpleOxygenBasedCellCycleModel::CreateCellCycleModel()
00090 {
00091     // Create a new cell-cycle model
00092     SimpleOxygenBasedCellCycleModel* p_model = new SimpleOxygenBasedCellCycleModel();
00093 
00094     /*
00095      * Set each member variable of the new cell-cycle model that inherits
00096      * its value from the parent.
00097      *
00098      * Note 1: some of the new cell-cycle model's member variables (namely
00099      * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide,
00100      * mCurrentHypoxicDuration, mCurrentHypoxiaOnsetTime) will already have been
00101      * correctly initialized in its constructor.
00102      *
00103      * Note 2: one or more of the new cell-cycle model's member variables
00104      * may be set/overwritten as soon as InitialiseDaughterCell() is called on
00105      * the new cell-cycle model.
00106      */
00107     p_model->SetBirthTime(mBirthTime);
00108     p_model->SetDimension(mDimension);
00109     p_model->SetMinimumGapDuration(mMinimumGapDuration);
00110     p_model->SetStemCellG1Duration(mStemCellG1Duration);
00111     p_model->SetTransitCellG1Duration(mTransitCellG1Duration);
00112     p_model->SetSDuration(mSDuration);
00113     p_model->SetG2Duration(mG2Duration);
00114     p_model->SetMDuration(mMDuration);
00115     p_model->SetHypoxicConcentration(mHypoxicConcentration);
00116     p_model->SetQuiescentConcentration(mQuiescentConcentration);
00117     p_model->SetCriticalHypoxicDuration(mCriticalHypoxicDuration);
00118     p_model->SetCurrentHypoxiaOnsetTime(mCurrentHypoxiaOnsetTime);
00119 
00120     return p_model;
00121 }
00122 
00123 void SimpleOxygenBasedCellCycleModel::UpdateHypoxicDuration()
00124 {
00125     assert(!(mpCell->HasCellProperty<ApoptoticCellProperty>()));
00126     assert(!mpCell->HasApoptosisBegun());
00127 
00128     // Get cell's oxygen concentration
00129     double oxygen_concentration = mpCell->GetCellData()->GetItem("oxygen");
00130 
00131     if (oxygen_concentration < mHypoxicConcentration)
00132     {
00133         // Update the duration of the current period of hypoxia
00134         mCurrentHypoxicDuration = (SimulationTime::Instance()->GetTime() - mCurrentHypoxiaOnsetTime);
00135 
00136         // Include a little bit of stochasticity here
00137         double prob_of_death = 0.9 - 0.5*(oxygen_concentration/mHypoxicConcentration);
00138         if (mCurrentHypoxicDuration > mCriticalHypoxicDuration && RandomNumberGenerator::Instance()->ranf() < prob_of_death)
00139         {
00140             mpCell->AddCellProperty(CellPropertyRegistry::Instance()->Get<ApoptoticCellProperty>());
00141         }
00142     }
00143     else
00144     {
00145         // Reset the cell's hypoxic duration and update the time at which the onset of hypoxia occurs
00146         mCurrentHypoxicDuration = 0.0;
00147         mCurrentHypoxiaOnsetTime = SimulationTime::Instance()->GetTime();
00148     }
00149 }
00150 
00151 double SimpleOxygenBasedCellCycleModel::GetHypoxicConcentration()
00152 {
00153     return mHypoxicConcentration;
00154 }
00155 
00156 void SimpleOxygenBasedCellCycleModel::SetHypoxicConcentration(double hypoxicConcentration)
00157 {
00158     assert(hypoxicConcentration<=1.0);
00159     assert(hypoxicConcentration>=0.0);
00160     mHypoxicConcentration = hypoxicConcentration;
00161 }
00162 
00163 double SimpleOxygenBasedCellCycleModel::GetQuiescentConcentration()
00164 {
00165     return mQuiescentConcentration;
00166 }
00167 
00168 void SimpleOxygenBasedCellCycleModel::SetQuiescentConcentration(double quiescentConcentration)
00169 {
00170     assert(quiescentConcentration <= 1.0);
00171     assert(quiescentConcentration >= 0.0);
00172     mQuiescentConcentration = quiescentConcentration;
00173 }
00174 
00175 double SimpleOxygenBasedCellCycleModel::GetCriticalHypoxicDuration()
00176 {
00177     return mCriticalHypoxicDuration;
00178 }
00179 
00180 void SimpleOxygenBasedCellCycleModel::SetCriticalHypoxicDuration(double criticalHypoxicDuration)
00181 {
00182     assert(criticalHypoxicDuration >= 0.0);
00183     mCriticalHypoxicDuration = criticalHypoxicDuration;
00184 }
00185 
00186 void SimpleOxygenBasedCellCycleModel::SetCurrentHypoxiaOnsetTime(double currentHypoxiaOnsetTime)
00187 {
00188     assert(currentHypoxiaOnsetTime >= 0.0);
00189     mCurrentHypoxiaOnsetTime = currentHypoxiaOnsetTime;
00190 }
00191 
00192 void SimpleOxygenBasedCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile)
00193 {
00194     *rParamsFile << "\t\t\t<HypoxicConcentration>" << mHypoxicConcentration << "</HypoxicConcentration>\n";
00195     *rParamsFile << "\t\t\t<QuiescentConcentration>" << mQuiescentConcentration << "</QuiescentConcentration>\n";
00196     *rParamsFile << "\t\t\t<CriticalHypoxicDuration>" << mCriticalHypoxicDuration << "</CriticalHypoxicDuration>\n";
00197 
00198     // Call method on direct parent class
00199     AbstractSimpleCellCycleModel::OutputCellCycleModelParameters(rParamsFile);
00200 }
00201 
00202 // Serialization for Boost >= 1.36
00203 #include "SerializationExportWrapperForCpp.hpp"
00204 CHASTE_CLASS_EXPORT(SimpleOxygenBasedCellCycleModel)