comparison COBRAxy/ras_to_bounds.py @ 112:4ea14da7043b draft

Uploaded
author luca_milaz
date Sun, 13 Oct 2024 15:48:44 +0000
parents 22d2cf96d552
children 1961a091484c
comparison
equal deleted inserted replaced
111:22d2cf96d552 112:4ea14da7043b
180 if(reaction != "EX_thbpt_e" and reaction != "EX_lac__L_e"): 180 if(reaction != "EX_thbpt_e" and reaction != "EX_lac__L_e"):
181 model.reactions.get_by_id(reaction).lower_bound = -float(value) 181 model.reactions.get_by_id(reaction).lower_bound = -float(value)
182 if(reaction == "EX_lac__L_e"): 182 if(reaction == "EX_lac__L_e"):
183 model.reactions.get_by_id(reaction).lower_bound = float(0.0) 183 model.reactions.get_by_id(reaction).lower_bound = float(0.0)
184 184
185 warning(str(model.reactions.get_by_id("EX_Lcystin_e").lower_bound))
186
187 # Perform Flux Variability Analysis (FVA) 185 # Perform Flux Variability Analysis (FVA)
188 df_FVA = cobra.flux_analysis.flux_variability_analysis(model, fraction_of_optimum=0, processes=1).round(8) 186 df_FVA = cobra.flux_analysis.flux_variability_analysis(model, fraction_of_optimum=0, processes=1).round(8)
189 187
190 # Set FVA bounds 188 # Set FVA bounds
191 for reaction in rxns_ids: 189 for reaction in rxns_ids:
192 model.reactions.get_by_id(reaction).lower_bound = float(df_FVA.loc[reaction, "minimum"]) 190 model.reactions.get_by_id(reaction).lower_bound = float(df_FVA.loc[reaction, "minimum"])
193 model.reactions.get_by_id(reaction).upper_bound = float(df_FVA.loc[reaction, "maximum"]) 191 model.reactions.get_by_id(reaction).upper_bound = float(df_FVA.loc[reaction, "maximum"])
192
193 warning(str(model.reactions.get_by_id("EX_Lcystin_e").lower_bound))
194 194
195 if ras is not None: 195 if ras is not None:
196 #Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows()) 196 #Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows())
197 for cellName, ras_row in ras.iterrows(): 197 for cellName, ras_row in ras.iterrows():
198 process_ras_cell(cellName, ras_row, model, rxns_ids, output_folder) 198 process_ras_cell(cellName, ras_row, model, rxns_ids, output_folder)