コード例 #1
0
 def step(self,mcs):
 ## count down through initial phase offset for each GZ cell
    cells_to_grow=[]  # list of cells to evaluate for growth
    if mcs <= self.T_double:
       for cell in self.cellList:
          if cell.type==3: # GZ cells
             cellDict=CompuCell.getPyAttrib(cell)
             if cellDict["phaseCountdown"]==0:  # if cell has reached or surpassed its initial phase offset
                cells_to_grow.append(cell)  # add cell to list of cells to evaluate for growth
             else:
                cellDict["phaseCountdown"]-=1  # count down phase offset
    else:
       for cell in self.cellList:
          if cell.type==3: # GZ cells
             cells_to_grow.append(cell)
                
 ## Grow each cell that meets criteria for growth by increasing target volume and surface parameters:
    count=0
    if self.pixPerMCS:
       for cell in cells_to_grow:
          cell.targetVolume+=self.pixPerMCS
          cell.targetSurface=int(4*sqrt(cell.volume)+0.5)
          count+=1
    else:
       count_timer=0
       for cell in cells_to_grow:
          cellDict=CompuCell.getPyAttrib(cell)
          if cellDict["growth_timer"] < self.mcsPerPix: # if cell has not reached time to grow
             cellDict["growth_timer"] += 1  # add to growth timer
             count_timer+=1
          else:  # if cell has reached time to grow, increase target volume and surface
             cell.targetVolume+=1
             cell.targetSurface=int(4*sqrt(cell.volume)+0.5)
             cellDict["growth_timer"] = 0
             count+=1
    def updateAttributes(self):

        # self.mitosisSteppable holds important dat from the mitosis
        parentCell = self.mitosisSteppable.parentCell
        childCell = self.mitosisSteppable.childCell

        parentCell.targetVolume/=2.0

        #child inherits parent properties
        childCell.targetVolume = parentCell.targetVolume
        childCell.lambdaVolume = parentCell.lambdaVolume

        # randomly select one of the cells to be a different type
        if random()<0.5:
            childCell.type = parentCell.type
        else:
            childCell.type = self.DIFFERENTIATEDCONDENSING


        # get parent cell lists
        parentDict = CompuCell.getPyAttrib(parentCell)
        childDict = CompuCell.getPyAttrib(childCell)


        mcs=self.simulator.getStep()

        data = MitosisData(mcs, parentCell.id, parentCell.type, childCell.id, childCell.type)
        childDict['relatives'] = [data]
        parentDict['relatives'].append(data)
コード例 #3
0
    def updateAttributes(self):
        '''
        UpdateAttributes is inherited from MitosisSteppableBase
        and is called automatically by the divideCell() function.
        It sets the attributes of the parent and daughter cells
        '''
        parent_cell = self.mitosisSteppable.parentCell
        child_cell = self.mitosisSteppable.childCell

        child_cell.targetVolume = child_cell.volume
        child_cell.lambdaVolume = parent_cell.lambdaVolume
        child_cell.targetSurface = child_cell.surface
        child_cell.lambdaSurface = parent_cell.lambdaSurface
        parent_cell.targetVolume = parent_cell.volume
        parent_cell.targetSurface = parent_cell.surface
        child_cell.type = parent_cell.type

        parent_dict = CompuCell.getPyAttrib(parent_cell)
        child_dict = CompuCell.getPyAttrib(child_cell)
        parent_dict.get('mitosis_times',[]).append(self.mcs - parent_dict.get('last_division_mcs',self.mcs))
        parent_dict['last_division_mcs'] = self.mcs

        # Make a copy of the parent cell's dictionary and attach to child cell
        for key, item in parent_dict.iteritems():
            child_dict[key] = deepcopy(item)
        child_dict['mitosis_times'] = []
コード例 #4
0
 def step(self,mcs):
 ## find y-position of poster-most GZ cell and center of growth zone
    y_post=0
    x_min=999
    x_max=0
    for cell in self.cellList:
       if cell.type==3: # GZ cell
          yCM=cell.yCM/float(cell.volume)
          xCM=cell.xCM/float(cell.volume)
          if yCM>y_post:
             y_post=yCM
          if xCM>x_max:
             x_max=xCM
          elif xCM<x_min:
             x_min=xCM
    x_center=x_min + (x_max-x_min)/2.
 
 ## count down through initial phase offset for each GZ cell and evaluate for y-position
    cells_to_grow=[]  # list of cells to evaluate for growth
    if mcs <= self.T_double:
       for cell in self.cellList:
          if cell.type==3: # GZ cells
             cellDict=CompuCell.getPyAttrib(cell)
             if cellDict["phaseCountdown"]==0:  # if cell has reached or surpassed its initial phase offset
                yCM = cell.yCM/float(cell.volume)
                xCM = cell.xCM/float(cell.volume)
                d = sqrt((xCM - x_center)**2 + (yCM - y_post)**2)
                if d < self.d_sig:
                   cells_to_grow.append(cell)  # add cell to list of cells to evaluate for growth
             else:
                cellDict["phaseCountdown"]-=1  # count down phase offset
    else:
       for cell in self.cellList:
          if cell.type==3: # GZ cells
             yCM=cell.yCM/float(cell.volume)
             xCM=cell.xCM/float(cell.volume)
             d = sqrt((xCM - x_center)**2 + (yCM - y_post)**2)
             if d < self.d_sig:
                cells_to_grow.append(cell)
                
 ## Grow each cell that meets criteria for growth by increasing target volume and surface parameters:
    count=0
    if self.pixPerMCS:
       for cell in cells_to_grow:
          cell.targetVolume+=self.pixPerMCS
          cell.targetSurface=int(4*sqrt(cell.volume)+0.5)
          count+=1
    else:
       count_timer=0
       for cell in cells_to_grow:
          cellDict=CompuCell.getPyAttrib(cell)
          if cellDict["growth_timer"] < self.mcsPerPix: # if cell has not reached time to grow
             cellDict["growth_timer"] += 1  # add to growth timer
             count_timer+=1
          else:  # if cell has reached time to grow, increase target volume and surface
             cell.targetVolume+=1
             cell.targetSurface=int(4*sqrt(cell.volume)+0.5)
             cellDict["growth_timer"] = 0
             count+=1
コード例 #5
0
    def updateAttributes(self):
        self.parentCell.targetVolume /= 2.0  # reducing parent target volume
        self.cloneParent2Child()
        parentARF = CompuCell.getPyAttrib(self.parentCell)["ARF"]
        childDict = CompuCell.getPyAttrib(self.childCell)
        childDict["ARF"] = parentARF + ((random.gauss(0.5, 0.17) - 0.5) * 0.1
                                        )  # child cell slightly mutates ARF

        if childDict["ARF"] >= 0.8:
            self.childCell.type = self.RESISTENTBACTERIA
        else:
            self.childCell.type = self.REGULARBACTERIA
コード例 #6
0
 def updateAttributes(self):
   parentCell=self.mitosisSteppable.parentCell
   childCell=self.mitosisSteppable.childCell
   childCell.type=parentCell.type
   ...
   bionetAPI.copyBionetworkFromParent(parentCell,childCell)
   ...
   parentCellDict=CompuCell.getPyAttrib(parentCell)
   childCellDict=CompuCell.getPyAttrib(childCell)
   for key in parentCellDict:
     if (key!="Bionetwork"): 
       childCellDict[key] = deepcopy(parentCellDict[key])
コード例 #7
0
 def updateAttributes(self):
     childCell = self.mitosisSteppable.childCell
     parentCell = self.mitosisSteppable.parentCell
     childCell.type = parentCell.type    
     parentCell.targetVolume = tVol
     childCell.targetVolume = tVol
     childCell.lambdaVolume = parentCell.lambdaVolume;
     # inherite properties from parent cells
     self.copySBMLs(_fromCell=parentCell,_toCell=childCell)
     childCellDict=CompuCell.getPyAttrib(childCell)
     parentCellDict=CompuCell.getPyAttrib(parentCell)
     childCellDict["D"]=random.uniform(0.9,1.0)*parentCellDict["D"]
     childCellDict["N"]=random.uniform(0.9,1.0)*parentCellDict["N"]
     childCellDict["B"]=random.uniform(0.9,1.0)*parentCellDict["B"]
     childCellDict["R"]=random.uniform(0.9,1.0)*parentCellDict["R"]
コード例 #8
0
    def step(self, mcs):
        #collagen degradation

        clCell = self.potts.createCell()
        clCell.type = self.C_LYSED
        llCell = self.potts.createCell()
        llCell.type = self.L_LYSED
        state = {}
        self.fieldNameMMP = 'MMP'
        self.fieldNameI = 'I'
        fieldMMP = CompuCell.getConcentrationField(self.simulator,
                                                   self.fieldNameMMP)
        fieldI = CompuCell.getConcentrationField(self.simulator,
                                                 self.fieldNameI)
        global var
        lysed_id = []
        for cell in self.cellList:
            state = {}
            cellDict = CompuCell.getPyAttrib(cell)
            if cell.type == self.C1 or cell.type == self.LAMININ or cell.type == self.NC1:
                MMPc = fieldMMP[cell.xCOM, cell.yCOM, cell.zCOM]
                Ic = fieldI[cell.xCOM, cell.yCOM, cell.zCOM]
                if Ic > 0.0005:
                    T1 = (MMPc / Ic)
                    if T1 >= var:
                        cell.type = self.C_LYSED
                        lysed_id.append(cell)

        for cell in lysed_id:
            cellDict = CompuCell.getPyAttrib(cell)
            if hasattr(cell, "mcsL") == True:
                cell.targetvolume -= 0.005
                cell.lambdaVolume = 20.0
            else:
                cellDict = CompuCell.getPyAttrib(cell)
                mcs = self.simulator.getStep()
                mcsL = mcs
                cellDict["mcsL"] = mcsL

        mcs = self.simulator.getStep()
        for cell in self.cellList:
            cellDict = CompuCell.getPyAttrib(cell)
            if cell.type == self.C_LYSED:
                for val in cellDict.items():
                    cd1 = val[1]

                    if cell.type == self.C_LYSED and mcs == (cd1 + 20):
                        cell.type = self.NC1
コード例 #9
0
 def start(self):
     for cell in self.cellList:
         vasculo_attributes=CompuCell.getPyAttrib(cell)
         
         if cell.type==1:
             vasculo_attributes['cell.receptor.VEGFR1']=100
             vasculo_attributes['cell.receptor.VEGFR2']=1000
コード例 #10
0
 def step(self,mcs):
     for cell in self.cellList:
         mitDataList=CompuCell.getPyAttrib(cell)
         if len(mitDataList) > 0:
             print "MITOSIS DATA FOR CELL ID",cell.id
             for mitData in mitDataList:
                 print mitData
コード例 #11
0
 def start(self):
   #Loading model
   Name = 'DeltaNotch'
   Key  = 'DN'
   
   simulationDir=os.path.dirname (os.path.abspath( __file__ ))
   Path= os.path.join(simulationDir,'DN_Collier.sbml')
   Path=os.path.abspath(Path) # normalizing path
   
   IntegrationStep = 0.2
   bionetAPI.loadSBMLModel(Name, Path, Key, IntegrationStep)
   
   bionetAPI.addSBMLModelToTemplateLibrary(Name,'TypeA')
   bionetAPI.initializeBionetworks()
   
   #Initial conditions
   import random 
   
   state={} #dictionary to store state veriables of the SBML model
   
   for cell in self.cellList:
     if (cell):
       state['D'] = random.uniform(0.9,1.0)
       state['N'] = random.uniform(0.9,1.0)        
       bionetAPI.setBionetworkState(cell.id,'DeltaNotch',state) 
       
       cellDict=CompuCell.getPyAttrib(cell)
       cellDict['D']=state['D']
       cellDict['N']=state['N']
コード例 #12
0
 def step(self, mcs):
     
     # ######### Update all bionetwork integrator(s) ###########
     bionetAPI.timestepBionetworks()
     
     bionetAPI.printBionetworkState(1)
     
     # ######## Implement cell growth by increasing target volume ##########
     for cell in self.cellList:
         dictionaryAttrib = CompuCell.getPyAttrib( cell )
         cell.targetVolume = cell.volume + 0.1*dictionaryAttrib["InitialVolume"]
     
     
     # ###### Retrieve delta values and set cell bionetwork template libraries according to delta concentration ########
     for cell in self.cellList:
         currentDelta = bionetAPI.getBionetworkValue( "DN_di", cell.id )
         if( currentDelta > 0.5 ):
             if self.cellTypeMap[cell.type] == "LowDelta":
                 bionetAPI.setBionetworkValue( "TemplateLibrary", "HighDelta", cell.id )
         else:
             if self.cellTypeMap[cell.type] == "HighDelta":
                 bionetAPI.setBionetworkValue( "TemplateLibrary", "LowDelta", cell.id )
     
     
     # ####### Set all cell dbari values as a function of neighbor delta values #########
     for cell in self.cellList:
         weightedSumOfNeighborDeltaValues = 0.0
         neighborContactAreas = bionetAPI.getNeighborContactAreas( cell.id )
         neighborDeltaValues = bionetAPI.getNeighborProperty( "DN_di", cell.id )
         
         for neighborID in neighborContactAreas.keys():
             weightedSumOfNeighborDeltaValues += (neighborContactAreas[neighborID] * neighborDeltaValues[neighborID])
         
         bionetAPI.setBionetworkValue( "DN_dbari", weightedSumOfNeighborDeltaValues/cell.surface, cell.id )
コード例 #13
0
 def mitosis_visualization_countdown(self):
     for cell in self.cellListByType(4): # Mitosis cell
         cellDict = CompuCell.getPyAttrib(cell)
         if cellDict['mitosisVisualizationTimer'] <= 0:
             cell.type = cellDict['returnToCellType']
         else:
             cellDict['mitosisVisualizationTimer'] -= 1
 def finish(self):
     for cell in self.cellList:
         dataList = CompuCell.getPyAttrib(cell)
         if len(dataList['relatives'])>0:
             print "MITOTIC DATA FOR CELL ID:",cell.id
             for data in dataList['relatives']:
                 print data
コード例 #15
0
 def step(self,mcs):
 ## find y-position of poster-most segment boundary, y_border
    y_border=0
    for cell in self.cellList:
       if cell.type==2: # segment 2 cell--most posterior segment
          yCM=cell.yCM/float(cell.volume)
          if yCM>y_border:
             y_border=yCM
 
 ## count down through initial phase offset for each GZ cell and evaluate for y-position
    cells_to_grow=[]  # list of cells to evaluate for growth
    if mcs <= self.T_double:
       for cell in self.cellList:
          if cell.type==3: # GZ cells
             cellDict=CompuCell.getPyAttrib(cell)
             if cellDict["phaseCountdown"]==0:  # if cell has reached or surpassed its initial phase offset
                yCM = cell.yCM/float(cell.volume)
                if yCM > y_border + self.y_sig:
                   cells_to_grow.append(cell)  # add cell to list of cells to evaluate for growth
             else:
                cellDict["phaseCountdown"]-=1  # count down phase offset
    else:
       for cell in self.cellList:
          if cell.type==3: # GZ cells
             yCM=cell.yCM/float(cell.volume)
             if yCM > y_border + self.y_sig:
                cells_to_grow.append(cell)
                
 ## Grow each cell that meets criteria for growth by increasing target volume and surface parameters:
    count=0
    if self.pixPerMCS:
       for cell in cells_to_grow:
          cell.targetVolume+=self.pixPerMCS
          cell.targetSurface=int(4*sqrt(cell.volume)+0.5)
          count+=1
    else:
       count_timer=0
       for cell in cells_to_grow:
          cellDict=CompuCell.getPyAttrib(cell)
          if cellDict["growth_timer"] < self.mcsPerPix: # if cell has not reached time to grow
             cellDict["growth_timer"] += 1  # add to growth timer
             count_timer+=1
          else:  # if cell has reached time to grow, increase target volume and surface
             cell.targetVolume+=1
             cell.targetSurface=int(4*sqrt(cell.volume)+0.5)
             cellDict["growth_timer"] = 0
             count+=1
コード例 #16
0
 def find_GB_division_count(self):
     division_count = 0
     for cell in self.cellList:
         if cell:
             cellDict = CompuCell.getPyAttrib(cell)
             division_count += cellDict['divided']
             cellDict['divided'] = 0
     return division_count
コード例 #17
0
 def updateAttributes(self):
    parentCell=self.mitosisSteppable.parentCell
    childCell=self.mitosisSteppable.childCell
          
    childCell.targetVolume = childCell.volume
    childCell.lambdaVolume = parentCell.lambdaVolume
    childCell.targetSurface = childCell.surface
    childCell.lambdaSurface = parentCell.lambdaSurface
    parentCell.targetVolume = parentCell.volume
    parentCell.targetSurface = parentCell.surface
    childCell.type = parentCell.type
    
    parentDict=CompuCell.getPyAttrib(parentCell)
    childDict=CompuCell.getPyAttrib(childCell)
 ### Make a copy of the parent cell's dictionary and attach to child cell   
    for key, item in parentDict.items():
       childDict[key]=deepcopy(parentDict[key])
コード例 #18
0
    def setStepSizeForCell(self, _modelName='', _cell=None, _stepSize=1.0):
        import CompuCell
        dict_attrib = CompuCell.getPyAttrib(_cell)

        try:
            sbmlSolver = dict_attrib['SBMLSolver'][_modelName]
        except LookupError, e:
            return
コード例 #19
0
 def mitosisVisualizationCountdown(self):
     for cell in self.cellList:
         if cell.type == 4:  # if Mitosis cell
             cellDict = CompuCell.getPyAttrib(cell)
             if cellDict['mitosisVisualizationTimer'] <= 0:
                 cell.type = cellDict['returnToCellType']
             else:
                 cellDict['mitosisVisualizationTimer'] -= 1
コード例 #20
0
 def deleteSBMLFromCell(self, _modelName='', _cell=None):
     import CompuCell
     dict_attrib = CompuCell.getPyAttrib(_cell)
     try:
         sbmlDict = dict_attrib['SBMLSolver']
         del sbmlDict[_modelName]
     except LookupError, e:
         pass
コード例 #21
0
    def updateAttributes(self):
        parentCell = self.mitosisSteppable.parentCell
        childCell = self.mitosisSteppable.childCell

        childCell.targetVolume = childCell.volume
        childCell.lambdaVolume = parentCell.lambdaVolume
        childCell.targetSurface = childCell.surface
        childCell.lambdaSurface = parentCell.lambdaSurface
        parentCell.targetVolume = parentCell.volume
        parentCell.targetSurface = parentCell.surface
        childCell.type = parentCell.type

        parentDict = CompuCell.getPyAttrib(parentCell)
        childDict = CompuCell.getPyAttrib(childCell)
        ### Make a copy of the parent cell's dictionary and attach to child cell
        for key, item in parentDict.items():
            childDict[key] = deepcopy(parentDict[key])
コード例 #22
0
 def step(self,mcs):
     
   self.scalarFieldG.clear()
   
   for cell in self.cellList:
     if cell:
       cellDict=CompuCell.getPyAttrib(cell)
       self.scalarFieldG[cell] = cellDict['GTPase']
コード例 #23
0
 def setStepSizeForCell(self, _modelName='',_cell=None,_stepSize=1.0):
     import CompuCell        
     dict_attrib = CompuCell.getPyAttrib(_cell)
     
     try:
         sbmlSolver=dict_attrib['SBMLSolver'][_modelName]
     except LookupError,e:
         return
コード例 #24
0
    def step(self, mcs):

        self.scalarFieldG.clear()

        for cell in self.cellList:
            if cell:
                cellDict = CompuCell.getPyAttrib(cell)
                self.scalarFieldG[cell] = cellDict['GTPase']
コード例 #25
0
 def deleteSBMLFromCell(self,_modelName='',_cell=None):
         import CompuCell
         dict_attrib=CompuCell.getPyAttrib(_cell)            
         try:
             sbmlDict=dict_attrib['SBMLSolver']
             del sbmlDict[_modelName]
         except LookupError,e:
             pass            
コード例 #26
0
 def deleteSBMLFromCellTypes(self, _modelName, _types=[]):
     import CompuCell
     for cell in self.cellListByType(*_types):
         dict_attrib = CompuCell.getPyAttrib(cell)
         try:
             sbmlDict = dict_attrib['SBMLSolver']
             del sbmlDict[_modelName]
         except LookupError, e:
             pass
コード例 #27
0
 def start(self):
    self.y_EN_pos=self.find_posterior_EN_stripe()
    self.y_EN_ant=self.find_anterior_EN_stripe()
    self.y_GZ_border=self.find_y_GZ_mitosis_border()
    for cell in self.cellList:
       region=self.assign_cell_region(cell)
       # self.initiate_cell_volume(cell)  ## Initiates cells with new volumes to distribute mitoses in time
       cellDict = CompuCell.getPyAttrib(cell)
       cellDict["growth_timer"]=self.attach_growth_timer(cell)  ## attached a countdown timer for cell growth
コード例 #28
0
 def step(self,mcs):
   self.scalarFieldDelta.clear()
   self.scalarFieldNotch.clear()
   
   for cell in self.cellList:
     if cell:
       cellDict=CompuCell.getPyAttrib(cell)
       self.scalarFieldDelta[cell]=cellDict['D']
       self.scalarFieldNotch[cell]=cellDict['N']
コード例 #29
0
    def step(self, mcs):
        cells_to_divide = []
        for cell in self.cellList:
            dictionaryAttrib = CompuCell.getPyAttrib(cell)
            if cell.volume > dictionaryAttrib["DivideVolume"]:
                cells_to_divide.append(cell)

        for cell in cells_to_divide:
            self.divideCellRandomOrientation(cell)
コード例 #30
0
 def step(self,mcs):
    for cell in self.cellList:
       #pyAttrib=cell.pyAttrib
       pyAttrib=CompuCell.getPyAttrib(cell)
       pyAttrib[0]=[cell.id*mcs,cell.id*(mcs-1)]
       if not mcs % 20:
          print "CELL ID modified=",pyAttrib," true=",cell.id,
          print " ref count=",sys.getrefcount(pyAttrib),
          print " ref count=",sys.getrefcount(pyAttrib)
コード例 #31
0
 def deleteSBMLFromCellTypes(self,_modelName,_types=[]):
     import CompuCell
     for cell in self.cellListByType(*_types):
         dict_attrib=CompuCell.getPyAttrib(cell)            
         try:
             sbmlDict=dict_attrib['SBMLSolver']
             del sbmlDict[_modelName]
         except LookupError,e:
             pass    
コード例 #32
0
 def step(self,mcs):
     cells_to_divide=[]
     for cell in self.cellList:
         dictionaryAttrib = CompuCell.getPyAttrib( cell )
         if cell.volume > dictionaryAttrib["DivideVolume"]:
             cells_to_divide.append(cell)
             
     for cell in cells_to_divide:
         self.divideCellRandomOrientation(cell)
コード例 #33
0
 def grow_cell(self, cell):
     cellDict = CompuCell.getPyAttrib(cell)
     region = cellDict["region"]
     r_grow = self.r_grow_list[region]
     if cellDict["growth_timer"] >= 1:
         if cell.targetVolume <= self.Vmax:
             cell.targetVolume += int(cellDict["growth_timer"])
             cellDict["growth_timer"] = 0
     else:
         cellDict["growth_timer"] += r_grow
コード例 #34
0
 def make_mitosis_list(self):
     mitosis_list = []
     for cell in self.cellList:
         cellDict = CompuCell.getPyAttrib(cell)
         region = cellDict["region"]
         mitosis_probability = self.r_mitosis_list[region] / self.window
         if mitosis_probability >= random():
             if cell.volume >= self.Vmin_divide:
                 mitosis_list.append(cell)
     return mitosis_list
コード例 #35
0
 def start(self):
    self.y_EN_pos=self.find_posterior_EN_stripe()
    self.y_EN_ant=self.find_anterior_EN_stripe()
    self.y_GZ_border=self.find_y_GZ_mitosis_border()
    for cell in self.cellList:
       #region=self.assign_cell_region(cell)
       self.assign_cell_region(cell)
       cellDict = CompuCell.getPyAttrib(cell)
       cellDict['divided']=0
       cellDict['divided_GZ']=0
コード例 #36
0
 def grow_cell(self,cell):
    cellDict=CompuCell.getPyAttrib(cell)
    region=cellDict["region"]
    r_grow=self.r_grow_list[region]
    if cellDict["growth_timer"] >= 1:
       if cell.targetVolume<=self.Vmax:
          cell.targetVolume+=int(cellDict["growth_timer"])
          cellDict["growth_timer"]=0
    else:
       cellDict["growth_timer"]+=r_grow
コード例 #37
0
 def step(self,mcs):
     print "INSIDE Protein Expression STEPPABLE"
     randommultiplier1=uniform(0.95,1.05)
     randommultiplier2=uniform(0.95,1.05)
     for cell in self.cellList:
         vasculo_attributes=CompuCell.getPyAttrib(cell)
         if cell.type==1:
            
             vasculo_attributes['cell.receptor.VEGFR1']*=randommultiplier1
             vasculo_attributes['cell.receptor.VEGFR2']*=randommultiplier2
コード例 #38
0
 def make_mitosis_list(self):
    mitosis_list=[]
    for cell in self.cellList:
       cellDict=CompuCell.getPyAttrib(cell)
       region=cellDict["region"]
       mitosis_probability=self.r_mitosis_list[region]/self.window
       if mitosis_probability>=random():      
          if cell.volume >= self.Vmin_divide:
             mitosis_list.append(cell)
    return mitosis_list
コード例 #39
0
 def start(self):
     self.y_EN_pos = self.find_posterior_EN_stripe()
     self.y_EN_ant = self.find_anterior_EN_stripe()
     self.y_GZ_border = self.find_y_GZ_mitosis_border()
     for cell in self.cellList:
         region = self.assign_cell_region(cell)
         # self.initiate_cell_volume(cell)  ## Initiates cells with new volumes to distribute mitoses in time
         cellDict = CompuCell.getPyAttrib(cell)
         cellDict["growth_timer"] = self.attach_growth_timer(
             cell)  ## attached a countdown timer for cell growth
コード例 #40
0
    def updateAttributes(self):
        self.parentCell.targetVolume /= 2.0  # reducing parent target volume
        self.cloneParent2Child()

        # for more control of what gets copied from parent to child use cloneAttributes function
        # self.cloneAttributes(sourceCell=self.parentCell, targetCell=self.childCell, no_clone_key_dict_list = [attrib1, attrib2] )

        if random() < 0.5:
            self.childCell.type = self.parentCell.type
        else:
            self.childCell.type = self.DP

        parentCellList = []
        parentCellList = CompuCell.getPyAttrib(self.parentCell)
        childCellList = []
        childCellList = CompuCell.getPyAttrib(self.childCell)

        mcs = self.simulator.getStep()
        mitData = MitosisData(mcs, self.parentCell.id, self.parentCell.type,
                              self.childCell.id, self.childCell.type)
コード例 #41
0
 def copySBMLs(self,_fromCell,_toCell,_sbmlNames=[],_options=None):
     sbmlNamesToCopy=[]
     import CompuCell
     if not(len(_sbmlNames)): 
         #if user does not specify _sbmlNames we copy all SBML networks
         try:
             dict_attrib=CompuCell.getPyAttrib(_fromCell)                
             sbmlDict=dict_attrib['SBMLSolver']
             sbmlNamesToCopy=sbmlDict.keys()
         except LookupError,e:
             pass 
コード例 #42
0
 def step(self,mcs):     
     self.scalarFieldD.clear()
     self.scalarFieldN.clear()
     self.scalarFieldB.clear()
     self.scalarFieldR.clear()
     for cell in self.cellListByType(1):
         cellDict=CompuCell.getPyAttrib(cell)
         self.scalarFieldD[cell]=cellDict['D']
         self.scalarFieldN[cell]=cellDict['N']
         self.scalarFieldB[cell]=cellDict['B']
         self.scalarFieldR[cell]=cellDict['R']    
コード例 #43
0
    def timestepCellSBML(self):
        import CompuCell

        #timestepping SBML attached to cells
        for cell in self.cellList:
            dict_attrib = CompuCell.getPyAttrib(cell)
            if dict_attrib.has_key('SBMLSolver'):
                sbmlDict = dict_attrib['SBMLSolver']

                for modelName, rrTmp in sbmlDict.iteritems():
                    rrTmp.timestep()  #integrating SBML
コード例 #44
0
 def timestepCellSBML(self):
     import CompuCell
     
     #timestepping SBML attached to cells
     for cell in self.cellList:
         dict_attrib=CompuCell.getPyAttrib(cell)
         if dict_attrib.has_key('SBMLSolver'):
             sbmlDict=dict_attrib['SBMLSolver']
         
             for modelName, rrTmp in sbmlDict.iteritems():
                 rrTmp.timestep() #integrating SBML
コード例 #45
0
 def copySBMLs(self, _fromCell, _toCell, _sbmlNames=[], _options=None):
     sbmlNamesToCopy = []
     import CompuCell
     if not (len(_sbmlNames)):
         #if user does not specify _sbmlNames we copy all SBML networks
         try:
             dict_attrib = CompuCell.getPyAttrib(_fromCell)
             sbmlDict = dict_attrib['SBMLSolver']
             sbmlNamesToCopy = sbmlDict.keys()
         except LookupError, e:
             pass
コード例 #46
0
 def start(self):
    self.y_EN_pos=self.find_posterior_EN_stripe()
    self.y_EN_ant=self.find_anterior_EN_stripe()
    self.y_GZ_border=self.find_y_GZ_mitosis_border()
    for cell in self.cellList:
       region=self.assign_cell_region(cell)
       cellDict = CompuCell.getPyAttrib(cell)
       cellDict['growth_timer']=self.attach_growth_timer(cell)  ## attached a countdown timer for cell growth
       cellDict['divided']=0
       cellDict['divided_GZ']=0
       cellDict['mitosis_times']=[]
       cellDict['last_division_mcs']=0
コード例 #47
0
    def deleteSBMLFromCellIds(self, _modelName, _ids=[]):
        import CompuCell
        for id in _ids:
            cell = self.inventory.attemptFetchingCellById(id)
            if not cell:
                continue

            dict_attrib = CompuCell.getPyAttrib(cell)
            try:
                sbmlDict = dict_attrib['SBMLSolver']
                del sbmlDict[_modelName]
            except LookupError, e:
                pass
コード例 #48
0
 def deleteSBMLFromCell(self, _modelName='', _cell=None):
     """
     Deletes SBML from a particular cell
     :param _modelName {str}: model name
     :param _cell {obj}: CellG cell obj
     :return: None
     """
     import CompuCell
     dict_attrib = CompuCell.getPyAttrib(_cell)
     try:
         sbmlDict = dict_attrib['SBMLSolver']
         del sbmlDict[_modelName]
     except LookupError, e:
         pass
コード例 #49
0
    def timestepCellSBML(self):
        """
        advances (integrats forward) models stored as attributes of cells
        :return: None
        """
        import CompuCell

        # timestepping SBML attached to cells
        for cell in self.cellList:
            dict_attrib = CompuCell.getPyAttrib(cell)
            if dict_attrib.has_key('SBMLSolver'):
                sbmlDict = dict_attrib['SBMLSolver']

                for modelName, rrTmp in sbmlDict.iteritems():
                    rrTmp.timestep()  # integrating SBML
コード例 #50
0
    def step(self, mcs):

        # ######### Update bionetwork integrator(s) for all cells ###########
        bionetAPI.timestepBionetworks()

        # ######## Implement cell growth by increasing target volume ##########
        for cell in self.cellList:
            if cell.id > self.initialNumberOfCells:
                ## All new cells are assigned a target volume of 0 to force cell death
                cell.targetVolume = 0.
                cell.lambdaVolume = 2.
                cell.targetSurface = 0.
                cell.lambdaSurface = 2.
            else:
                dictionaryAttrib = CompuCell.getPyAttrib(cell)
                cell.targetVolume = cell.volume + 0.15 * dictionaryAttrib[
                    "InitialVolume"]

        # ###### Retrieve delta values and set cell type according to delta concentration ########
        for cell in self.cellList:
            currentDeltaValue = bionetAPI.getBionetworkValue("DN_di", cell.id)
            if (currentDeltaValue > 0.5):
                if (self.cellTypeMap[cell.type] == "LowDelta"):
                    print "ID of cell to undergo type change %s" % cell.id
                    print "Type of cell to undergo type change %s" % bionetAPI.getBionetworkValue(
                        "TemplateLibrary", cell.id)
                    bionetAPI.setBionetworkValue("TemplateLibrary",
                                                 "HighDelta", cell.id)
            else:
                if (self.cellTypeMap[cell.type] == "HighDelta"):
                    bionetAPI.setBionetworkValue("TemplateLibrary", "LowDelta",
                                                 cell.id)

        # ####### Set all cell dbari values as a function of neighbor delta values #########
        for cell in self.cellList:
            weightedSumOfNeighborDeltaValues = 0.0
            neighborContactAreas = bionetAPI.getNeighborContactAreas(cell.id)
            neighborDeltaValues = bionetAPI.getNeighborProperty(
                "DN_di", cell.id)

            for neighborID in neighborContactAreas.keys():
                weightedSumOfNeighborDeltaValues += (
                    neighborContactAreas[neighborID] *
                    neighborDeltaValues[neighborID])

            bionetAPI.setBionetworkValue(
                "DN_dbari", weightedSumOfNeighborDeltaValues / cell.surface,
                cell.id)
コード例 #51
0
    def deleteSBMLFromCellTypes(self, _modelName, _types=[]):
        """
        Deletes  SBML model from cells whose type match those stered int he _ids list
        :param _modelName {str}: model name
        :param _types: list of cell cell types
        :return: None

        """
        import CompuCell
        for cell in self.cellListByType(*_types):
            dict_attrib = CompuCell.getPyAttrib(cell)
            try:
                sbmlDict = dict_attrib['SBMLSolver']
                del sbmlDict[_modelName]
            except LookupError, e:
                pass
コード例 #52
0
    def setStepSizeForCell(self, _modelName='', _cell=None, _stepSize=1.0):
        """
        Sets integration step size for SBML model attached to _cell

        :param _modelName {str}: model name
        :param _cell {object}: CellG cell object
        :param _stepSize {float}: integrtion step size
        :return: None
        """
        import CompuCell
        dict_attrib = CompuCell.getPyAttrib(_cell)

        try:
            sbmlSolver = dict_attrib['SBMLSolver'][_modelName]
        except LookupError, e:
            return
コード例 #53
0
 def start(self):
    for cell in self.cellList:
       print " MODIFY ATTRIB CELL ID=",cell.id
       #print "ref count=",sys.getrefcount(cell.pyAttrib)
       #print "another ref count=",sys.getrefcount(cell.pyAttrib)
       #pyAttrib=cell.pyAttrib
       pyAttrib=CompuCell.getPyAttrib(cell)
       print "ref count=",sys.getrefcount(pyAttrib)
       #print " after assign ref count=",sys.getrefcount(cell.pyAttrib)
       
       print "length=",len(pyAttrib)
       pyAttrib[0:1]=[cell.id*4]
       print "Cell attrib=",pyAttrib[0]
       print "length=",len(pyAttrib)
       pyAttrib.append(14)
       print "Cell attrib=",pyAttrib[1]
       print "length=",len(pyAttrib)
コード例 #54
0
    def start(self):
        for cell in self.cellList:
            if cell.type != self.MEDIUM:
                cellDict = CompuCell.getPyAttrib(cell)
                cellDict["Damage"] = 0

                cellDict["ARF"] = random.gauss(
                    0.5,
                    0.17)  # normally distributed within roughly within 0 and 1
                if cellDict["ARF"] < 0:
                    cellDict["ARF"] = 0
                elif cellDict["ARF"] > 1:
                    cellDict["ARF"] = 1

                if cellDict["ARF"] >= 0.8:
                    cell.type = self.RESISTENTBACTERIA
                else:
                    cell.type = self.REGULARBACTERIA
コード例 #55
0
    def deleteSBMLFromCellIds(self, _modelName, _ids=[]):
        """
        Deletes  SBML model from cells whose ids match those stered int he _ids list
        :param _modelName {str}: model name
        :param _ids {list}: list of cell ids
        :return: None
        """
        import CompuCell
        for id in _ids:
            cell = self.inventory.attemptFetchingCellById(id)
            if not cell:
                continue

            dict_attrib = CompuCell.getPyAttrib(cell)
            try:
                sbmlDict = dict_attrib['SBMLSolver']
                del sbmlDict[_modelName]
            except LookupError, e:
                pass
コード例 #56
0
 def copySBMLs(self, _fromCell, _toCell, _sbmlNames=[], _options=None):
     """
     Copies SBML solvers (with their states - effectively clones the solver) from one cell to another
     :param _fromCell {object}: source CellG cell
     :param _toCell {object}: target CellG cell
     :param _sbmlNames: list of SBML model name whose solver are to be copied
     :param _options {dict}: - deprecated - list of SBML solver options
     :return: None
     """
     sbmlNamesToCopy = []
     import CompuCell
     if not (len(_sbmlNames)):
         # if user does not specify _sbmlNames we copy all SBML networks
         try:
             dict_attrib = CompuCell.getPyAttrib(_fromCell)
             sbmlDict = dict_attrib['SBMLSolver']
             sbmlNamesToCopy = sbmlDict.keys()
         except LookupError, e:
             pass
コード例 #57
0
    def start(self):

        # #################### Create SBML models ######################
        sbmlModelName = "DeltaNotchModel"
        sbmlModelKey = "DN"
        sbmlModelPath = "Simulation/MinimalDeltaNotch.sbml"
        timeStepOfIntegration = 0.1
        bionetAPI.loadSBMLModel(sbmlModelName, sbmlModelPath, sbmlModelKey,
                                timeStepOfIntegration)

        # ################ Add SBML models to cell types ##################
        bionetAPI.addSBMLModelToTemplateLibrary("DeltaNotchModel", "LowDelta")
        bionetAPI.addSBMLModelToTemplateLibrary("DeltaNotchModel", "HighDelta")

        ## Include this for a test
        bionetAPI.addSBMLModelToTemplateLibrary("DeltaNotchModel", "External")

        # ####### Set initial conditions for SBML properties #########
        bionetAPI.setBionetworkInitialCondition("LowDelta", "DN_di", 0.2)
        bionetAPI.setBionetworkInitialCondition("HighDelta", "DN_di", 0.8)

        for cell in self.cellList:
            cell.targetVolume = 32.0
            cell.lambdaVolume = 1.0
            cell.targetSurface = 32.0
            cell.lambdaSurface = 1.0

        # ######## Create bionetworks and initialize their states ##########
        bionetAPI.initializeBionetworks()

        # ######## Set cell initial conditions by individual cell ##########
        for cell in self.cellList:
            dictionaryAttrib = CompuCell.getPyAttrib(cell)
            dictionaryAttrib["InitialVolume"] = cell.volume
            dictionaryAttrib["DivideVolume"] = 2. * cell.volume

        self.initialNumberOfCells = len(self.cellList)
        print "\n\nNumber of cells: %s\n\n" % self.initialNumberOfCells

        import CompuCellSetup
        self.cellTypeMap = CompuCellSetup.ExtractTypeNamesAndIds()
        del (self.cellTypeMap[0])
コード例 #58
0
    def step(self, mcs):
        antibioticField = CompuCell.getConcentrationField(
            self.simulator, 'Antibiotic')
        for cell in self.cellList:
            if cell.type != self.MEDIUM:
                # get concentration at cells COM
                cellCOM = CompuCell.Point3D()
                cellCOM.x = int(round(cell.xCOM))
                cellCOM.y = int(round(cell.yCOM))
                cellCOM.z = int(round(cell.zCOM))
                antibioticConcentration = antibioticField.get(cellCOM)

                # calculate damage based on concentration and ARF
                cellDict = CompuCell.getPyAttrib(cell)
                cellDict["Damage"] += (
                    1 -
                    cellDict["ARF"]) * antibioticConcentration * DAMAGE_FACTOR
                if cellDict["Damage"] >= 1:  # too much damage -> die
                    cell.targetVolume = 0
                    cell.lambdaVolume = 100
コード例 #59
0
 def assign_cell_region(self, cell):
     cellDict = CompuCell.getPyAttrib(cell)
     yCM = cell.yCM / float(cell.volume)
     if yCM > self.y_EN_ant:  # if cell is anterior to EN stripes
         cellDict["region"] = 0
         # if (cell.type!=4 and cell.type!=2): # if cell is not En or mitosing
         # cell.type=1 # AnteriorLobe
     elif yCM > self.y_EN_pos:  # if cell is in EN-striped region
         cellDict["region"] = 1
         if (cell.type != 2
                 and cell.type != 4):  # if cell is not En or mitosing
             cell.type = 5  # Segmented
     elif yCM > self.y_GZ_border:  # if cell is in anterior region of GZ
         cellDict["region"] = 2
         if (cell.type != 2
                 and cell.type != 4):  # if cell is not En or mitosing
             cell.type = 3  #GZ
     else:  # if cell is in posterior region of GZ
         cellDict["region"] = 3
         if cell.type != 4:  #if cell is not mitosing
             cell.type = 3  # GZ