:mod:`geckopy.model` ==================== .. py:module:: geckopy.model .. autoapi-nested-parse:: Model class that extends `cobra.Model` to account for enzyme constraints. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: geckopy.model.Model .. data:: LOGGER .. class:: Model(id_or_model: Union[(str, cobra.Model)] = None, name: str = None, hardcoded_rev_reactions: bool = True) Bases: :class:`cobra.Model` Extension of cobra.Model providing an API for proteins in EC models. .. attribute:: reactions A DictList where the key is the reaction identifier and the value a Reaction. :type: DictList .. attribute:: metabolites A DictList where the key is the metabolite identifier and the value a Metabolite. :type: DictList .. attribute:: proteins A DictList where the key is the metabolite identifier and the value a Protein. :type: DictList .. attribute:: genes A DictList where the key is the gene identifier and the value a Gene. :type: DictList .. attribute:: groups A DictList where the key is the group identifier and the value a Group. :type: DictList .. attribute:: solution # TODO: separate proteins from cobra.Reactions The last obtained solution from optimizing the model. :type: Solution .. method:: __setstate__(self, state: Dict) Make sure all cobra.Objects in the model point to the model. .. method:: from_cobra(self, model: cobra.Model, name: str) Initialize from cobra model. .. method:: get_total_measured_proteins(self) -> float Sum of all `Proteins` in the model that has a concentration. .. method:: constrain_pool(self, p_total: float, sigma_saturation_factor: float, fn_mass_fraction_unmeasured_matched: float, protein_list: List[str] = None) Constrain the draw reactions for the unmeasured (common protein pool) proteins. Adapted from [geckopy] (https://github.com/SysBioChalmers/GECKO/blob/master/geckopy/geckopy/gecko.py#L184) Proteins without their own protein pool are collectively constrained by the common protein pool. Remove protein pools for all proteins that don't have measurements, along with corresponding draw reactions, and add these to the common protein pool and reaction. :param p_total: measured total protein fraction in cell in g protein / gDW :type p_total: float :param sigma_saturation_factor: part of proteome that can be used by metabolism :type sigma_saturation_factor: float :param fn_mass_fraction_unmeasured_matched: TODO: add convenience function to handle this sum of the product of average abundances of unmesured proteins (from, e.g., paxDB) times their molecular weight. :type fn_mass_fraction_unmeasured_matched: float :param protein_list: list of ids of proteins to constrain. This is useful for inspecting the protein utilization of, e.g., a heterologous pathway. :type protein_list: List[str] .. method:: add_pool(self, reac_id: str = 'prot_pool_exchange', met_id: str = 'prot_pool') Add the reaction and metabolite to constraint the common pool of proteins. :param read_id: id of the common protein pool pseudorreaction to add. :type read_id: str :param met_id: id of the common protein pool metabolite to add. :type met_id: str .. method:: copy(self) Provide a partial 'deepcopy' of the Model. All of the Metabolite, Gene, and Reaction objects are created anew but in a faster fashion than deepcopy. Enzyme constrained changes: also deepcopy proteins. .. method:: _populate_solver(self, reaction_list: Iterator[Reaction], metabolite_list: Iterator[Metabolite] = None, protein_list: Iterator[Protein] = None) Populate attached solver with LP problem given reactions + proteins. Note that proteins are added both as Constraints and Variables. .. method:: add_proteins(self, protein_list: Iterator[Protein]) Add proteins to the model, in the same fashion as `.add_metabollites`. .. method:: add_reactions(self, reaction_list: Iterator[Reaction]) Add reactions to the model. Reactions with identifiers identical to a reaction already in the model are ignored. The change is reverted upon exit when using the model as a context. Enzyme Constrained changes: avoid adding proteins as metabolites. :param reaction_list: A list of `cobra.Reaction` objects :type reaction_list: list .. method:: optimize(self, objective_sense: Optional[str] = None, raise_error: bool = False) -> Tuple[(cobra.Solution, cobra.Solution)] Optimize the model using flux balance analysis. :param objective_sense: Whether fluxes should be maximized or minimized. In case of None, the previous direction is used. :type objective_sense: {None, 'maximize' 'minimize'}, optional :param raise_error: If true, raise an OptimizationError if solver status is not optimal. :type raise_error: bool .. rubric:: Notes Only the most commonly used parameters are presented here. Additional parameters for cobra.solvers may be available and specified with the appropriate keyword argument. .. method:: add_boundary(self, metabolite: Union[(cobra.Metabolite, Protein)], type: str = 'exchange', reaction_id: Optional[str] = None, lb: Optional[float] = None, ub: Optional[float] = None, sbo_term: Optional[str] = None) -> geckopy.reaction.Reaction Add a boundary reaction for a given metabolite. Enzyme constraint changes: return an geckopy.Reaction.