def processMDLR(self, mdlrPath): ''' main method. extracts species definition, creates bng-xml, creates mdl definitions ''' nautyDict = self.xml2HNautySpeciesDefinitions(mdlrPath) #append extended bng-xml to the bng-xml definition (the one that doesn't include seed information) bngxmlestr = writeBXe.mergeBXBXe(namespace.input + '_total.xml', namespace.input + '_extended.xml') with open(mdlrPath + '_total.xml', 'w') as f: f.write(bngxmlestr) xmlspec = readBNGXML.parseFullXML(namespace.input + '.xml') # write out the equivalent plain mdl stuffs mdlDict = writeMDL.constructMCell(xmlspec, namespace.input, finalName.split(os.sep)[-1], nautyDict) writeMDL.writeMDL(mdlDict, finalName)
bnglPath = namespace.input + '.bngl' finalName = namespace.output if namespace.output else namespace.input # mdl to bngl resultDict = readMDL.constructBNGFromMDLR(namespace.input, namespace.nfsim) outputDir = os.sep.join(namespace.output.split(os.sep)[:-1]) # create bngl file readMDL.outputBNGL(resultDict['bnglstr'], bnglPath) # temporaryly store bng-xml information in a separate file for display purposes with open(namespace.input + '_extended.xml', 'wb') as f: f.write(resultDict['bngxmlestr']) #get cannonical label -bngl label dictionary if not namespace.nfsim: # bngl 2 sbml 2 json readMDL.bngl2json(namespace.input + '.bngl') # json 2 plain mdl mdlDict = writeMDL.constructMDL(namespace.input + '_sbml.xml.json', namespace.input, finalName) # create an mdl with nfsim-species and nfsim-reactions writeMDL.writeMDL(mdlDict, finalName) else: mdlr2mdl = MDLR2MDL(os.path.join(getScriptPath(),'mcellr.yaml')) #get the species definitions mdlr2mdl.processMDLR(namespace.input)