Beispiel #1
0
    def extractMoleculeTypes(self,ticket,bnglContents, bnglContents2):

        moleculeTypesList = []
        for element in [bnglContents, bnglContents2]:
            pointer = tempfile.mkstemp(suffix='.bngl', text=True)
            with open(pointer[1], 'w') as f:
                f.write(element)
            print pointer[1]
            consoleCommands.setBngExecutable(bngDistro)
            consoleCommands.bngl2xml(pointer[1])

            xmlFileName = pointer[1].split('.')[0] + '.xml'
            xmlFileName = xmlFileName.split(os.sep)[-1]
            moleculeTypes, _, _ = readBNGXML.parseXML(xmlFileName)
            moleculeTypesList.append(moleculeTypes)
            os.remove(xmlFileName)
        self.addToDict(ticket, moleculeTypesList)
        print 'success', ticket
def extractRulesFromFile(fileName):
    species, rules, par = readBNGXML.parseXML(fileName)
    return rules
def extractMoleculeTypesFromFile(fileName):
    species, rules, par = readBNGXML.parseXML(fileName)
    return species