freeflux.core.mdv ================= .. py:module:: freeflux.core.mdv .. autoapi-nested-parse:: Define the MDV class. Attributes ---------- .. autoapisummary:: freeflux.core.mdv.__author__ freeflux.core.mdv.natAbuns Classes ------- .. autoapisummary:: freeflux.core.mdv.MDV Functions --------- .. autoapisummary:: freeflux.core.mdv._isotopomer_combination freeflux.core.mdv.get_natural_MDV freeflux.core.mdv.get_substrate_MDV freeflux.core.mdv.gen_conv freeflux.core.mdv.conv freeflux.core.mdv.diff_conv Module Contents --------------- .. py:data:: __author__ :value: 'Chao Wu' .. py:data:: natAbuns .. py:class:: MDV(fractions, nonnegative=True, normalize=True, base_atom='C') Define MDV (i.e., mass isotopomer distribution vector) object and its operations. Convolution between mdv1 and mdv2 can be performed in three ways: 1. mdv1.conv(mdv2); 2. mdv1*mdv2; 3. mdv.conv(mdv1, mdv2). The zero element for convolution is MDV([0]), and the identity element is MDV([1]). Scalar multiplication (a*mdv) and MDV addition (mdv1 + mdv2) are also supported. In these cases, the resulting MDV are not automatically normalized. In addition to C, MDV can be built based on H, N, O, Si, and S. :param fractions: MDV vector. :type fractions: list or array :param nonnegative: Whether to keep the elements >= 0. :type nonnegative: bool :param normalize: Whether to normalize MDV vector to ensure the sum equals one. :type normalize: bool :param base_atom: Base atom for MDV. :type base_atom: str .. attribute:: value MDV vector. :type: array .. attribute:: n_atoms # of atom. :type: int .. attribute:: base_atom Base atom for MDV. :type: str .. attribute:: fl (or fractional_labeling) Fractional labeling. :type: float .. py:attribute:: value .. py:attribute:: base_atom :value: 'C' .. py:method:: __iter__() .. py:method:: __getitem__(key) :param key: Index. :type key: int or slice .. py:method:: __array__() .. py:method:: conv(mdv) Note. Assume that the mdv convolved has the same base atom. :param mdv: :type mdv: list or array or MDV .. py:method:: __mul__(other) :param other: :type other: scalar, list, array or MDV .. py:method:: __rmul__(other) :param other: :type other: MDV .. py:method:: __add__(other) :param other: :type other: MDV .. py:method:: __radd__(other) :param other: :type other: MDV .. py:method:: _correction_matrix(X, n_Xs) :param X: Which element the correction matrix will be generated for. :type X: str :param n_Xs: # of X atoms in metabolite or metabolite fragment, these atoms will be corrected. :type n_Xs: int .. py:method:: correct_for_natural_abundance(atom_dict) :param atom_dict: element needs to be corrected => # of corresponding atoms in metabolite (fragment). :type atom_dict: dict .. py:method:: correct_for_inoculum(fraction) :param fraction: Fraction of inoculum in biomass measured. :type fraction: float in [0, 1] .. py:property:: n_atoms .. py:property:: fl .. py:attribute:: fractional_labeling .. py:method:: __repr__() .. py:function:: _isotopomer_combination(n_atoms, n_natural_isotops) :param n_atoms: # of atoms. :type n_atoms: int :param n_natural_isotops: # of natural isotopmers. :type n_natural_isotops: int :returns: **combs2** :rtype: dict .. rubric:: Example >>> _isotopomer_combination(2, 3) OrderedDict([(0, [Counter({0: 2})]), (1, [Counter({0: 1, 1: 1})]), (2, [Counter({0: 1, 2: 1}), Counter({1: 2})]), (3, [Counter({1: 1, 2: 1})]), (4, [Counter({2: 2})])]) .. py:function:: get_natural_MDV(n_atoms, base_atom='C') Calculate the MDV of an unlabeled fragment. :param n_atoms: # of atoms. :type n_atoms: int :param base_atom: Base atom for MDV. :type base_atom: str .. py:function:: get_substrate_MDV(atom_nos, labeling_pattern, percentage, purity, label_atom='C') Calculate the MDV of a fragment from labeled substrate. Currently this function only supports H, C or N-labeled substrate. :param atom_nos: Atom NOs, starting from 1. :type atom_nos: list of int :param labeling_pattern: Labeling pattern of substrate, '0' for unlabeled atom, '1' for labeled atom, e.g., '100000' for 1-13C glucose. List if tracer with multiple labeling patterns are used. Natural substrate (with all '0's) don't need to be explicitly set. If str, labeling_pattern should not be natural substrate. :type labeling_pattern: str or list of str :param percentage: Molar percentage (in range of [0,1]) of corresponding tracer. Sum of percentage should be <= 1, and the rest will be considered as natural substrate. List if tracer with multiple labeling patterns are used. * If list, len(percentage) should be equal to len(labeling_pattern). * If float, labeling_pattern should not be natural substrate. :type percentage: float or list of float :param purity: Labeled atom purity (in range of [0,1]) of corresponding tracer. List if tracer with multiple labeling patterns are used. * If list, len(purity) should be equal to len(labeling_pattern). * If float, labeling_pattern should not be natural substrate. :type purity: float or list of float :param label_atom: Labeled atom, i.e., base atom in the MDV. Currently supports only "H", "C" and "N". :type label_atom: str .. py:function:: gen_conv(arr1, arr2) :param arr1: If one of the arrs is 2-D, the function performs 2-D convolution of MDV (array) and MDV derivative. :type arr1: list or array :param arr2: If one of the arrs is 2-D, the function performs 2-D convolution of MDV (array) and MDV derivative. :type arr2: list or array .. py:function:: conv(mdv1, mdv2) Perform convolution between two MDVs. :param mdv1: :type mdv1: list or array or MDV :param mdv2: :type mdv2: list or array or MDV :returns: **mdv** :rtype: MDV .. py:function:: diff_conv(mdv_mdvder1, mdv_mdvder2) :param mdv_mdvder1: namely [MDV, MDVder], MDVder in shape of (len(MDV), len(v)) :type mdv_mdvder1: 2-list of arrays :param mdv_mdvder2:: 2-list of arrays: namely [MDV, MDVder], MDVder in shape of (len(MDV), len(v)) :returns: * **mdv** (*array*) * **mdvder** (*2-D array*) -- In shape of (len(MDV), len(v)).