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