def escapes(self, escapes_file, readquiet): #read and define escape metabolites. if not readquiet: print 'escapes from', escapes_file escapes = {} file = open(escapes_file) while True: line = file.readline() if line == '': break line = line.rstrip() if line == '': continue if line[0] == '#': continue col = line.split('\t') rawmet = col[0] if not readquiet: print ' ', rawmet #convert metabolites from forms like 'leu-L[c]' to 'M_leu_DASH_L_c'... met = eq_current.convert_metabolite_ext2int(rawmet) escapes[met] = 1 escapelist = escapes.keys() cb.set_escapes(self, escapelist) if not readquiet: print
def exchanges(self, exchanges_file, readquiet): #read and define exchange metabolites. if not readquiet: print 'exchanges from', exchanges_file exchanges = {} file = open(exchanges_file) while True: line = file.readline() if line == '': break line = line.rstrip() if line == '': continue if line[0] == '#': continue col = line.split() ## starting here, some changes here to cope with MM2 output try: lb, ub = col[1], col[2] except: lb, ub = '-1000', '1000' rawmet = col[0] if not readquiet: print ' ', rawmet #convert metabolites from forms like 'leu-L[c]' to 'M_leu_DASH_L_c'... met = eq_current.convert_metabolite_ext2int(rawmet) exchanges[(met, lb, ub)] = 1 exchangelist = exchanges.keys() cb.set_exchanges(self, exchangelist) if not readquiet: print
def biomass(self, biomass_file, readquiet): #read and define biomass equation... if not readquiet: print 'biomass from', biomass_file biomass_equation = [[], []] file = open(biomass_file) while True: line = file.readline() if line == '': break line = line.rstrip() if line == '': continue if line[0] == '#': continue col = line.split('\t') [rawmet, coef, side] = col[0:3] #convert metabolites from forms like 'leu-L[c]' to 'M_leu_DASH_L_c'... met = eq_current.convert_metabolite_ext2int(rawmet) if 'reactant' in side: biomass_equation[0].append((met, coef)) self.NOTSOURCES.append(met) elif 'product' in side: biomass_equation[1].append((met, coef)) self.NOTSOURCES.append(met) else: print 'Warning: biomass component skipped because cannot be idenified as reactant or product-->', line #add biomass equation to model, and set this as the objective... cb.add_reaction(self, 'R_biomass_target', 'BiomassRxn', False, {'SUBSYSTEM: BiomassObjective':1, 'EC: .':1}, biomass_equation) cb.set_objective(self, 'Maximize', 'R_biomass_target') #cb.set_constraint(self, 'R_biomass_target', '0.0', str(float(self.VMAX)) ) if not readquiet: print eq_current.makestring(biomass_equation, False) print