Пример #1
0
    public int ExitPhase(int phaseInd)
    {
        PhaseT phase        = GetPhaseByInd(phaseInd);
        int    nextPhaseInd = currentPhaseInd; //do not change phase otherwise

        if (phase.name.Equals(Globals.A))
        {
            nextPhaseInd = GetPhaseByName(Globals.D).ind;
        }
        else if (phase.name.Equals(Globals.NS))
        {
            //remain in non-lysed state if volume has not exceeded the rapture volume
            if (phenotype.volume.total > phenotype.volume.ruptureVolume)
            {
                nextPhaseInd       = phases[phase.nextPhaseInd].ind; //move to the next phase
                elapsedTimeInPhase = 0;
            }
        }
        else if (phase.name.Equals(Globals.NL))
        {
            nextPhaseInd = GetPhaseByName(Globals.D).ind;
        }
        else
        {
            nextPhaseInd       = phases[phase.nextPhaseInd].ind; //move to the next phase
            elapsedTimeInPhase = 0;
        }


        return(nextPhaseInd);
    }
Пример #2
0
    public void AddTransitionRate(string fromName, string toName, float rate, bool fixedDuration)
    {
        PhaseT phaseFrom = GetPhaseByName(fromName);
        PhaseT phaseTo   = GetPhaseByName(toName);

        transitionRates[phaseFrom.ind][phaseTo.ind] = new PhaseLink(rate, fixedDuration);
    }
Пример #3
0
    public override void EnterPhase(int phaseInd)
    {
        PhaseT phase = GetPhaseByInd(phaseInd);

        if (phase.name.Equals(Globals.S))
        {
            base.phenotype.volume.nuclearSolid     *= 2;
            base.phenotype.volume.cytoplasmicSolid *= 2;
        }
    }
Пример #4
0
    public void TestCellCycleInitialization()
    {
        CellCycle cellCycle = new CellCycle();


        Assert.AreEqual(cellCycle.phases.Count, 0);
        Assert.AreEqual(cellCycle.transitionRates.Length, 10);

        PhaseT phase = cellCycle.GetCurrentPhase();

        Assert.AreEqual(phase.ind, 0);
        Assert.AreEqual(phase.name, Globals.G1);

        cellCycle = null;
    }
Пример #5
0
    public void TestFlowCytometryModel()
    {
        CellCycle cellCycle = new CellCycle();

        cellCycle.AddPhase(new PhaseT(0, Globals.G1, 1, Color.red));
        cellCycle.AddPhase(new PhaseT(1, Globals.S, 2, Color.green));
        cellCycle.AddPhase(new PhaseT(2, Globals.M, 0, Color.blue));

        Assert.AreEqual(cellCycle.phases.Count, 3);

        PhaseT phase0 = cellCycle.GetPhaseByName(Globals.G1);

        Assert.AreEqual(phase0.name, Globals.G1);
        Assert.AreEqual(phase0.ind, 0);
        Assert.AreEqual(phase0.nextPhaseInd, 1);

        PhaseT phase1 = cellCycle.GetPhaseByName(Globals.S);

        Assert.AreEqual(phase1.name, Globals.S);
        Assert.AreEqual(phase1.ind, 1);
        Assert.AreEqual(phase1.nextPhaseInd, 2);

        PhaseT phase2 = cellCycle.GetPhaseByName(Globals.M);

        Assert.AreEqual(phase2.name, Globals.M);
        Assert.AreEqual(phase2.ind, 2);
        Assert.AreEqual(phase2.nextPhaseInd, 0);

        //phase should be {1, s, 2}
        int    nextPhaseInd = cellCycle.ExitPhase(0);
        PhaseT phase        = cellCycle.GetPhaseByInd(nextPhaseInd);

        Assert.AreEqual(phase.ind, phase0.nextPhaseInd);
        Assert.AreEqual(phase.name, Globals.S);
        Assert.AreEqual(phase.nextPhaseInd, 2);


        cellCycle.AddTransitionRate(Globals.G1, Globals.S, 10f, false);
        Assert.AreEqual(cellCycle.transitionRates[0][1].fixedDuration, false);
        Assert.AreEqual(cellCycle.transitionRates[0][1].transitionRate, 10f);

        cellCycle = null;
    }
Пример #6
0
    public override void EnterPhase(int phaseInd)
    {
        PhaseT phase = GetPhaseByInd(phaseInd);

        if (phase.name.Equals(Globals.A))
        {
            base.phenotype.isDying = true;
            //update volume constants
            base.phenotype.volume.rFluid       = 3f / Globals.timeConst;
            base.phenotype.volume.rCytoplasmic = 1f / Globals.timeConst;
            base.phenotype.volume.rNuclear     = 0.35f / Globals.timeConst;

            base.phenotype.volume.nuclearSolid          = 0;
            base.phenotype.volume.fCytoplasmicToNuclear = 0;
            base.phenotype.volume.fFluid = 0;

            base.phenotype.volume.relativeRuptureVolume = 2f;
            base.phenotype.volume.ruptureVolume         = phenotype.volume.total * base.phenotype.volume.relativeRuptureVolume;
            base.phenotype.calcificationRate            = 0;
        }
    }
Пример #7
0
    public override void EnterPhase(int phaseInd)
    {
        PhaseT phase = GetPhaseByInd(phaseInd);

        if (phase.name.Equals(Globals.NS))   //standard necrosis entry
        {
            Debug.Log("dying");
            base.phenotype.isDying = true;
            //update volume constants
            base.phenotype.volume.rFluid       = 0.67f / Globals.timeConst; //unlysed
            base.phenotype.volume.rCytoplasmic = 0.0032f / Globals.timeConst;
            base.phenotype.volume.rNuclear     = 0.013f / Globals.timeConst;

            base.phenotype.volume.nuclearSolid          = 0;
            base.phenotype.volume.fCytoplasmicToNuclear = 0;
            base.phenotype.volume.fFluid = 1f;

            base.phenotype.volume.relativeRuptureVolume = 2f;
            base.phenotype.volume.ruptureVolume         = phenotype.volume.total * base.phenotype.volume.relativeRuptureVolume;
            base.phenotype.calcificationRate            = 0.0042f;
        }
        else if (phase.name.Equals(Globals.NL))   //standard lysis entry
        {
            Debug.Log("lysis has started");
            base.phenotype.isDying = true;
            //update volume constants
            base.phenotype.volume.rFluid       = 0.05f / Globals.timeConst; //lysed
            base.phenotype.volume.rCytoplasmic = 0.0032f / Globals.timeConst;
            base.phenotype.volume.rNuclear     = 0.013f / Globals.timeConst;

            base.phenotype.volume.nuclearSolid          = 0;
            base.phenotype.volume.fCytoplasmicToNuclear = 0;
            base.phenotype.volume.fFluid = 0;

            base.phenotype.volume.relativeRuptureVolume = float.MaxValue;
            base.phenotype.volume.ruptureVolume         = phenotype.volume.total * base.phenotype.volume.relativeRuptureVolume;
            base.phenotype.calcificationRate            = 0.0042f;
        }
    }
Пример #8
0
 public void AddPhase(PhaseT phase)
 {
     phases.Add(phase);
 }
Пример #9
0
 public override void EnterPhase(int phaseInd)
 {
     PhaseT phase = GetPhaseByInd(phaseInd);
 }
Пример #10
0
    public PhaseT GetNextPhase()
    {
        PhaseT currentPhase = GetCurrentPhase();

        return(phases[currentPhase.nextPhaseInd]);
    }
Пример #11
0
    void FixedUpdate()
    {
        if (!Globals.animationRunning)
        {
            return;
        }

        float radius;

        SimulateSecretionAndUptake(Time.deltaTime);

        UpdateVoxelIndex();

        if (!divisionPhase)
        {
            this.phenotype.volume.UpdateVolume(Time.deltaTime);
            //this.phenotype.volume.UpdateVolume(Time.deltaTime * 10f ); //make volume change faster

            radius = this.phenotype.volume.GetRadius();


            //scale for 1 is radius*2 --> different from collider
            this.transform.localScale = new Vector3(radius * 2, radius * 2, radius * 2);

            this.cellCycle.Advance(Time.deltaTime);


            //compute oxygenation
            float necrosisRate = this.ComputeOxygenation();
            this.cellDeath.UpdateTransitionRateForCurrentPhase(necrosisRate);
            this.cellDeath.Advance(Time.deltaTime);


            PhaseT currentPhase = cellCycle.GetCurrentPhase();
            PhaseT deathPhase   = cellDeath.GetCurrentPhase();

            this.GetComponent <Renderer>().material.color = currentPhase.color;
            if (deathPhase.name.Equals(Globals.D))
            {
                this.KillCell();
            }

            if (phenotype.isDying)
            {
                this.GetComponent <Renderer>().material.color = deathPhase.color;
            }

            else if (Globals.cellCnt < Globals.maxCellCnt)
            {
                if (cellCycle.isDivisionPhase)
                {
                    if (Globals.animateDivision)
                    {
                        divisionPhase     = true;
                        elongationStepCnt = 0;
                    }
                    else   //divide abruptly without animation

                    {
                        this.Divide(randDirection);
                    }
                }
            }
        }
        else
        {
            if (!phenotype.isDying)
            {
                //division step with animation
                if (elongationStepCnt < totalElongationStepCnt)
                {
                    radius = this.phenotype.volume.GetRadius();
                    float scaleCoef  = ((float)elongationStepCnt / totalElongationStepCnt) * 0.5f + 1f;                                //elongate in one dimension
                    float scaleCoef2 = Mathf.Sqrt((4f / 7f) / scaleCoef);                                                              //shrink other dimensions to keep volume fixed

                    this.transform.localScale = new Vector3(radius * scaleCoef2 * 2, radius * scaleCoef * 2, radius * scaleCoef2 * 2); //scale in y direction and then rotate
                    transform.rotation        = Quaternion.LookRotation(randDirection);

                    elongationStepCnt++;
                }
                else
                {
                    this.Divide(Vector3.up);
                    divisionPhase = false;
                }
            }
        }


        //to be able to retrieve position when loaded from file
        this.phenotype.position = this.transform.position;
        this.phenotype.scale    = this.transform.localScale;
        this.phenotype.rotation = this.transform.rotation;
        this.phenotype.color    = this.GetComponent <Renderer>().material.color;

        totalElapsedTime += Time.deltaTime;
    }