Mercurial > repos > bimib > cobraxy
comparison COBRAxy/ras_to_bounds.py @ 114:a7a079f6a4cd draft
Uploaded
| author | luca_milaz |
|---|---|
| date | Sun, 13 Oct 2024 15:57:26 +0000 |
| parents | 1961a091484c |
| children | 867a965d6a57 |
comparison
equal
deleted
inserted
replaced
| 113:1961a091484c | 114:a7a079f6a4cd |
|---|---|
| 122 mediumRxns_ids (list of str): List of reaction IDs in the medium. Their RAS is set to zero, but they are already set in the model. | 122 mediumRxns_ids (list of str): List of reaction IDs in the medium. Their RAS is set to zero, but they are already set in the model. |
| 123 Returns: | 123 Returns: |
| 124 None | 124 None |
| 125 """ | 125 """ |
| 126 for reaction in rxns_ids: | 126 for reaction in rxns_ids: |
| 127 if reaction in ras_row.index and ras_row[reaction] not in mediumRxns_ids: | 127 if reaction in ras_row.index and reaction not in mediumRxns_ids: |
| 128 scaling_factor = ras_row[reaction] | 128 scaling_factor = ras_row[reaction] |
| 129 lower_bound=model.reactions.get_by_id(reaction).lower_bound | 129 lower_bound=model.reactions.get_by_id(reaction).lower_bound |
| 130 upper_bound=model.reactions.get_by_id(reaction).upper_bound | 130 upper_bound=model.reactions.get_by_id(reaction).upper_bound |
| 131 valMax=float((upper_bound)*scaling_factor) | 131 valMax=float((upper_bound)*scaling_factor) |
| 132 valMin=float((lower_bound)*scaling_factor) | 132 valMin=float((lower_bound)*scaling_factor) |
| 190 | 190 |
| 191 # Set FVA bounds | 191 # Set FVA bounds |
| 192 for reaction in rxns_ids: | 192 for reaction in rxns_ids: |
| 193 model.reactions.get_by_id(reaction).lower_bound = float(df_FVA.loc[reaction, "minimum"]) | 193 model.reactions.get_by_id(reaction).lower_bound = float(df_FVA.loc[reaction, "minimum"]) |
| 194 model.reactions.get_by_id(reaction).upper_bound = float(df_FVA.loc[reaction, "maximum"]) | 194 model.reactions.get_by_id(reaction).upper_bound = float(df_FVA.loc[reaction, "maximum"]) |
| 195 | |
| 196 #warning(str(model.reactions.get_by_id("EX_Lcystin_e").lower_bound)) | |
| 197 | 195 |
| 198 if ras is not None: | 196 if ras is not None: |
| 199 #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 #Parallel(n_jobs=cpu_count())(delayed(process_ras_cell)(cellName, ras_row, model, rxns_ids, output_folder) for cellName, ras_row in ras.iterrows()) |
| 200 for cellName, ras_row in ras.iterrows(): | 198 for cellName, ras_row in ras.iterrows(): |
| 201 process_ras_cell(cellName, ras_row, model, rxns_ids, mediumRxns_ids, output_folder) | 199 process_ras_cell(cellName, ras_row, model, rxns_ids, mediumRxns_ids, output_folder) |
