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