SimpleWntCellCycleModel.cpp

00001 /*
00002 
00003 Copyright (c) 2005-2015, 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 "SimpleWntCellCycleModel.hpp"
00037 #include "Exception.hpp"
00038 #include "StemCellProliferativeType.hpp"
00039 #include "TransitCellProliferativeType.hpp"
00040 #include "DifferentiatedCellProliferativeType.hpp"
00041 
00042 SimpleWntCellCycleModel::SimpleWntCellCycleModel()
00043     : mUseCellProliferativeTypeDependentG1Duration(false),
00044       mWntStemThreshold(0.8),
00045       mWntTransitThreshold(0.65),
00046       mWntLabelledThreshold(0.65)
00047 {
00048 }
00049 
00050 AbstractCellCycleModel* SimpleWntCellCycleModel::CreateCellCycleModel()
00051 {
00052     // Create a new cell-cycle model
00053     SimpleWntCellCycleModel* p_model = new SimpleWntCellCycleModel();
00054 
00055     /*
00056      * Set each member variable of the new cell-cycle model that inherits
00057      * its value from the parent.
00058      *
00059      * Note 1: some of the new cell-cycle model's member variables (namely
00060      * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide) will already have been
00061      * correctly initialized in its constructor.
00062      *
00063      * Note 2: one or more of the new cell-cycle model's member variables
00064      * may be set/overwritten as soon as InitialiseDaughterCell() is called on
00065      * the new cell-cycle model.
00066      */
00067     p_model->SetBirthTime(mBirthTime);
00068     p_model->SetDimension(mDimension);
00069     p_model->SetMinimumGapDuration(mMinimumGapDuration);
00070     p_model->SetStemCellG1Duration(mStemCellG1Duration);
00071     p_model->SetTransitCellG1Duration(mTransitCellG1Duration);
00072     p_model->SetSDuration(mSDuration);
00073     p_model->SetG2Duration(mG2Duration);
00074     p_model->SetMDuration(mMDuration);
00075     p_model->SetUseCellProliferativeTypeDependentG1Duration(mUseCellProliferativeTypeDependentG1Duration);
00076     p_model->SetWntStemThreshold(mWntStemThreshold);
00077     p_model->SetWntTransitThreshold(mWntTransitThreshold);
00078     p_model->SetWntLabelledThreshold(mWntLabelledThreshold);
00079 
00080     return p_model;
00081 }
00082 
00083 void SimpleWntCellCycleModel::SetUseCellProliferativeTypeDependentG1Duration(bool useCellProliferativeTypeDependentG1Duration)
00084 {
00085     mUseCellProliferativeTypeDependentG1Duration = useCellProliferativeTypeDependentG1Duration;
00086 }
00087 
00088 void SimpleWntCellCycleModel::SetG1Duration()
00089 {
00090     assert(mpCell != NULL);
00091 
00092     RandomNumberGenerator* p_gen = RandomNumberGenerator::Instance();
00093 
00094     if (mpCell->GetCellProliferativeType()->IsType<StemCellProliferativeType>())
00095     {
00096         if (mUseCellProliferativeTypeDependentG1Duration)
00097         {
00098             mG1Duration = p_gen->NormalRandomDeviate(GetStemCellG1Duration(), 1.0);
00099         }
00100         else
00101         {
00102             // Normally stem cells should behave just like transit cells in a Wnt simulation
00103             mG1Duration = p_gen->NormalRandomDeviate(GetTransitCellG1Duration(), 1.0);
00104         }
00105     }
00106     else if (mpCell->GetCellProliferativeType()->IsType<TransitCellProliferativeType>())
00107     {
00108         mG1Duration = p_gen->NormalRandomDeviate(GetTransitCellG1Duration(), 1.0);
00109     }
00110     else if (mpCell->GetCellProliferativeType()->IsType<DifferentiatedCellProliferativeType>())
00111     {
00112         mG1Duration = DBL_MAX;
00113     }
00114     else
00115     {
00116         NEVER_REACHED;
00117     }
00118 
00119     // Check that the normal random deviate has not returned a small or negative G1 duration
00120     if (mG1Duration < mMinimumGapDuration)
00121     {
00122         mG1Duration = mMinimumGapDuration;
00123     }
00124 }
00125 
00126 double SimpleWntCellCycleModel::GetWntLevel()
00127 {
00128     assert(mpCell != NULL);
00129     double level = 0;
00130 
00131     switch (mDimension)
00132     {
00133         case 1:
00134         {
00135             const unsigned DIM = 1;
00136             level = WntConcentration<DIM>::Instance()->GetWntLevel(mpCell);
00137             break;
00138         }
00139         case 2:
00140         {
00141             const unsigned DIM = 2;
00142             level = WntConcentration<DIM>::Instance()->GetWntLevel(mpCell);
00143             break;
00144         }
00145         case 3:
00146         {
00147             const unsigned DIM = 3;
00148             level = WntConcentration<DIM>::Instance()->GetWntLevel(mpCell);
00149             break;
00150         }
00151         default:
00152             NEVER_REACHED;
00153     }
00154     return level;
00155 }
00156 
00157 WntConcentrationType SimpleWntCellCycleModel::GetWntType()
00158 {
00159     WntConcentrationType wnt_type;
00160     switch (mDimension)
00161     {
00162         case 1:
00163         {
00164             const unsigned DIM = 1;
00165             wnt_type = WntConcentration<DIM>::Instance()->GetType();
00166             break;
00167         }
00168         case 2:
00169         {
00170             const unsigned DIM = 2;
00171             wnt_type = WntConcentration<DIM>::Instance()->GetType();
00172             break;
00173         }
00174         case 3:
00175         {
00176             const unsigned DIM = 3;
00177             wnt_type = WntConcentration<DIM>::Instance()->GetType();
00178             break;
00179         }
00180         default:
00181             NEVER_REACHED;
00182     }
00183     return wnt_type;
00184 }
00185 
00186 void SimpleWntCellCycleModel::UpdateCellCyclePhase()
00187 {
00188     // The cell can divide if the Wnt concentration >= wnt_division_threshold
00189     double wnt_division_threshold = DBL_MAX;
00190 
00191     // Set up under what level of Wnt stimulus a cell will divide
00192     if (mpCell->GetMutationState()->IsType<WildTypeCellMutationState>())
00193     {
00194         wnt_division_threshold = mWntTransitThreshold;
00195     }
00196     else if (mpCell->GetMutationState()->IsType<ApcOneHitCellMutationState>())
00197     {
00198         // should be less than healthy values
00199         wnt_division_threshold = 0.77*mWntTransitThreshold;
00200     }
00201     else if (mpCell->GetMutationState()->IsType<BetaCateninOneHitCellMutationState>())
00202     {
00203         // less than above value
00204         wnt_division_threshold = 0.155*mWntTransitThreshold;
00205     }
00206     else if (mpCell->GetMutationState()->IsType<ApcTwoHitCellMutationState>())
00207     {
00208         // should be zero (no Wnt-dependence)
00209         wnt_division_threshold = 0.0;
00210     }
00211     else
00212     {
00213         NEVER_REACHED;
00214     }
00215 
00216     if (mpCell->HasCellProperty<CellLabel>())
00217     {
00218         wnt_division_threshold = mWntLabelledThreshold;
00219     }
00220 
00221     double wnt_level = GetWntLevel();
00222     WntConcentrationType wnt_type = GetWntType();
00223 
00224     // Set the cell type to TransitCellProliferativeType if the Wnt stimulus exceeds wnt_division_threshold
00225     if (wnt_level >= wnt_division_threshold)
00226     {
00227         // For a RADIAL Wnt type, override the cell type to StemCellProliferativeType if the Wnt stimulus exceeds a higher threshold
00228         if ((wnt_type == RADIAL) && (wnt_level > mWntStemThreshold))
00229         {
00230             /*
00231              * This method is usually called within a CellBasedSimulation, after the CellPopulation
00232              * has called CellPropertyRegistry::TakeOwnership(). This means that were we to call
00233              * CellPropertyRegistry::Instance() here when setting the CellProliferativeType, we
00234              * would be creating a new CellPropertyRegistry. In this case the cell proliferative
00235              * type counts, as returned by AbstractCellPopulation::GetCellProliferativeTypeCount(),
00236              * would be incorrect. We must therefore access the CellProliferativeType via the cell's
00237              * CellPropertyCollection.
00238              */
00239             boost::shared_ptr<AbstractCellProperty> p_stem_type =
00240                 mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<StemCellProliferativeType>();
00241             mpCell->SetCellProliferativeType(p_stem_type);
00242         }
00243         else
00244         {
00245             boost::shared_ptr<AbstractCellProperty> p_transit_type =
00246                 mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<TransitCellProliferativeType>();
00247             mpCell->SetCellProliferativeType(p_transit_type);
00248         }
00249     }
00250     else
00251     {
00252         // The cell is set to have DifferentiatedCellProliferativeType and so in G0 phase
00253         boost::shared_ptr<AbstractCellProperty> p_diff_type =
00254             mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<DifferentiatedCellProliferativeType>();
00255         mpCell->SetCellProliferativeType(p_diff_type);
00256     }
00257     AbstractSimpleCellCycleModel::UpdateCellCyclePhase();
00258 }
00259 
00260 void SimpleWntCellCycleModel::InitialiseDaughterCell()
00261 {
00262     WntConcentrationType wnt_type = GetWntType();
00263 
00264     if (wnt_type == RADIAL)
00265     {
00266         boost::shared_ptr<AbstractCellProperty> p_transit_type =
00267             mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<TransitCellProliferativeType>();
00268         mpCell->SetCellProliferativeType(p_transit_type);
00269     }
00270 
00271     AbstractSimpleCellCycleModel::InitialiseDaughterCell();
00272 }
00273 
00274 bool SimpleWntCellCycleModel::CanCellTerminallyDifferentiate()
00275 {
00276     return false;
00277 }
00278 
00279 double SimpleWntCellCycleModel::GetWntStemThreshold()
00280 {
00281     return mWntStemThreshold;
00282 }
00283 
00284 void SimpleWntCellCycleModel::SetWntStemThreshold(double wntStemThreshold)
00285 {
00286     assert(wntStemThreshold <= 1.0);
00287     assert(wntStemThreshold >= 0.0);
00288     mWntStemThreshold = wntStemThreshold;
00289 }
00290 
00291 double SimpleWntCellCycleModel::GetWntTransitThreshold()
00292 {
00293     return mWntTransitThreshold;
00294 }
00295 
00296 void SimpleWntCellCycleModel::SetWntTransitThreshold(double wntTransitThreshold)
00297 {
00298     //assert(wntTransitThreshold <= 1.0);
00299     //assert(wntTransitThreshold >= 0.0);
00300     mWntTransitThreshold = wntTransitThreshold;
00301 }
00302 
00303 double SimpleWntCellCycleModel::GetWntLabelledThreshold()
00304 {
00305     return mWntLabelledThreshold;
00306 }
00307 
00308 void SimpleWntCellCycleModel::SetWntLabelledThreshold(double wntLabelledThreshold)
00309 {
00310 //    assert(wntLabelledThreshold <= 1.0);
00311 //    assert(wntLabelledThreshold >= 0.0);
00312     mWntLabelledThreshold = wntLabelledThreshold;
00313 }
00314 
00315 void SimpleWntCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile)
00316 {
00317     *rParamsFile << "\t\t\t<UseCellProliferativeTypeDependentG1Duration>" << mUseCellProliferativeTypeDependentG1Duration << "</UseCellProliferativeTypeDependentG1Duration>\n";
00318     *rParamsFile << "\t\t\t<WntStemThreshold>" << mWntStemThreshold << "</WntStemThreshold>\n";
00319     *rParamsFile << "\t\t\t<WntTransitThreshold>" << mWntTransitThreshold << "</WntTransitThreshold>\n";
00320     *rParamsFile << "\t\t\t<WntLabelledThreshold>" << mWntLabelledThreshold << "</WntLabelledThreshold>\n";
00321 
00322     // Call method on direct parent class
00323     AbstractSimpleCellCycleModel::OutputCellCycleModelParameters(rParamsFile);
00324 }
00325 
00326 // Serialization for Boost >= 1.36
00327 #include "SerializationExportWrapperForCpp.hpp"
00328 CHASTE_CLASS_EXPORT(SimpleWntCellCycleModel)

Generated by  doxygen 1.6.2