def writeXMLDescriptionFile(self,_fileName=""): from os.path import join """ This function will write XML description of the stored fields. It has to be called after initialization of theCMLFieldHandler is completed """ import CompuCellSetup latticeTypeStr = CompuCellSetup.ExtractLatticeType() if latticeTypeStr=="": latticeTypeStr = "Square" typeIdTypeNameDict = CompuCellSetup.ExtractTypeNamesAndIds() print "typeIdTypeNameDict",typeIdTypeNameDict from XMLUtils import ElementCC3D dim = self.sim.getPotts().getCellFieldG().getDim() numberOfSteps = self.sim.getNumSteps() latticeDataXMLElement=ElementCC3D("CompuCell3DLatticeData",{"Version":"1.0"}) latticeDataXMLElement.ElementCC3D("Dimensions",{"x":str(dim.x),"y":str(dim.y),"z":str(dim.z)}) latticeDataXMLElement.ElementCC3D("Lattice",{"Type":latticeTypeStr}) latticeDataXMLElement.ElementCC3D("Output",{"Frequency":str(self.outputFrequency),"NumberOfSteps":str(numberOfSteps),"CoreFileName":self.outputFileCoreName,"Directory":self.outputDirName}) #output information about cell type names and cell ids. It is necessary during generation of the PIF files from VTK output for typeId in typeIdTypeNameDict.keys(): latticeDataXMLElement.ElementCC3D("CellType",{"TypeName":str(typeIdTypeNameDict[typeId]),"TypeId":str(typeId)}) fieldsXMLElement=latticeDataXMLElement.ElementCC3D("Fields") for fieldName in self.fieldTypes.keys(): fieldsXMLElement.ElementCC3D("Field",{"Name":fieldName,"Type":self.fieldTypes[fieldName]}) # writing XML description to the disk if _fileName!="": latticeDataXMLElement.CC3DXMLElement.saveXML(str(_fileName)) else: latticeDataFileName = join(self.outputDirName,self.outputFileCoreName+"LDF.dml") latticeDataXMLElement.CC3DXMLElement.saveXML(str(latticeDataFileName))
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])
def start(self): # #################### Load SBML models ###################### ## Create a bionetwork SBML model named "DeltaNotchModel" sbmlModelName = "DeltaNotchModel" sbmlModelKey = "DN" sbmlModelPath = "Simulation/MinimalDeltaNotch.sbml" timeStepOfIntegration = 0.1 bionetAPI.loadSBMLModel(sbmlModelName, sbmlModelPath, sbmlModelKey, timeStepOfIntegration) # ################ Add SBML models to celltype-specific bionetwork template libraries ################## 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) # ######## Create bionetworks and initialize their states ########## bionetAPI.initializeBionetworks() # ######## Set cell initial conditions by individual cell ########## for cell in self.cellList: cell.dict["InitialVolume"] = cell.volume cell.dict["DivideVolume"] = 2. * cell.volume cell.targetVolume = 32.0 cell.lambdaVolume = 1.0 import CompuCellSetup self.cellTypeMap = CompuCellSetup.ExtractTypeNamesAndIds() del (self.cellTypeMap[0])
def start(self): # #################### Create SBML models ###################### ## Create a bionetwork SBML model named "DeltaNotchModel" sbmlModelName = "DeltaNotchModel" sbmlModelKey = "DN" sbmlModelPath = "Simulation/MinimalDeltaNotch.sbml" timeStepOfIntegration = 0.05 bionetAPI.loadSBMLModel(sbmlModelName, sbmlModelPath, sbmlModelKey, timeStepOfIntegration) ## Create a bionetwork SBML model named "CadherinCatenin" sbmlModelPath = "Simulation/CadherinCatenin_RamisConde2008.sbml" bionetAPI.loadSBMLModel("CadherinCatenin", sbmlModelPath, "CC", 0.05) ## Create a bionetwork SBML model named "BloodLiverPK" sbmlModelPath = "Simulation/PK_BloodLiver.sbml" bionetAPI.loadSBMLModel("BloodLiverPK", sbmlModelPath, "BLPK", 0.05) ## Create a bionetwork SBML model named "SimpleExample" sbmlModelPath = "Simulation/SimpleExample.sbml" bionetAPI.loadSBMLModel("SimpleExample", sbmlModelPath, "SE", 0.05) # ################ Add SBML models to bionetwork template libraries ################## ## Add SBML model to CellTypeA bionetAPI.addSBMLModelToTemplateLibrary("DeltaNotchModel", "CellTypeA") bionetAPI.addSBMLModelToTemplateLibrary("BloodLiverPK", "CellTypeA") ## Add SBML models to CellTypeB bionetAPI.addSBMLModelToTemplateLibrary("DeltaNotchModel", "CellTypeB") bionetAPI.addSBMLModelToTemplateLibrary("CadherinCatenin", "CellTypeB") ## Add SBML models to CellTypeC bionetAPI.addSBMLModelToTemplateLibrary("CadherinCatenin", "CellTypeC") ## Add SBML models to CellTypeD bionetAPI.addSBMLModelToTemplateLibrary("BloodLiverPK", "CellTypeD") bionetAPI.addSBMLModelToTemplateLibrary("SimpleExample", "CellTypeD") # ####### Set initial conditions for SBML properties ######### ## Set global (for all bionetwork template libraries) SBML initial conditions bionetAPI.setBionetworkInitialCondition("Global", "DN_di", 0.4) bionetAPI.setBionetworkInitialCondition("Global", "CC_beta", 24) bionetAPI.setBionetworkInitialCondition("Global", "Ab", 1.1) ## Set SBML initial conditions for CellTypeA bionetAPI.setBionetworkInitialCondition("CellTypeA", "DN_ni", 0.8) ## Set SBML initial conditions for CellTypeB bionetAPI.setBionetworkInitialCondition("CellTypeB", "CC_Ebeta", 33.333) bionetAPI.setBionetworkInitialCondition("CellTypeB", "BLPK_A1", 0.44444) ## Set SBML initial conditions for CellTypeC bionetAPI.setBionetworkInitialCondition("CellTypeC", "CC_Ebeta", 4.32111) bionetAPI.setBionetworkInitialCondition("CellTypeC", "SE_S1", 0.66666666) bionetAPI.setBionetworkInitialCondition("CellTypeC", "CLK_Nan1", 0.55555) ## Set SBML initial conditions for CellTypeD bionetAPI.setBionetworkInitialCondition("CellTypeD", "CC_Emem", 12.34567) bionetAPI.setBionetworkInitialCondition("CellTypeD", "CLK_Nan1", 0.77777) bionetAPI.setBionetworkInitialCondition("CellTypeD", "DN_ni", 0.88888888) ## Setting SBML initial conditions for non-existent cell type bionetAPI.setBionetworkInitialCondition("NonExistentCellType", "SE_S1", 0.62) # ######## Create bionetworks and initialize their states ########## bionetAPI.initializeBionetworks() for cell in self.cellList: cell.dict["InitialVolume"] = cell.volume cell.dict["DivideVolume"] = 280. cell.targetVolume = 100.0 cell.lambdaVolume = 2.0 import CompuCellSetup self.cellTypeMap = CompuCellSetup.ExtractTypeNamesAndIds() del (self.cellTypeMap[0])