comparison COBRAxy/ras_to_bounds.py @ 110:76e87d3b9e0e draft

Uploaded
author luca_milaz
date Sun, 13 Oct 2024 15:42:10 +0000
parents ba10ad78fc5f
children 22d2cf96d552
comparison
equal deleted inserted replaced
109:ba10ad78fc5f 110:76e87d3b9e0e
175 rxns_ids = [rxn.id for rxn in model.reactions] 175 rxns_ids = [rxn.id for rxn in model.reactions]
176 176
177 # Set medium conditions 177 # Set medium conditions
178 for reaction, value in medium.items(): 178 for reaction, value in medium.items():
179 if value is not None: 179 if value is not None:
180 warning(str(reaction) + " " + str(value))
180 if(reaction != "EX_thbpt_e" and reaction != "EX_lac__L_e"): 181 if(reaction != "EX_thbpt_e" and reaction != "EX_lac__L_e"):
181 model.reactions.get_by_id(reaction).lower_bound = -float(value) 182 model.reactions.get_by_id(reaction).lower_bound = -float(value)
182 if(reaction == "EX_lac__L_e"): 183 if(reaction == "EX_lac__L_e"):
183 model.reactions.get_by_id(reaction).lower_bound = float(0.0) 184 model.reactions.get_by_id(reaction).lower_bound = float(0.0)
184 185
264 df_mediums = pd.read_csv(ARGS.tool_dir + "/local/medium/medium.csv", index_col = 0) 265 df_mediums = pd.read_csv(ARGS.tool_dir + "/local/medium/medium.csv", index_col = 0)
265 ARGS.medium_selector = ARGS.medium_selector.replace("_", " ") 266 ARGS.medium_selector = ARGS.medium_selector.replace("_", " ")
266 medium = df_mediums[[ARGS.medium_selector]] 267 medium = df_mediums[[ARGS.medium_selector]]
267 medium = medium[ARGS.medium_selector].to_dict() 268 medium = medium[ARGS.medium_selector].to_dict()
268 269
269 warning(str(medium))
270
271 if(ARGS.ras_selector == True): 270 if(ARGS.ras_selector == True):
272 generate_bounds(model, medium, ras = ras_combined, output_folder=ARGS.output_folder) 271 generate_bounds(model, medium, ras = ras_combined, output_folder=ARGS.output_folder)
273 class_assignments.to_csv(ARGS.cell_class, sep = '\t', index = False) 272 class_assignments.to_csv(ARGS.cell_class, sep = '\t', index = False)
274 else: 273 else:
275 generate_bounds(model, medium, output_folder=ARGS.output_folder) 274 generate_bounds(model, medium, output_folder=ARGS.output_folder)