comparison COBRAxy/ras_to_bounds.py @ 106:1629671d4ca6 draft

Uploaded
author luca_milaz
date Sun, 13 Oct 2024 14:01:03 +0000
parents e3b3958c0d88
children 58919e82d96e
comparison
equal deleted inserted replaced
105:e3b3958c0d88 106:1629671d4ca6
194 for reaction in rxns_ids: 194 for reaction in rxns_ids:
195 model.reactions.get_by_id(reaction).lower_bound = float(df_FVA.loc[reaction, "minimum"]) 195 model.reactions.get_by_id(reaction).lower_bound = float(df_FVA.loc[reaction, "minimum"])
196 model.reactions.get_by_id(reaction).upper_bound = float(df_FVA.loc[reaction, "maximum"]) 196 model.reactions.get_by_id(reaction).upper_bound = float(df_FVA.loc[reaction, "maximum"])
197 197
198 if ras is not None: 198 if ras is not None:
199 Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows()) 199 #Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows())
200 for cellName, ras_row in ras.iterrows():
201 process_ras_cell(cellName, ras_row, model, rxns_ids, output_folder)
202 break
200 else: 203 else:
201 model_new = model.copy() 204 model_new = model.copy()
202 apply_ras_bounds(model_new, pd.Series([1]*len(rxns_ids), index=rxns_ids), rxns_ids) 205 apply_ras_bounds(model_new, pd.Series([1]*len(rxns_ids), index=rxns_ids), rxns_ids)
203 bounds = pd.DataFrame([(rxn.lower_bound, rxn.upper_bound) for rxn in model_new.reactions], index=rxns_ids, columns=["lower_bound", "upper_bound"]) 206 bounds = pd.DataFrame([(rxn.lower_bound, rxn.upper_bound) for rxn in model_new.reactions], index=rxns_ids, columns=["lower_bound", "upper_bound"])
204 bounds.to_csv(output_folder + "bounds.csv", sep='\t', index=True) 207 bounds.to_csv(output_folder + "bounds.csv", sep='\t', index=True)