From 7922db9e03c2ce6784cf761d1ca94d00f1688b05 Mon Sep 17 00:00:00 2001 From: "samira.vandenbogaard" Date: Wed, 18 Dec 2024 10:01:38 +0100 Subject: [PATCH] Some bugfixes changing kcat values --- src/PAModelpy/EnzymeSectors.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/PAModelpy/EnzymeSectors.py b/src/PAModelpy/EnzymeSectors.py index c5c478a..12387b3 100644 --- a/src/PAModelpy/EnzymeSectors.py +++ b/src/PAModelpy/EnzymeSectors.py @@ -380,7 +380,33 @@ def _get_model_genes_from_enzyme(self, enzyme_id: str, model: Model) -> list: def change_kcat_values(self, rxn_id:str, enzyme_id:str, kcat_f_b:dict[Literal['f', 'b'], float] ) -> None: - self.rxn2protein.setdefault(rxn_id, {}).update(kcat_f_b) + """ + Updates the kcat values for a specific enzyme associated with a given reaction. + + This method modifies the `rxn2protein` dictionary by either adding or updating + the kcat values (forward and backward) for the specified enzyme in the context + of the provided reaction. + + Args: + rxn_id (str): The identifier for the reaction. + enzyme_id (str): The identifier for the enzyme. + kcat_f_b (dict[Literal['f', 'b'], float]): A dictionary containing the + forward ('f') and backward ('b') kcat values for the enzyme. + For example: {'f': 1.5, 'b': 0.8}. + + Returns: + None: This method updates the instance's `rxn2protein` attribute in-place. + + Example: + ```python + model.change_kcat_values( + rxn_id="RXN001", + enzyme_id="ENZYME123", + kcat_f_b={'f': 2.0, 'b': 1.0} + ) + ``` + """ + self.rxn2protein.setdefault(rxn_id, {}).update({enzyme_id:kcat_f_b}) def __setstate__(self, state): # Restore state from the unpickled state