Mercurial > repos > bimib > cobraxy
comparison COBRAxy/ras_to_bounds.py @ 129:dfb6a1dc6dbc draft
Uploaded
author | luca_milaz |
---|---|
date | Mon, 14 Oct 2024 08:51:39 +0000 |
parents | d40d5d5435df |
children | 03bbbd9af67d |
comparison
equal
deleted
inserted
replaced
128:a78d83753cce | 129:dfb6a1dc6dbc |
---|---|
190 for reaction in rxns_ids: | 190 for reaction in rxns_ids: |
191 model.reactions.get_by_id(reaction).lower_bound = float(df_FVA.loc[reaction, "minimum"]) | 191 model.reactions.get_by_id(reaction).lower_bound = float(df_FVA.loc[reaction, "minimum"]) |
192 model.reactions.get_by_id(reaction).upper_bound = float(df_FVA.loc[reaction, "maximum"]) | 192 model.reactions.get_by_id(reaction).upper_bound = float(df_FVA.loc[reaction, "maximum"]) |
193 | 193 |
194 if ras is not None: | 194 if ras is not None: |
195 #Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows()) | 195 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 for cellName, ras_row in ras.iterrows(): | |
197 process_ras_cell(cellName, ras_row, model, rxns_ids, output_folder) | |
198 break #just one cell for testing | |
199 else: | 196 else: |
200 model_new = model.copy() | 197 model_new = model.copy() |
201 apply_ras_bounds(model_new, pd.Series([1]*len(rxns_ids), index=rxns_ids)) | 198 apply_ras_bounds(model_new, pd.Series([1]*len(rxns_ids), index=rxns_ids)) |
202 bounds = pd.DataFrame([(rxn.lower_bound, rxn.upper_bound) for rxn in model_new.reactions], index=rxns_ids, columns=["lower_bound", "upper_bound"]) | 199 bounds = pd.DataFrame([(rxn.lower_bound, rxn.upper_bound) for rxn in model_new.reactions], index=rxns_ids, columns=["lower_bound", "upper_bound"]) |
203 bounds.to_csv(output_folder + "bounds.csv", sep='\t', index=True) | 200 bounds.to_csv(output_folder + "bounds.csv", sep='\t', index=True) |