def parse( self, rxnfile, metabolitefile, fluxlimitfile, objectivefile, analysisName, exchangeFile = None): #networkParser = MetabolicNetworkFlatFileParser() network = self.networkParser.parse( rxnfile, metabolitefile ) fluxModel = FluxModel( network ) if fluxlimitfile != '' and fluxlimitfile != None: fluxLimits= self.fluxLimitParser.parse( fluxlimitfile ) else: fluxLimits = FluxLimit() if objectivefile != '' and objectivefile != None: objective= self.objectiveParser.parse( objectivefile ) else: objective = Objective() if exchangeFile != '' and exchangeFile != None: ( reactions, objective, limit ) = self.exchangeParser.parse(exchangeFile) network.addReactionMap(reactions) fluxLimits.extend(limit) if self.directionCheck: fluxLimits = self.checkDirectionality(network, fluxLimits) fluxModel.addAnalysis( analysisName, objective, fluxLimits ) return fluxModel
def parseGenConfig(self,config,modelName): dir = config["basedir"] network = None fluxLimits = None smmData = None objective = None metaboliteData = None if config["rxnfile"] != '': rxnFile =dir + config["rxnfile"] network = self.networkParser.parse(rxnFile) else: network = MetabolicNetwork('') if config["smmfile"] != '': smmFile = dir + config["smmfile"] metaboliteData = self.smmParser.parse(smmFile) if config["fluxlimitfile"] != '': fluxLimitFile = dir + config["fluxlimitfile"] fluxLimits = self.fluxLimitParser.parse(fluxLimitFile) else: fluxLimits = FluxLimit() if config["objectivefile"] != '': objectiveFile = dir + config["objectivefile"] objective = self.objectiveParser.parse(objectiveFile) else: objective = Objective() if config["exchangefile"] != '': exchangeFile = dir + config["exchangefile"] ( reactions, objective, limit ) = self.exchangeParser.parse(exchangeFile) network.addReactionMap(reactions) fluxLimits.extend(limit) if self.directionCheck: fluxLimits = self.checkDirectionality(network, fluxLimits) #Add data to collector if network != None: result = FluxModel(network) if metaboliteData != None: result.setMetaboliteData(metaboliteData) if objective != None and fluxLimits != None: result.addAnalysis( modelName, objective, fluxLimits ) return result
def generateModel(self,modelName=None): if modelName == None: modelName = self.modelName dir = self.basedir network = None fluxLimits = None objective = None metaboliteData = None if self.rxnfile != '': rxnFile =dir + self.rxnfile network = self.networkParser.parse(rxnFile) else: network = MetabolicNetwork('') if self.smmfile != '': smmFile = dir + self.smmfile metaboliteData = self.smmParser.parse(smmFile) if self.fluxlimitfile != '': fluxLimitFile = dir + self.fluxlimitfile fluxLimits = self.fluxLimitParser.parse(fluxLimitFile) else: fluxLimits = FluxLimit() if self.objectivefile != '': objectiveFile = dir + self.objectivefile objective = self.objectiveParser.parse(objectiveFile) else: objective = Objective() if self.directionCheck: fluxLimits = self.checkDirectionality(network, fluxLimits) #Add data to collector if network != None: result = FluxModel(network) if metaboliteData != None: result.setMetaboliteData(metaboliteData) if objective != None and fluxLimits != None: result.addAnalysis( modelName, objective, fluxLimits ) return result
def parseMultipleAnalysis( self, rxnfile, metabolitefile, fluxlimitfiles, objectivefiles, analysisNames ): networkParser = MetabolicNetworkFlatFileParser() network = networkParser.parse( rxnfile, metabolitefile ) fluxModel = FluxModel( network ) fluxLimits = {} objective = {} analysis_names = [] fluxLimitParser = FluxLimitFlatFileParser() objectiveParser = ObjectiveFlatFileParser() for analysisName in analysisNames: fluxlimitfile = fluxlimitfiles[analysisName] objectivefile = objectivefiles[analysisName] fluxLimits= fluxLimitParser.parse( fluxlimitfile ) objective= objectiveParser.parse( objectivefile ) fluxModel.addAnalysis( analysisName, objective, fluxLimits ) return fluxModel