def step(self, mcs): # #### Write bionetwork state variable names of external oscillators to output file bionetAPI.writeBionetworkStateToFile(mcs, "ExternalOscillatorA", "SimpleExample", self.oscillatorAFileName, "a") bionetAPI.writeBionetworkStateToFile(mcs, "ExternalOscillatorB", "SimpleExample", self.oscillatorBFileName, "a") # ######### Update integrator(s) for all bionetworks ########### bionetAPI.timestepBionetworks() # ######## Modify k1 and k2 as a function of time (MCS) ########## k1 = self.k1_init * (1 + math.sin(2 * math.pi * mcs / self.mcsPeriod)) k2 = self.k2_init * (1 - math.sin(2 * math.pi * mcs / self.mcsPeriod)) bionetAPI.setBionetworkValue("SE_k1", 0.2 * k1, "ExternalOscillatorA") bionetAPI.setBionetworkValue("SE_k2", 0.2 * k2, "ExternalOscillatorA") k1 = self.k1_init * (1 - math.sin(2 * math.pi * mcs / self.mcsPeriod)) k2 = self.k2_init * (1 + math.sin(2 * math.pi * mcs / self.mcsPeriod)) bionetAPI.setBionetworkValue("SE_k1", 0.2 * k1, "ExternalOscillatorB") bionetAPI.setBionetworkValue("SE_k2", 0.2 * k2, "ExternalOscillatorB") # ####### Set "Blue-Blue" and "Green-Green" adhesion energies ######### BB_offset = bionetAPI.getBionetworkValue("SE_S1", "ExternalOscillatorA") GG_offset = bionetAPI.getBionetworkValue("SE_S1", "ExternalOscillatorB") self.modifyContactEnergies(BB_offset, GG_offset, self.steadyState) # ############## Write adhesion data to an output file ################ self.writeContactEnergies(mcs, self.contactEnergyOutputFile, "a")
def step(self, mcs): # ######### Update all bionetwork integrator(s) ########### bionetAPI.timestepBionetworks() print "\n"; print bionetAPI.getBionetworkValue( "dii", "CellTypeB" ) print "\n"; print bionetAPI.getBionetworkValue( "di", "CellTypeB" ) print "\n"; print bionetAPI.getBionetworkValue( "DN_di", "CellTypeB" ) print "\n"; print bionetAPI.getBionetworkValue( "DeltaNotchModel_di", "CellTypeB" ) bionetAPI.setBionetworkValue( "SE_k1", 0.1, "CellTypeD" ) bionetAPI.setBionetworkValue( "SE_k2", 0.3, "CellTypeD" ) cellType = "CellTypeD"; propertyName = "SE_S1" S1 = bionetAPI.getBionetworkValue( propertyName, cellType ) print "Value of %s in %s: %s" % ( propertyName, cellType, S1 ) if( mcs >= 20 ): if( mcs == 40 ): if self.cellTypeMap[bionetAPI.getCC3DCellByID(1).type] == "CellTypeB": bionetAPI.setBionetworkValue( "TemplateLibrary", "CellTypeA", 1 ) elif self.cellTypeMap[bionetAPI.getCC3DCellByID(1).type] == "CellTypeA": bionetAPI.setBionetworkValue( "TemplateLibrary", "CellTypeB", "CellTypeA" ) if( mcs < 120 ): cell1_di = bionetAPI.getBionetworkValue( "di", 1 ) if( cell1_di > 0.0 ): newPropertyValue = 4.0 / cell1_di else: newPropertyValue = 10.0 for cell in self.cellList: if self.cellTypeMap[cell.type] == "CellTypeB": cell.targetVolume = newPropertyValue
def step(self, mcs): # #### Write bionetwork state variable names of external oscillators to output file bionetAPI.writeBionetworkStateToFile( mcs, "ExternalOscillatorA", "SimpleExample", self.oscillatorAFileName, "a" ) bionetAPI.writeBionetworkStateToFile( mcs, "ExternalOscillatorB", "SimpleExample", self.oscillatorBFileName, "a" ) # ######### Update integrator(s) for all bionetworks ########### bionetAPI.timestepBionetworks() # ######## Modify k1 and k2 as a function of time (MCS) ########## k1 = self.k1_init * ( 1 + math.sin( 2*math.pi*mcs/self.mcsPeriod ) ) k2 = self.k2_init * ( 1 - math.sin( 2*math.pi*mcs/self.mcsPeriod ) ) bionetAPI.setBionetworkValue( "SE_k1", 0.2*k1, "ExternalOscillatorA" ) bionetAPI.setBionetworkValue( "SE_k2", 0.2*k2, "ExternalOscillatorA" ) k1 = self.k1_init * ( 1 - math.sin( 2*math.pi*mcs/self.mcsPeriod ) ) k2 = self.k2_init * ( 1 + math.sin( 2*math.pi*mcs/self.mcsPeriod ) ) bionetAPI.setBionetworkValue( "SE_k1", 0.2*k1, "ExternalOscillatorB" ) bionetAPI.setBionetworkValue( "SE_k2", 0.2*k2, "ExternalOscillatorB" ) # ####### Set "Blue-Blue" and "Green-Green" adhesion energies ######### BB_offset = bionetAPI.getBionetworkValue( "SE_S1", "ExternalOscillatorA" ) GG_offset = bionetAPI.getBionetworkValue( "SE_S1", "ExternalOscillatorB" ) self.modifyContactEnergies( BB_offset, GG_offset, self.steadyState ) # ############## Write adhesion data to an output file ################ self.writeContactEnergies( mcs, self.contactEnergyOutputFile, "a" )
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 )
def step(self, mcs): pass #type here the code that will run every _frequency MCS for cell in self.cellList: if cell.type == self.NONCONDENSING: state = bionetAPI.getBionetworkState(cell.id, 'OSCLI') concentration = state['S1'] # print "concentration=",concentration cell.targetVolume = 25 + 10 * concentration bionetAPI.timestepBionetworks()
def step(self,mcs): pass #type here the code that will run every _frequency MCS for cell in self.cellList: if cell.type==self.NONCONDENSING: state=bionetAPI.getBionetworkState(cell.id,'OSCLI') concentration=state['S1'] # print "concentration=",concentration cell.targetVolume=25+10*concentration bionetAPI.timestepBionetworks()
def step(self, mcs): # #### Write bionetwork state variable names of external oscillators to output file bionetAPI.writeBionetworkStateToFile(mcs, "ExternalOscillatorA", "SimpleExample", self.oscillatorAFileName, "a") bionetAPI.writeBionetworkStateToFile(mcs, "ExternalOscillatorB", "SimpleExample", self.oscillatorBFileName, "a") # ######### Update integrator(s) for all bionetworks ########### bionetAPI.timestepBionetworks() # ######## Modify k1 and k2 as a function of time (MCS) ########## k1 = self.k1_init * (1 + math.sin(2 * math.pi * mcs / self.mcsPeriod)) k2 = self.k2_init * (1 - math.sin(2 * math.pi * mcs / self.mcsPeriod)) bionetAPI.setBionetworkValue("SE_k1", 0.2 * k1, "ExternalOscillatorA") bionetAPI.setBionetworkValue("SE_k2", 0.2 * k2, "ExternalOscillatorA") k1 = self.k1_init * (1 - math.sin(2 * math.pi * mcs / self.mcsPeriod)) k2 = self.k2_init * (1 + math.sin(2 * math.pi * mcs / self.mcsPeriod)) bionetAPI.setBionetworkValue("SE_k1", 0.2 * k1, "ExternalOscillatorB") bionetAPI.setBionetworkValue("SE_k2", 0.2 * k2, "ExternalOscillatorB") # ####### Set "Blue-Blue" and "Green-Green" adhesion energies ######### BB_offset = bionetAPI.getBionetworkValue("SE_S1", "ExternalOscillatorA") GG_offset = bionetAPI.getBionetworkValue("SE_S1", "ExternalOscillatorB") self.modifyContactEnergies(BB_offset, GG_offset, self.steadyState) # ############## Write adhesion data to an output file ################ self.writeContactEnergies(mcs, self.contactEnergyOutputFile, "a") if not (mcs % 10): for cell in self.cellList: pixelList = self.getCellPixelList(cell) for pixelTrackerData in pixelList: self.cellField.set(pixelTrackerData.pixel, None) break if mcs > 200: for cell in self.cellList: cell.targetVolume = 0.0 cell.lambdaVolume = 200.0 cell.targetSurface = 0.0 cell.lambdaSurface = 200.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)
def step(self, mcs): # #### Write bionetwork state variable names of external oscillators to output file bionetAPI.writeBionetworkStateToFile( mcs, "ExternalOscillatorA", "SimpleExample", self.oscillatorAFileName, "a" ) bionetAPI.writeBionetworkStateToFile( mcs, "ExternalOscillatorB", "SimpleExample", self.oscillatorBFileName, "a" ) # ######### Update integrator(s) for all bionetworks ########### bionetAPI.timestepBionetworks() # ######## Modify k1 and k2 as a function of time (MCS) ########## k1 = self.k1_init * ( 1 + math.sin( 2*math.pi*mcs/self.mcsPeriod ) ) k2 = self.k2_init * ( 1 - math.sin( 2*math.pi*mcs/self.mcsPeriod ) ) bionetAPI.setBionetworkValue( "SE_k1", 0.2*k1, "ExternalOscillatorA" ) bionetAPI.setBionetworkValue( "SE_k2", 0.2*k2, "ExternalOscillatorA" ) k1 = self.k1_init * ( 1 - math.sin( 2*math.pi*mcs/self.mcsPeriod ) ) k2 = self.k2_init * ( 1 + math.sin( 2*math.pi*mcs/self.mcsPeriod ) ) bionetAPI.setBionetworkValue( "SE_k1", 0.2*k1, "ExternalOscillatorB" ) bionetAPI.setBionetworkValue( "SE_k2", 0.2*k2, "ExternalOscillatorB" ) # ####### Set "Blue-Blue" and "Green-Green" adhesion energies ######### BB_offset = bionetAPI.getBionetworkValue( "SE_S1", "ExternalOscillatorA" ) GG_offset = bionetAPI.getBionetworkValue( "SE_S1", "ExternalOscillatorB" ) self.modifyContactEnergies( BB_offset, GG_offset, self.steadyState ) # ############## Write adhesion data to an output file ################ self.writeContactEnergies( mcs, self.contactEnergyOutputFile, "a" ) if not (mcs %10): for cell in self.cellList: pixelList=self.getCellPixelList(cell) for pixelTrackerData in pixelList: self.cellField.set(pixelTrackerData.pixel,None) break if mcs >200: for cell in self.cellList: cell.targetVolume=0.0 cell.lambdaVolume=200.0 cell.targetSurface=0.0 cell.lambdaSurface=200.0
def step(self, mcs): # ######### Update all bionetwork integrator(s) ########### bionetAPI.timestepBionetworks() print "\n" print bionetAPI.getBionetworkValue("dii", "CellTypeB") print "\n" print bionetAPI.getBionetworkValue("di", "CellTypeB") print "\n" print bionetAPI.getBionetworkValue("DN_di", "CellTypeB") print "\n" print bionetAPI.getBionetworkValue("DeltaNotchModel_di", "CellTypeB") bionetAPI.setBionetworkValue("SE_k1", 0.1, "CellTypeD") bionetAPI.setBionetworkValue("SE_k2", 0.3, "CellTypeD") cellType = "CellTypeD" propertyName = "SE_S1" S1 = bionetAPI.getBionetworkValue(propertyName, cellType) print "Value of %s in %s: %s" % (propertyName, cellType, S1) if (mcs >= 20): if (mcs == 40): if self.cellTypeMap[bionetAPI.getCC3DCellByID( 1).type] == "CellTypeB": bionetAPI.setBionetworkValue("TemplateLibrary", "CellTypeA", 1) elif self.cellTypeMap[bionetAPI.getCC3DCellByID( 1).type] == "CellTypeA": bionetAPI.setBionetworkValue("TemplateLibrary", "CellTypeB", "CellTypeA") if (mcs < 120): cell1_di = bionetAPI.getBionetworkValue("di", 1) if (cell1_di > 0.0): newPropertyValue = 4.0 / cell1_di else: newPropertyValue = 10.0 for cell in self.cellList: if self.cellTypeMap[cell.type] == "CellTypeB": cell.targetVolume = newPropertyValue
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)
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 )
def step(self,mcs): for cell in self.cellList: if (cell): D=0.0; nn=0 cellNeighborList=self.getCellNeighbors(cell) for neighbor in cellNeighborList: if (neighbor.neighborAddress): nn+=1 state=bionetAPI.getBionetworkState(neighbor.neighborAddress.id,'DeltaNotch') D+=state['D'] if (nn>0): D=D/nn state={} state['Davg']=D bionetAPI.setBionetworkState(cell.id,'DeltaNotch',state) state=bionetAPI.getBionetworkState(cell.id,'DeltaNotch') cell.dict['D']=D cell.dict['N']=state['N'] bionetAPI.timestepBionetworks()