Mercurial > repos > bimib > cobraxy
comparison COBRAxy/ras_to_bounds.py @ 62:14076662f687 draft
Uploaded
| author | luca_milaz |
|---|---|
| date | Sun, 13 Oct 2024 08:08:33 +0000 |
| parents | 455e8945d02a |
| children | 5302258f8262 |
comparison
equal
deleted
inserted
replaced
| 61:455e8945d02a | 62:14076662f687 |
|---|---|
| 182 rxn = model.reactions.get_by_id(reaction) | 182 rxn = model.reactions.get_by_id(reaction) |
| 183 rxn.lower_bound = float(df_FVA.loc[reaction, "minimum"]) | 183 rxn.lower_bound = float(df_FVA.loc[reaction, "minimum"]) |
| 184 rxn.upper_bound = float(df_FVA.loc[reaction, "maximum"]) | 184 rxn.upper_bound = float(df_FVA.loc[reaction, "maximum"]) |
| 185 | 185 |
| 186 if ras is not None: | 186 if ras is not None: |
| 187 Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows()) | 187 #Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows()) |
| 188 for cellName, ras_row in ras.iterrows(): | |
| 189 process_ras_cell(cellName, ras_row, model, rxns_ids, output_folder) | |
| 188 else: | 190 else: |
| 189 model_new = model.copy() | 191 model_new = model.copy() |
| 190 apply_ras_bounds(model_new, pd.Series([1]*len(rxns_ids), index=rxns_ids), rxns_ids) | 192 apply_ras_bounds(model_new, pd.Series([1]*len(rxns_ids), index=rxns_ids), rxns_ids) |
| 191 bounds = pd.DataFrame([(rxn.lower_bound, rxn.upper_bound) for rxn in model_new.reactions], index=rxns_ids, columns=["lower_bound", "upper_bound"]) | 193 bounds = pd.DataFrame([(rxn.lower_bound, rxn.upper_bound) for rxn in model_new.reactions], index=rxns_ids, columns=["lower_bound", "upper_bound"]) |
| 192 bounds.to_csv(output_folder + "bounds.csv", sep='\t', index=True) | 194 bounds.to_csv(output_folder + "bounds.csv", sep='\t', index=True) |
