Mercurial > repos > bimib > cobraxy
comparison COBRAxy/ras_to_bounds.py @ 120:567ffd4333d4 draft
Uploaded
author | luca_milaz |
---|---|
date | Sun, 13 Oct 2024 16:44:58 +0000 |
parents | 829ea241c3a1 |
children | 7e1ce04cf192 |
comparison
equal
deleted
inserted
replaced
119:829ea241c3a1 | 120:567ffd4333d4 |
---|---|
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 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) |
183 if(reaction == "EX_lac__L_e"): | 183 if(reaction == "EX_lac__L_e"): |
184 model.reactions.get_by_id(reaction).lower_bound = float(0.0) | 184 model.reactions.get_by_id(reaction).lower_bound = float(0.0) |
185 | 185 |
186 mediumRxns_ids = medium.keys() | 186 mediumRxns_ids = medium.keys() |
187 | 187 |
188 # Perform Flux Variability Analysis (FVA) | 188 # Perform Flux Variability Analysis (FVA) on this medium |
189 df_FVA = cobra.flux_analysis.flux_variability_analysis(model, fraction_of_optimum=0, processes=1).round(8) | 189 df_FVA = cobra.flux_analysis.flux_variability_analysis(model, fraction_of_optimum=0, processes=1).round(8) |
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"]) |