comparison COBRAxy/flux_simulation.py @ 210:3ca179b83574 draft

Uploaded
author luca_milaz
date Thu, 28 Nov 2024 14:07:11 +0000
parents c2aa3034aac2
children
comparison
equal deleted inserted replaced
209:00a66b9bc29e 210:3ca179b83574
236 bounds_df = read_dataset(bounds_path, "bounds dataset") 236 bounds_df = read_dataset(bounds_path, "bounds dataset")
237 for rxn_index, row in bounds_df.iterrows(): 237 for rxn_index, row in bounds_df.iterrows():
238 model_input.reactions.get_by_id(rxn_index).lower_bound = row.lower_bound 238 model_input.reactions.get_by_id(rxn_index).lower_bound = row.lower_bound
239 model_input.reactions.get_by_id(rxn_index).upper_bound = row.upper_bound 239 model_input.reactions.get_by_id(rxn_index).upper_bound = row.upper_bound
240 240
241 #name = '.'.join(cell_name.rsplit('.', 1)[:-1])
242 name = cell_name
243 241
244 if ARGS.algorithm == 'OPTGP': 242 if ARGS.algorithm == 'OPTGP':
245 OPTGP_sampler(model_input, name, ARGS.n_samples, ARGS.thinning, ARGS.n_batches, ARGS.seed) 243 OPTGP_sampler(model_input, cell_name, ARGS.n_samples, ARGS.thinning, ARGS.n_batches, ARGS.seed)
246 244
247 elif ARGS.algorithm == 'CBS': 245 elif ARGS.algorithm == 'CBS':
248 CBS_sampler(model_input, name, ARGS.n_samples, ARGS.n_batches, ARGS.seed) 246 CBS_sampler(model_input, cell_name, ARGS.n_samples, ARGS.n_batches, ARGS.seed)
249 247
250 df_mean, df_median, df_quantiles = fluxes_statistics(name, ARGS.output_types) 248 df_mean, df_median, df_quantiles = fluxes_statistics(cell_name, ARGS.output_types)
251 249
252 if("fluxes" not in ARGS.output_types): 250 if("fluxes" not in ARGS.output_types):
253 os.remove(ARGS.output_path + "/" + name + '.csv') 251 os.remove(ARGS.output_path + "/" + cell_name + '.csv')
254 252
255 returnList = [] 253 returnList = []
256 returnList.append(df_mean) 254 returnList.append(df_mean)
257 returnList.append(df_median) 255 returnList.append(df_median)
258 returnList.append(df_quantiles) 256 returnList.append(df_quantiles)
259 257
260 df_pFBA, df_FVA, df_sensitivity = fluxes_analysis(model_input, name, ARGS.output_type_analysis) 258 df_pFBA, df_FVA, df_sensitivity = fluxes_analysis(model_input, cell_name, ARGS.output_type_analysis)
261 259
262 if("pFBA" in ARGS.output_type_analysis): 260 if("pFBA" in ARGS.output_type_analysis):
263 returnList.append(df_pFBA) 261 returnList.append(df_pFBA)
264 if("FVA" in ARGS.output_type_analysis): 262 if("FVA" in ARGS.output_type_analysis):
265 returnList.append(df_FVA) 263 returnList.append(df_FVA)