freeflux.core.reaction ====================== .. py:module:: freeflux.core.reaction .. autoapi-nested-parse:: Define the Reaction class. Attributes ---------- .. autoapisummary:: freeflux.core.reaction.__author__ Classes ------- .. autoapisummary:: freeflux.core.reaction.Reaction Module Contents --------------- .. py:data:: __author__ :value: 'Chao Wu' .. py:class:: Reaction(id, reversible=True) Define Reaction object which constitute a Model. Duplicate substrates or products could appear in one reaction, but with different atoms. :param id: Reaction ID. :type id: str :param reversible: Reversibility. :type reversible: bool .. attribute:: id Reaction ID. :type: str .. attribute:: reversible Reversibility. :type: bool .. attribute:: substrates_info Index are substrate IDs (there could be duplicate substrates), columns are Metabolite object and its stoichiometric number. :type: df .. attribute:: products_info Index are product IDs (there could be duplicate products), columns are Metabolite object and stoichiometrc number. :type: df .. attribute:: substrates Unique substrate IDs, in order of alphabet. :type: list .. attribute:: products Unique product IDs, in order of alphabet. :type: list .. attribute:: substrates_with_atoms Unique IDs of substrates with atoms, in order of alphabet. :type: list .. attribute:: products_with_atoms Unique IDs of products with atoms, in order of alphabet. :type: list .. attribute:: _substrates_atom_mapping For example, reactants like: A({'ab': 0.5, 'ba': 0.5}) + B({'c': 1}) will be transformed to [{'a': [A, 1, 0.5], 'b': [A, 2, 0.5], 'c': [C, 1, 1]}, {'a': [A, 2, 0.5], 'b': [A, 1, 0.5], 'a': [C, 1, 1]}] :type: list of dict or None .. attribute:: _products_atom_mapping For example, reactants like: A({'ab': 0.5, 'ba': 0.5}) + B({'c': 1}) will be transformed to [{'a': [A, 1, 0.5], 'b': [A, 2, 0.5], 'c': [C, 1, 1]}, {'a': [A, 2, 0.5], 'b': [A, 1, 0.5], 'a': [C, 1, 1]}] :type: list of dict or None .. attribute:: flux (fflux and bflux for reversible reaction) Reaction flux (forward flux and backward flux for reversible reaction). :type: Symbol .. attribute:: host_models Model hosting the reaction. :type: set of Model or None .. py:attribute:: id .. py:attribute:: reversible :value: True .. py:attribute:: substrates_info .. py:attribute:: products_info .. py:attribute:: host_models :value: None .. py:method:: add_substrates(substrates, stoichiometry) :param substrates: :type substrates: Metabolite or list of Metabolite :param stoichiometry: Stoichiometric number(s) of corresponding substrate(s). :type stoichiometry: float or list of float .. py:method:: add_products(products, stoichiometry) :param products: :type products: Metabolite or list of Metabolite. :param stoichiometry: stoichiometric number(s) of corresponding product(s). :type stoichiometry: float or list of float .. py:method:: remove_substrates(substrates) :param substrates: :type substrates: Metabolite or list of Metabolite .. py:method:: remove_products(products) :param products: :type products: Metabolite or list of Metabolite .. py:property:: substrates .. py:property:: products .. py:property:: substrates_with_atoms .. py:property:: products_with_atoms .. py:method:: _atom_mapping(reactant) :param reactant: 'substrate' or 'product' :type reactant: str, .. rubric:: Notes Reactants like: A({'ab': 0.5, 'ba': 0.5}) + B({'c': 1}) will be transformed to [{'a': [A, 1, 0.5], 'b': [A, 2, 0.5], 'c': [C, 1, 1]}, {'a': [A, 2, 0.5], 'b': [A, 1, 0.5], 'a': [C, 1, 1]}]. .. py:property:: _substrates_atom_mapping .. py:property:: _products_atom_mapping .. py:method:: _find_precursor_EMUs(emu, direction='forward') :param emu: :type emu: EMU :param direction: * For reversible reaction, 'forward' if emu is product and precursor emu(s) are substrates; 'backward' if emu is substrate and precursor emu(s) are products. * For irreversible reaction, only 'forward' is acceptable. :type direction: str :returns: **preEMUsInfo** :rtype: list .. rubric:: Notes For reaction like: A({'ab': 0.5, 'ba': 0.5}) + B({'c': 1}) -> C({'abc': 0.5, 'cba': 0.5}), _find_precursor_EMUs(C12) returns [[[A_12], 0.5], [[B_1, A_2], 0.25], [[B_1, A_1], 0.25]]. .. py:method:: __repr__()