Chaste  Release::2017.1
SimpleWntCellCycleModel.cpp
1 /*
2 
3 Copyright (c) 2005-2017, University of Oxford.
4 All rights reserved.
5 
6 University of Oxford means the Chancellor, Masters and Scholars of the
7 University of Oxford, having an administrative office at Wellington
8 Square, Oxford OX1 2JD, UK.
9 
10 This file is part of Chaste.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright notice,
17  this list of conditions and the following disclaimer in the documentation
18  and/or other materials provided with the distribution.
19  * Neither the name of the University of Oxford nor the names of its
20  contributors may be used to endorse or promote products derived from this
21  software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #include "SimpleWntCellCycleModel.hpp"
37 #include "Exception.hpp"
38 #include "StemCellProliferativeType.hpp"
39 #include "TransitCellProliferativeType.hpp"
40 #include "DifferentiatedCellProliferativeType.hpp"
41 #include "CellLabel.hpp"
42 #include "WildTypeCellMutationState.hpp"
43 #include "ApcOneHitCellMutationState.hpp"
44 #include "ApcTwoHitCellMutationState.hpp"
45 #include "BetaCateninOneHitCellMutationState.hpp"
46 
48  : mUseCellProliferativeTypeDependentG1Duration(false),
49  mWntStemThreshold(0.8),
50  mWntTransitThreshold(0.65),
51  mWntLabelledThreshold(0.65)
52 {
53 }
54 
61 {
62  /*
63  * Initialize only those member variables defined in this class.
64  *
65  * The member variables mCurrentCellCyclePhase, mG1Duration,
66  * mMinimumGapDuration, mStemCellG1Duration, mTransitCellG1Duration,
67  * mSDuration, mG2Duration and mMDuration are initialized in the
68  * AbstractPhaseBasedCellCycleModel constructor.
69  *
70  * The member variables mBirthTime, mReadyToDivide and mDimension
71  * are initialized in the AbstractCellCycleModel constructor.
72  *
73  * Note that mG1Duration and the cell's proliferative type are
74  * (re)set as soon as InitialiseDaughterCell() is called on the
75  * new cell-cycle model.
76  */
77 }
78 
80 {
81  return new SimpleWntCellCycleModel(*this);
82 }
83 
85 {
87 }
88 
89 void SimpleWntCellCycleModel::SetUseCellProliferativeTypeDependentG1Duration(bool useCellProliferativeTypeDependentG1Duration)
90 {
91  mUseCellProliferativeTypeDependentG1Duration = useCellProliferativeTypeDependentG1Duration;
92 }
93 
95 {
96  assert(mpCell != nullptr);
97 
99 
100  if (mpCell->GetCellProliferativeType()->IsType<StemCellProliferativeType>())
101  {
103  {
105  }
106  else
107  {
108  // Normally stem cells should behave just like transit cells in a Wnt simulation
110  }
111  }
112  else if (mpCell->GetCellProliferativeType()->IsType<TransitCellProliferativeType>())
113  {
115  }
116  else if (mpCell->GetCellProliferativeType()->IsType<DifferentiatedCellProliferativeType>())
117  {
118  mG1Duration = DBL_MAX;
119  }
120  else
121  {
123  }
124 
125  // Check that the normal random deviate has not returned a small or negative G1 duration
127  {
129  }
130 }
131 
133 {
134  assert(mpCell != nullptr);
135  double level = 0;
136 
137  switch (mDimension)
138  {
139  case 1:
140  {
141  const unsigned DIM = 1;
143  break;
144  }
145  case 2:
146  {
147  const unsigned DIM = 2;
149  break;
150  }
151  case 3:
152  {
153  const unsigned DIM = 3;
155  break;
156  }
157  default:
159  }
160  return level;
161 }
162 
164 {
165  WntConcentrationType wnt_type;
166  switch (mDimension)
167  {
168  case 1:
169  {
170  const unsigned DIM = 1;
172  break;
173  }
174  case 2:
175  {
176  const unsigned DIM = 2;
178  break;
179  }
180  case 3:
181  {
182  const unsigned DIM = 3;
184  break;
185  }
186  case UNSIGNED_UNSET:
187  {
188  // If you trip this you have tried to use a simulation without setting the dimension.
190  }
191  default:
193  }
194  return wnt_type;
195 }
196 
198 {
199  // The cell can divide if the Wnt concentration >= wnt_division_threshold
200  double wnt_division_threshold = DBL_MAX;
201 
202  // Set up under what level of Wnt stimulus a cell will divide
203  if (mpCell->GetMutationState()->IsType<WildTypeCellMutationState>())
204  {
205  wnt_division_threshold = mWntTransitThreshold;
206  }
207  else if (mpCell->GetMutationState()->IsType<ApcOneHitCellMutationState>())
208  {
209  // should be less than healthy values
210  wnt_division_threshold = 0.77*mWntTransitThreshold;
211  }
212  else if (mpCell->GetMutationState()->IsType<BetaCateninOneHitCellMutationState>())
213  {
214  // less than above value
215  wnt_division_threshold = 0.155*mWntTransitThreshold;
216  }
217  else if (mpCell->GetMutationState()->IsType<ApcTwoHitCellMutationState>())
218  {
219  // should be zero (no Wnt-dependence)
220  wnt_division_threshold = 0.0;
221  }
222  else
223  {
225  }
226 
227  if (mpCell->HasCellProperty<CellLabel>())
228  {
229  wnt_division_threshold = mWntLabelledThreshold;
230  }
231 
232  double wnt_level = GetWntLevel();
233  WntConcentrationType wnt_type = GetWntType();
234 
235  // Set the cell type to TransitCellProliferativeType if the Wnt stimulus exceeds wnt_division_threshold
236  if (wnt_level >= wnt_division_threshold)
237  {
238  // For a RADIAL Wnt type, override the cell type to StemCellProliferativeType if the Wnt stimulus exceeds a higher threshold
239  if ((wnt_type == RADIAL) && (wnt_level > mWntStemThreshold))
240  {
241  /*
242  * This method is usually called within a CellBasedSimulation, after the CellPopulation
243  * has called CellPropertyRegistry::TakeOwnership(). This means that were we to call
244  * CellPropertyRegistry::Instance() here when setting the CellProliferativeType, we
245  * would be creating a new CellPropertyRegistry. In this case the cell proliferative
246  * type counts, as returned by AbstractCellPopulation::GetCellProliferativeTypeCount(),
247  * would be incorrect. We must therefore access the CellProliferativeType via the cell's
248  * CellPropertyCollection.
249  */
250  boost::shared_ptr<AbstractCellProperty> p_stem_type =
251  mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<StemCellProliferativeType>();
252  mpCell->SetCellProliferativeType(p_stem_type);
253  }
254  else
255  {
256  boost::shared_ptr<AbstractCellProperty> p_transit_type =
257  mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<TransitCellProliferativeType>();
258  mpCell->SetCellProliferativeType(p_transit_type);
259  }
260  }
261  else
262  {
263  // The cell is set to have DifferentiatedCellProliferativeType and so in G0 phase
264  boost::shared_ptr<AbstractCellProperty> p_diff_type =
265  mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<DifferentiatedCellProliferativeType>();
266  mpCell->SetCellProliferativeType(p_diff_type);
267  }
269 }
270 
272 {
273  WntConcentrationType wnt_type = GetWntType();
274 
275  if (wnt_type == RADIAL)
276  {
277  boost::shared_ptr<AbstractCellProperty> p_transit_type =
278  mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<TransitCellProliferativeType>();
279  mpCell->SetCellProliferativeType(p_transit_type);
280  }
281 
283 }
284 
286 {
287  return false;
288 }
289 
291 {
292  return mWntStemThreshold;
293 }
294 
295 void SimpleWntCellCycleModel::SetWntStemThreshold(double wntStemThreshold)
296 {
297  assert(wntStemThreshold <= 1.0);
298  assert(wntStemThreshold >= 0.0);
299  mWntStemThreshold = wntStemThreshold;
300 }
301 
303 {
304  return mWntTransitThreshold;
305 }
306 
307 void SimpleWntCellCycleModel::SetWntTransitThreshold(double wntTransitThreshold)
308 {
309  //assert(wntTransitThreshold <= 1.0);
310  //assert(wntTransitThreshold >= 0.0);
311  mWntTransitThreshold = wntTransitThreshold;
312 }
313 
315 {
316  return mWntLabelledThreshold;
317 }
318 
319 void SimpleWntCellCycleModel::SetWntLabelledThreshold(double wntLabelledThreshold)
320 {
321 // assert(wntLabelledThreshold <= 1.0);
322 // assert(wntLabelledThreshold >= 0.0);
323  mWntLabelledThreshold = wntLabelledThreshold;
324 }
325 
327 {
328  *rParamsFile << "\t\t\t<UseCellProliferativeTypeDependentG1Duration>" << mUseCellProliferativeTypeDependentG1Duration << "</UseCellProliferativeTypeDependentG1Duration>\n";
329  *rParamsFile << "\t\t\t<WntStemThreshold>" << mWntStemThreshold << "</WntStemThreshold>\n";
330  *rParamsFile << "\t\t\t<WntTransitThreshold>" << mWntTransitThreshold << "</WntTransitThreshold>\n";
331  *rParamsFile << "\t\t\t<WntLabelledThreshold>" << mWntLabelledThreshold << "</WntLabelledThreshold>\n";
332 
333  // Call method on direct parent class
335 }
336 
337 // Serialization for Boost >= 1.36
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
double GetWntLevel(double height)
WntConcentrationType GetWntType()
virtual AbstractCellCycleModel * CreateCellCycleModel()
double NormalRandomDeviate(double mean, double stdDev)
WntConcentrationType GetType()
#define NEVER_REACHED
Definition: Exception.hpp:206
bool GetUseCellProliferativeTypeDependentG1Duration() const
void SetUseCellProliferativeTypeDependentG1Duration(bool useCellProliferativeTypeDependentG1Duration=true)
static WntConcentration * Instance()
void SetWntTransitThreshold(double wntTransitThreshold)
const unsigned UNSIGNED_UNSET
Definition: Exception.hpp:52
static RandomNumberGenerator * Instance()
void SetWntLabelledThreshold(double wntLabelledThreshold)
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
#define CHASTE_CLASS_EXPORT(T)
void SetWntStemThreshold(double wntStemThreshold)