def essential_prot(): model = GeckoModel("single-pool") model.solver = 'cplex' print("Essential proteins with cplex, normal model (single-pool)") for p in model.proteins: with model as m: r = m.reactions.get_by_id("draw_prot_" + p) r.lower_bound = 0 r.upper_bound = 0 res = m.optimize() if (res.objective_value <= 1e-10): print(p, ",", res.objective_value)
def essential_prot_scale(): model = GeckoModel("single-pool") model.solver = 'cplex' print("Essential proteins with cplex, scale model (single-pool)") for r in model.reactions: r.lower_bound = r.lower_bound * 100000 r.upper_bound = r.upper_bound * 100000 for p in model.proteins: with model as m: r = model.reactions.get_by_id("draw_prot_" + p) r.lower_bound = 0 r.upper_bound = 0 res = model.optimize() print(p, ",", res.objective_value)
def simulate_prot(): model = GeckoModel("single-pool") model.solver = 'cplex' with model: # for p in ["P53685","Q01574"]: for p in ['P33421']: r = model.reactions.get_by_id("draw_prot_" + p) r.lower_bound = 0 r.upper_bound = 0 res = model.optimize() print(" --> growth " + str(res.objective_value)) print(" --> r_2111 " + str(res.fluxes["r_2111"])) print(" --> r_2056 " + str(res.fluxes["r_2056"])) print(" --> r_1714 " + str(res.fluxes["r_1714_REV"])) print(" ------------ ")
def analysis_growth(resFileName, scale=False): model = GeckoModel('single-pool') model.solver = 'cplex' #scale model if scale: for r in model.reactions: r.upper_bound = r.upper_bound * 100000 r.lower_bound = r.lower_bound * 100000 proteins = model.proteins df = pandas.DataFrame(index=proteins, columns=range(100)) for i in range(100): print(i) for p in proteins: with model as m: r = m.reactions.get_by_id("draw_prot_" + p) r.lower_bound = 0 r.upper_bound = 0 res = m.optimize() df.loc[p][i] = 0 if res.objective_value < 1e-4 else 1 df.to_csv(resFileName)