comparison COBRAxy/ras_to_bounds.py @ 115:867a965d6a57 draft

Uploaded
author luca_milaz
date Sun, 13 Oct 2024 16:15:50 +0000
parents a7a079f6a4cd
children 734cc52537da
comparison
equal deleted inserted replaced
114:a7a079f6a4cd 115:867a965d6a57
121 rxns_ids (list of str): List of reaction IDs to which the scaling factors will be applied. 121 rxns_ids (list of str): List of reaction IDs to which the scaling factors will be applied.
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 warning(str(model.reactions.get_by_id("EX_Lcystin_e").lower_bound))
126 for reaction in rxns_ids: 127 for reaction in rxns_ids:
127 if reaction in ras_row.index and reaction not in mediumRxns_ids: 128 if reaction in ras_row.index: #and reaction not in mediumRxns_ids
128 scaling_factor = ras_row[reaction] 129 scaling_factor = ras_row[reaction]
129 lower_bound=model.reactions.get_by_id(reaction).lower_bound 130 lower_bound=model.reactions.get_by_id(reaction).lower_bound
130 upper_bound=model.reactions.get_by_id(reaction).upper_bound 131 upper_bound=model.reactions.get_by_id(reaction).upper_bound
131 valMax=float((upper_bound)*scaling_factor) 132 valMax=float((upper_bound)*scaling_factor)
132 valMin=float((lower_bound)*scaling_factor) 133 valMin=float((lower_bound)*scaling_factor)
135 if upper_bound==0 and lower_bound!=0: 136 if upper_bound==0 and lower_bound!=0:
136 model.reactions.get_by_id(reaction).lower_bound=valMin 137 model.reactions.get_by_id(reaction).lower_bound=valMin
137 if upper_bound!=0 and lower_bound!=0: 138 if upper_bound!=0 and lower_bound!=0:
138 model.reactions.get_by_id(reaction).lower_bound=valMin 139 model.reactions.get_by_id(reaction).lower_bound=valMin
139 model.reactions.get_by_id(reaction).upper_bound=valMax 140 model.reactions.get_by_id(reaction).upper_bound=valMax
141 warning(str(model.reactions.get_by_id("EX_Lcystin_e").lower_bound))
140 pass 142 pass
141 143
142 def process_ras_cell(cellName, ras_row, model, rxns_ids, mediumRxns_ids, output_folder): 144 def process_ras_cell(cellName, ras_row, model, rxns_ids, mediumRxns_ids, output_folder):
143 """ 145 """
144 Process a single RAS cell, apply bounds, and save the bounds to a CSV file. 146 Process a single RAS cell, apply bounds, and save the bounds to a CSV file.