def parse( self, abbreviation, biocyc, officialName, equation, subSystem="", proteinClass="", geneAssociation="" ): reaction = Reaction() reaction = self.parseEquation( equation ) #(left,right,direction,conversionType,compartment) = self.parseEquation( equation ) reaction = self.parseEquation(equation) reaction.setId(abbreviation) reaction.setName(officialName) reaction.setEquation(equation) geneAssociation = geneAssociation.strip() if geneAssociation != "": #print "GeneAssociation: %s" % geneAssociation gpr = self.gp.parse( geneAssociation ) #print "GPR: %s" % gpr else: gpr = None reaction.setGeneReference(gpr) xref = {'biocyc': biocyc, } #reaction.initialize( abbreviation, officialName, equation, left, right, direction, conversionType, gpr, proteinClass, subSystem, xref ) return reaction
def parseEquation( self, equation, name = ''): result = Reaction() result.setId(name) result.setName(name) ( newEquation, compartment ) = self.parseEquationPrefix( equation ) ( newEquation, conversionType ) = self.parseConversionType( newEquation ) ( leftString, rightString, direction ) = self.parseDirection( newEquation ) left = self.parseParticipants( leftString, compartment ) right = self.parseParticipants( rightString, compartment ) result.addReactants(left) result.addProducts(right) result.setConversionType(conversionType) result.direction = direction return result