CheckReadyToDivideAndPhaseIsUpdated.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef CHECKREADYTODIVIDEANDPHASEISUPDATED_HPP_
00037 #define CHECKREADYTODIVIDEANDPHASEISUPDATED_HPP_
00038
00039 #include <cxxtest/TestSuite.h>
00040 #include <cmath>
00041 #include "AbstractCellCycleModel.hpp"
00042 #include "DifferentiatedCellProliferativeType.hpp"
00043
00055 void CheckReadyToDivideAndPhaseIsUpdated(AbstractCellCycleModel* pModel,
00056 double g1Duration,
00057 double g2Duration=DBL_MAX)
00058 {
00059 if (g2Duration==DBL_MAX)
00060 {
00061 g2Duration = pModel->GetG2Duration();
00062 }
00063
00064 double age = pModel->GetAge();
00065
00066 const double G1TOL = 1e-5;
00067
00068
00069 if ((pModel->GetCell()->GetCellProliferativeType()->IsType<DifferentiatedCellProliferativeType>()) &&
00070 (age >= pModel->GetMDuration()) &&
00071 (pModel->GetG1Duration() != DOUBLE_UNSET) &&
00072 (fabs(pModel->GetG1Duration() - g1Duration) > G1TOL))
00073 {
00074 std::cout << "G1 duration mismatch: actual = " << pModel->GetG1Duration()
00075 << ", expected = " << g1Duration
00076 << std::endl;
00077 }
00078
00079 if (pModel->GetCell()->GetCellProliferativeType()->IsType<DifferentiatedCellProliferativeType>())
00080 {
00081
00082 TS_ASSERT_EQUALS(pModel->ReadyToDivide(), false);
00083 TS_ASSERT_EQUALS(pModel->GetCurrentCellCyclePhase(), G_ZERO_PHASE);
00084 }
00085 else if (age < pModel->GetMDuration())
00086 {
00087
00088 TS_ASSERT_EQUALS(pModel->ReadyToDivide(), false);
00089 TS_ASSERT_EQUALS(pModel->GetCurrentCellCyclePhase(), M_PHASE);
00090 }
00091 else if (age < pModel->GetMDuration() + g1Duration - G1TOL)
00092 {
00093
00094
00095 TS_ASSERT_EQUALS(pModel->ReadyToDivide(), false);
00096 TS_ASSERT_EQUALS(pModel->GetCurrentCellCyclePhase(), G_ONE_PHASE);
00097
00098
00099 if (pModel->GetCurrentCellCyclePhase() != G_ONE_PHASE)
00100 {
00101 std::cout << "Expected G1: " << g1Duration
00102 << "; actual: " << pModel->GetG1Duration()
00103 << "; age = " << age
00104 << "; G1-S transition = " << pModel->GetMDuration() + g1Duration
00105 << std::endl;
00106 }
00107 }
00108 else if (age < pModel->GetMDuration() + g1Duration + pModel->GetSDuration() - G1TOL)
00109 {
00110
00111
00112 TS_ASSERT_EQUALS(pModel->ReadyToDivide(), false);
00113 TS_ASSERT_EQUALS(pModel->GetCurrentCellCyclePhase(), S_PHASE);
00114 }
00115 else if (age < pModel->GetMDuration() + g1Duration + pModel->GetSDuration() + g2Duration - G1TOL)
00116 {
00117
00118
00119 TS_ASSERT_EQUALS(pModel->ReadyToDivide(), false);
00120 TS_ASSERT_EQUALS(pModel->GetCurrentCellCyclePhase(), G_TWO_PHASE);
00121 }
00122 else
00123 {
00124
00125 TS_ASSERT_EQUALS(pModel->ReadyToDivide(), true);
00126 }
00127 }
00128
00129 #endif