Counting Cell Cycles


74
views
0
3 months ago by
System: macOS Sierra v 10.12.6
CC3D version: 3.7.6

I have a simulation where I have two cell types: dividing and non dividing.
<Plugin Name="CellType">
      <CellType TypeId="0" TypeName="Medium"/>
      <CellType TypeId="1" TypeName="dividing"/>
      <CellType TypeId="2" TypeName="nondividing"/>
</Plugin>​


I am also using the Growth and Mitosis steppables. The simulation starts off with a dividing cell that will grow to a certain size and then have a certain probability of the daughter cells remaining as dividing cells or become non dividing cells. This will repeat for how ever many MCS I chose.  

My goal is to try to determine how many times a cell divides before it becomes a nondividing cell. I thought about using the cell.dict like the manual suggested but I haven't had success.  How can I get a dictionary (or a list or something similar) containing cell ids and the number of times it divided?  

from PySteppables import *
import CompuCell
import sys
import random
import numpy as np
from PySteppablesExamples import MitosisSteppableBase

class ConstraintInitializerSteppable(SteppableBasePy):
    def __init__(self,_simulator,_frequency=1):
        SteppableBasePy.__init__(self,_simulator,_frequency)
    def start(self):
        cellcell = self.newCell(self.DIVIDING)
        self.cellField[100:105, 100:105, 0] = cellcell
        cellcell.targetVolume=36
        cellcell.lambdaVolume=2.0 

class GrowthSteppable(SteppableBasePy):
    def __init__(self,_simulator,_frequency=1):
        SteppableBasePy.__init__(self,_simulator,_frequency)
    def step(self,mcs):
        for cell in self.cellListByType(self.DIVIDING):
            cell.targetVolume+=0.1 

class MitosisSteppable(MitosisSteppableBase):
    
    def __init__(self,_simulator,_frequency=1):
        MitosisSteppableBase.__init__(self,_simulator, _frequency)
        
    def step(self,mcs):
        cells_to_divide=[]
        for cell in self.cellList:
            if cell.volume > 72:
                cells_to_divide.append(cell)
        
        for cell in cells_to_divide:
            self.divideCellRandomOrientation(cell)

    def updateAttributes(self):
        roll_dice = random.random()
        self.parentCell.targetVolume /= 2                 
        self.cloneParent2Child()
        
        for cell in self.cellList:
            if roll_dice > 0.3 :             
                self.childCell.type = self.DIVIDING
                self.parentCell.type = self.DIVIDING
            else:
               self.childCell.type = self.NONDIVIDING
               self.parentCell.type = self.NONDIVIDING
        
Community: CompuCell3D

1 Answer


2
3 months ago by
As you suspected the dictionary is one way to do it. When you create a cell at the start of the simulation and every time the cell divides you can increment a counter in a dictionary associated with the cell. When you create the cell (the last line is the dictionary entry);

    def start(self):
        cellcell = self.newCell(self.DIVIDING)
        self.cellField[100:105, 100:105, 0] = cellcell
        cellcell.targetVolume=36
        cellcell.lambdaVolume=2.0
        cellcell.targetSurface=24
        cellcell.lambdaSurface=2.0
        cellcell.dict['age'] = 1  ### The "age" of the cell, increment every time the cell divides​

When the cell divides;

    def updateAttributes(self):
        roll_dice = random.random()
        self.parentCell.targetVolume /= 2                 
        self.cloneParent2Child()
       
        for cell in self.cellList:
            if roll_dice > 0.3 :            
                self.childCell.type = self.DIVIDING
                self.parentCell.type = self.DIVIDING

            else:
               self.childCell.type = self.NONDIVIDING
               self.parentCell.type = self.NONDIVIDING

        self.childCell.dict['age'] += 1   ### The "age" of the cell, increment everytime the cell divides
        self.parentCell.dict['age'] += 1  ### The "age" of the cell, increment everytime the cell divides​

Note that the cell’s age always increments on a divide regardless of if it is going to be a DIVIDING or NONDIVIDING. But if it is NONDIVIDING it’ll never divide again, and the counter will never get incremented.

You can periodically print out the list of cells of the two types and their ages;

        if self.mcs % 100 == 0:         ###  only report every 100 mcs
            type1=0;   type2=0          ###
            print "\nmcs=",mcs          ###
            for cell in self.cellList:  ###
                if cell.type == 1:      ###
                    type1 +=1           ###
                if cell.type == 2:      ###
                    type2 +=1           ###
                print "cell id,type,age",cell.id,cell.type,cell.dict['age']  ###
            print "Type1=",type1,"  Type2=",type2,"\n" ###​

Attached is a zipped CC3D project that implements the above and graphs the count of each cell type versus mcs. (I’ve highlighted the key lines with “###”.)

File attached: divide_nondivide_track.zip (10.39 KB)

Thank you! This did the trick.
written 3 months ago by Rolando Ruiz  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »