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 "UblasIncludes.hpp" 00037 #include "SingleOdeWntCellCycleModel.hpp" 00038 #include "TransitCellProliferativeType.hpp" 00039 #include "DifferentiatedCellProliferativeType.hpp" 00040 00041 SingleOdeWntCellCycleModel::SingleOdeWntCellCycleModel(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver) 00042 : CellCycleModelOdeHandler(DOUBLE_UNSET, pOdeSolver), 00043 mBetaCateninDivisionThreshold(100)// MAGIC NUMBER! 00044 { 00045 if (mpOdeSolver == boost::shared_ptr<AbstractCellCycleModelOdeSolver>()) 00046 { 00047 #ifdef CHASTE_CVODE 00048 mpOdeSolver = CellCycleModelOdeSolver<SingleOdeWntCellCycleModel, CvodeAdaptor>::Instance(); 00049 mpOdeSolver->Initialise(); 00050 mpOdeSolver->SetMaxSteps(10000); 00051 #else 00052 mpOdeSolver = CellCycleModelOdeSolver<SingleOdeWntCellCycleModel, RungeKutta4IvpOdeSolver>::Instance(); 00053 mpOdeSolver->Initialise(); 00054 SetDt(0.001); 00055 #endif //CHASTE_CVODE 00056 } 00057 assert(mpOdeSolver->IsSetUp()); 00058 } 00059 00060 AbstractCellCycleModel* SingleOdeWntCellCycleModel::CreateCellCycleModel() 00061 { 00062 // Create a new cell-cycle model 00063 SingleOdeWntCellCycleModel* p_model = new SingleOdeWntCellCycleModel(this->mpOdeSolver); 00064 00065 /* 00066 * Set each member variable of the new cell-cycle model that inherits 00067 * its value from the parent. 00068 * 00069 * Note 1: some of the new cell-cycle model's member variables (namely 00070 * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide, mDt, mpOdeSolver) 00071 * will already have been correctly initialized in its constructor. 00072 * 00073 * Note 2: one or more of the new cell-cycle model's member variables 00074 * may be set/overwritten as soon as InitialiseDaughterCell() is called on 00075 * the new cell-cycle model. 00076 */ 00077 p_model->SetBirthTime(mBirthTime); 00078 p_model->SetDimension(mDimension); 00079 p_model->SetMinimumGapDuration(mMinimumGapDuration); 00080 p_model->SetStemCellG1Duration(mStemCellG1Duration); 00081 p_model->SetTransitCellG1Duration(mTransitCellG1Duration); 00082 p_model->SetSDuration(mSDuration); 00083 p_model->SetG2Duration(mG2Duration); 00084 p_model->SetMDuration(mMDuration); 00085 p_model->SetUseCellProliferativeTypeDependentG1Duration(mUseCellProliferativeTypeDependentG1Duration); 00086 p_model->SetWntStemThreshold(mWntStemThreshold); 00087 p_model->SetWntTransitThreshold(mWntTransitThreshold); 00088 p_model->SetWntLabelledThreshold(mWntLabelledThreshold); 00089 p_model->SetLastTime(mLastTime); 00090 p_model->SetBetaCateninDivisionThreshold(mBetaCateninDivisionThreshold); 00091 00092 /* 00093 * Create the new cell-cycle model's ODE system and use the current values 00094 * of the state variables in mpOdeSystem as an initial condition. 00095 */ 00096 assert(mpOdeSystem); 00097 double wnt_level = this->GetWntLevel(); 00098 p_model->SetOdeSystem(new Mirams2010WntOdeSystem(wnt_level, mpCell->GetMutationState())); 00099 p_model->SetStateVariables(mpOdeSystem->rGetStateVariables()); 00100 00101 return p_model; 00102 } 00103 00104 void SingleOdeWntCellCycleModel::UpdateCellCyclePhase() 00105 { 00106 assert(SimulationTime::Instance()->IsStartTimeSetUp()); 00107 SolveOdeToTime(SimulationTime::Instance()->GetTime()); 00108 ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel(); 00109 AbstractSimpleCellCycleModel::UpdateCellCyclePhase(); 00110 } 00111 00112 void SingleOdeWntCellCycleModel::Initialise() 00113 { 00114 assert(mpOdeSystem == NULL); 00115 assert(mpCell != NULL); 00116 00117 double wnt_level = this->GetWntLevel(); 00118 mpOdeSystem = new Mirams2010WntOdeSystem(wnt_level, mpCell->GetMutationState()); 00119 mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions()); 00120 00121 // MAGIC NUMBER! 00122 //mBetaCateninDivisionThreshold = 100.0; 00123 00124 // This call actually sets up the G1 phase to something sensible (random number generated) 00125 SimpleWntCellCycleModel::Initialise(); 00126 00127 SetLastTime(mBirthTime); 00128 00129 ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel(); 00130 } 00131 00132 void SingleOdeWntCellCycleModel::AdjustOdeParameters(double currentTime) 00133 { 00134 // Pass this time step's Wnt stimulus into the solver as a constant over this timestep. 00135 mpOdeSystem->rGetStateVariables()[2] = this->GetWntLevel(); 00136 00137 // Use the cell's current mutation status as another input 00138 static_cast<Mirams2010WntOdeSystem*>(mpOdeSystem)->SetMutationState(mpCell->GetMutationState()); 00139 } 00140 00141 void SingleOdeWntCellCycleModel::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel() 00142 { 00143 assert(mpOdeSystem != NULL); 00144 assert(mpCell != NULL); 00145 00146 if (GetBetaCateninConcentration() < GetBetaCateninDivisionThreshold()) 00147 { 00148 /* 00149 * This method is usually called within a CellBasedSimulation, after the CellPopulation 00150 * has called CellPropertyRegistry::TakeOwnership(). This means that were we to call 00151 * CellPropertyRegistry::Instance() here when setting the CellProliferativeType, we 00152 * would be creating a new CellPropertyRegistry. In this case the cell proliferative 00153 * type counts, as returned by AbstractCellPopulation::GetCellProliferativeTypeCount(), 00154 * would be incorrect. We must therefore access the CellProliferativeType via the cell's 00155 * CellPropertyCollection. 00156 */ 00157 boost::shared_ptr<AbstractCellProperty> p_diff_type = 00158 mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<DifferentiatedCellProliferativeType>(); 00159 mpCell->SetCellProliferativeType(p_diff_type); 00160 } 00161 else 00162 { 00163 boost::shared_ptr<AbstractCellProperty> p_transit_type = 00164 mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<TransitCellProliferativeType>(); 00165 mpCell->SetCellProliferativeType(p_transit_type); 00166 } 00167 } 00168 00169 double SingleOdeWntCellCycleModel::GetBetaCateninConcentration() 00170 { 00171 return mpOdeSystem->rGetStateVariables()[0] + mpOdeSystem->rGetStateVariables()[1]; 00172 } 00173 00174 void SingleOdeWntCellCycleModel::SetBetaCateninDivisionThreshold(double betaCateninDivisionThreshold) 00175 { 00176 mBetaCateninDivisionThreshold = betaCateninDivisionThreshold; 00177 } 00178 00179 double SingleOdeWntCellCycleModel::GetBetaCateninDivisionThreshold() 00180 { 00181 return mBetaCateninDivisionThreshold; 00182 } 00183 00184 void SingleOdeWntCellCycleModel::OutputCellCycleModelParameters(out_stream& rParamsFile) 00185 { 00186 // No new parameters to output 00187 00188 // Call method on direct parent class 00189 SimpleWntCellCycleModel::OutputCellCycleModelParameters(rParamsFile); 00190 } 00191 00192 // Declare identifier for the serializer 00193 #include "SerializationExportWrapperForCpp.hpp" 00194 CHASTE_CLASS_EXPORT(SingleOdeWntCellCycleModel) 00195 #include "CellCycleModelOdeSolverExportWrapper.hpp" 00196 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(SingleOdeWntCellCycleModel)