Attachment 'angio_growth_steppables_08052009_01_45_36__CBOannotated.py'

Download

   1 ####
   2 #### The simulation code is compatible with CompuCell3D ver 3.3.1
   3 ####
   4 from PySteppables import *
   5 import CompuCell
   6 import sys
   7 import time
   8 
   9 # CBO CBO_Object SystemQuality ComputationalPlatform Compucell3D
  10 # CBO CBO_Process CellProcess CellGrowth
  11 class VolumeParamSteppable(SteppablePy):
  12    def __init__(self,_simulator,_frequency=1,_areaThresh=0,_nutrientThresh=0,_necroticThresh=0):
  13       SteppablePy.__init__(self,_frequency)
  14       self.simulator=_simulator
  15       self.inventory=self.simulator.getPotts().getCellInventory()
  16       self.cellList=CellList(self.inventory)
  17       self.nTrackerPlugin=CompuCell.getNeighborTrackerPlugin()
  18       self.areaThresh = _areaThresh
  19       self.nutrientThresh = _nutrientThresh
  20       self.necroticThresh = _necroticThresh
  21       self.fieldNameNeoVascular = 'VEGF2'
  22       self.fieldNameNormal = 'Oxygen'
  23       #self.output_file = open("CellDiffusionData_08052009_01_45_36.txt",'w')
  24       
  25    def start(self):
  26       for cell in self.cellList:
  27          if cell.type==4 or cell.type==5 or cell.type==6:
  28 	    cell.targetVolume=60
  29             cell.lambdaVolume=13.0
  30 	    cell.targetSurface=150
  31             cell.lambdaSurface=3.0
  32          else:
  33 	    cell.targetVolume=33.0
  34             cell.lambdaVolume=10.0
  35 	    cell.targetSurface=90.0
  36             cell.lambdaSurface=2
  37 	 
  38    def step(self,mcs):
  39       fieldNeoVasc=CompuCell.getConcentrationField(self.simulator,self.fieldNameNeoVascular)
  40       fieldMalig=CompuCell.getConcentrationField(self.simulator,self.fieldNameNormal)
  41       #print mcs
  42       
  43       for cell in self.cellList:
  44 
  45          # Inactive neovascular differentiation
  46          if cell.type == 6:
  47             totalArea = 0
  48             pt=CompuCell.Point3D()
  49             pt.x=int(round(cell.xCM/max(float(cell.volume),0.001)))
  50             pt.y=int(round(cell.yCM/max(float(cell.volume),0.001)))
  51             pt.z=int(round(cell.zCM/max(float(cell.volume),0.001)))
  52             concentration=fieldNeoVasc.get(pt)
  53             if concentration>0.5:
  54             
  55 	      cellNeighborList=CellNeighborListAuto(self.nTrackerPlugin,cell)
  56  	      for neighborSurfaceData in cellNeighborList:
  57 		  #Check to ensure cell neighbor is not medium
  58 	          if neighborSurfaceData.neighborAddress:
  59 	 	     if neighborSurfaceData.neighborAddress.type == 5 or neighborSurfaceData.neighborAddress.type == 6 or neighborSurfaceData.neighborAddress.type == 7:
  60 			   
  61 			#sum up common surface area of cell with its neighbors
  62 		        totalArea+=neighborSurfaceData.commonSurfaceArea 
  63 			#print "concentration: ", concentration,"  commonSurfaceArea:",neighborSurfaceData.commonSurfaceArea
  64 	      print cell.type,totalArea     
  65 	      if totalArea < 70:
  66 		 #Growth rate equation
  67 		 #print cell.type,"##surface area",cell.surface,"##cell volume:",cell.volume,"##cell target volume:",cell.targetVolume,"##common surface area:",totalArea
  68 		 cell.targetVolume+=0.06*concentration/(0.5 + concentration)
  69 		 cell.targetSurface+=0.15*concentration/(0.5 + concentration)
  70 	         #print 0.02*concentration/(0.5 + concentration)+0.04
  71          
  72          ## Active neovascular growth
  73          if cell.type == 4:
  74             totalArea = 0
  75             pt=CompuCell.Point3D()
  76             pt.x=int(round(cell.xCM/max(float(cell.volume),0.00000001)))
  77             pt.y=int(round(cell.yCM/max(float(cell.volume),0.00000001)))
  78             pt.z=int(round(cell.zCM/max(float(cell.volume),0.00000001)))
  79             concentration=fieldNeoVasc.get(pt)
  80             if concentration>0.5:
  81             
  82 	      cellNeighborList=CellNeighborListAuto(self.nTrackerPlugin,cell)
  83  	      for neighborSurfaceData in cellNeighborList:
  84 		  #Check to ensure cell neighbor is not medium
  85 	          if neighborSurfaceData.neighborAddress:
  86 	 	     if neighborSurfaceData.neighborAddress.type == 5 or neighborSurfaceData.neighborAddress.type == 7 or neighborSurfaceData.neighborAddress.type == 6:
  87 			   
  88 			#sum up common surface area of cell with its neighbors
  89 		        totalArea+=neighborSurfaceData.commonSurfaceArea 
  90 			#print "concentration: ", concentration,"  commonSurfaceArea:",neighborSurfaceData.commonSurfaceArea
  91 	      #print cell.type,totalArea      
  92 	      if totalArea < 50:
  93 		 #Growth rate equation
  94 		 #print cell.type,"##surface area",cell.surface,"##cell volume:",cell.volume,"##cell target volume:",cell.targetVolume,"##common surface area:",totalArea
  95 		 cell.targetVolume+=0.06*concentration/(0.5 + concentration)
  96 		 cell.targetSurface+=0.15*concentration/(0.5 + concentration)
  97 	         ##print 0.02*concentration/(0.5 + concentration)+0.04
  98 
  99 	 
 100 	    
 101          #Malignat and Hypoxic Cells growth
 102          if cell.type == 1 or cell.type == 2:
 103             #print cell.volume
 104 
 105             pt=CompuCell.Point3D()
 106             pt.x=int(round(cell.xCM/max(float(cell.volume),0.001)))
 107             pt.y=int(round(cell.yCM/max(float(cell.volume),0.001)))
 108             pt.z=int(round(cell.zCM/max(float(cell.volume),0.001)))
 109             #self.output_file.write("%f %f %f " %(cell.xCM/cell.volume, cell.yCM/cell.volume,cell.zCM/cell.volume))
 110 
 111             concentration2=fieldMalig.get(pt)
 112             #switch to Hypoxic cell type
 113             if (concentration2 < self.nutrientThresh and mcs>100):
 114 	       cell.type=2
 115 
 116 	    #switch to Necrotic cell type
 117 	    if (concentration2 < self.necroticThresh and mcs>100):
 118                cell.type=3
 119                
 120             #set growth rate equation
 121             if (mcs>100):
 122 	       cell.targetVolume+=0.04*concentration2/(10+concentration2)
 123                cell.targetSurface+=0.12*concentration2/(10+concentration2)
 124 
 125          #Hypoxic Cells
 126          if cell.type == 2:
 127             #print " #Hypoxic Volume: ", cell.volume
 128             pt=CompuCell.Point3D()
 129             pt.x=int(round(cell.xCM/max(float(cell.volume),0.001)))
 130             pt.y=int(round(cell.yCM/max(float(cell.volume),0.001)))
 131             pt.z=int(round(cell.zCM/max(float(cell.volume),0.001)))
 132             concentration3=fieldMalig.get(pt)
 133             #switch to Necrotic cell type
 134             if (concentration3 < self.necroticThresh and mcs>100):
 135                cell.type=3
 136 	    #switch to Normal cell type
 137 	    if (concentration3 > self.nutrientThresh):
 138                cell.type=1
 139 
 140          # CBO CBO_Process CellProcess CellDeath Necrosis
 141          # GO:0008219 cell death			   
 142          #Necrotic Cells
 143          if cell.type == 3:
 144             #set growth rate equation
 145             cell.targetVolume-=0.5
 146             cell.lambdaSurface=0
 147 	 
 148       #self.output_file.write("\n")   

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2012-11-09 22:32:03, 6.3 KB) [[attachment:angio_growth_steppables_08052009_01_45_36__CBOannotated.py]]
  • [get | view] (2012-11-28 22:23:39, 6.3 KB) [[attachment:angio_growth_steppables_08052009_01_45_36__CBOannotated.txt]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.