Mercurial > repos > bimib > cobraxy
comparison COBRAxy/utils/model_utils.py @ 427:4a385fdb9e58 draft
Uploaded
| author | francesco_lapi |
|---|---|
| date | Wed, 10 Sep 2025 11:38:08 +0000 |
| parents | 00a78da611ba |
| children | f49c951c9fe6 |
comparison
equal
deleted
inserted
replaced
| 426:00a78da611ba | 427:4a385fdb9e58 |
|---|---|
| 219 reactions_skipped = 0 | 219 reactions_skipped = 0 |
| 220 | 220 |
| 221 for idx, row in df.iterrows(): | 221 for idx, row in df.iterrows(): |
| 222 | 222 |
| 223 reaction_id = str(row['ReactionID']).strip() | 223 reaction_id = str(row['ReactionID']).strip() |
| 224 reaction_formula = str(row['Reaction']).strip() | 224 reaction_formula = str(row['Formula']).strip() |
| 225 | 225 |
| 226 # Salta reazioni senza formula | 226 # Salta reazioni senza formula |
| 227 if not reaction_formula or reaction_formula == 'nan': | 227 if not reaction_formula or reaction_formula == 'nan': |
| 228 raise ValueError(f"Formula della reazione mancante {reaction_id}") | 228 raise ValueError(f"Formula della reazione mancante {reaction_id}") |
| 229 | 229 |
| 234 # Imposta bounds | 234 # Imposta bounds |
| 235 reaction.lower_bound = float(row['lower_bound']) if pd.notna(row['lower_bound']) else -1000.0 | 235 reaction.lower_bound = float(row['lower_bound']) if pd.notna(row['lower_bound']) else -1000.0 |
| 236 reaction.upper_bound = float(row['upper_bound']) if pd.notna(row['upper_bound']) else 1000.0 | 236 reaction.upper_bound = float(row['upper_bound']) if pd.notna(row['upper_bound']) else 1000.0 |
| 237 | 237 |
| 238 # Aggiungi gene rule se presente | 238 # Aggiungi gene rule se presente |
| 239 if pd.notna(row['Rule']) and str(row['Rule']).strip(): | 239 if pd.notna(row['GPR']) and str(row['GPR']).strip(): |
| 240 reaction.gene_reaction_rule = str(row['Rule']).strip() | 240 reaction.gene_reaction_rule = str(row['GPR']).strip() |
| 241 | 241 |
| 242 # Parse della formula della reazione | 242 # Parse della formula della reazione |
| 243 try: | 243 try: |
| 244 parse_reaction_formula(reaction, reaction_formula, metabolites_dict) | 244 parse_reaction_formula(reaction, reaction_formula, metabolites_dict) |
| 245 except Exception as e: | 245 except Exception as e: |
