freeflux ======== .. py:module:: freeflux Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/freeflux/analysis/index /autoapi/freeflux/core/index /autoapi/freeflux/io/index /autoapi/freeflux/optim/index /autoapi/freeflux/solver/index /autoapi/freeflux/utils/index Attributes ---------- .. autoapisummary:: freeflux.__author__ freeflux.__version__ Classes ------- .. autoapisummary:: freeflux.Metabolite freeflux.Reaction freeflux.Model freeflux.EMU freeflux.MDV Functions --------- .. autoapisummary:: freeflux.apply_patch freeflux.get_natural_MDV freeflux.get_substrate_MDV freeflux.conv Package Contents ---------------- .. py:data:: __author__ :value: 'Chao Wu' .. py:data:: __version__ :value: '0.3.8' .. py:function:: apply_patch() .. py:class:: Metabolite(id, atoms=None) Define Metabolite object which constitutes a Reaction. Metabolites are considered identical when they have the same IDs and atoms. :param id: Metabolite ID. :type id: str :param atoms: Carbons in metabolite, e.g., 'abcd' for metabolite without equivalents, and ['abcd', 'dcba'] for metabolite with equivalents. :type atoms: str or list of str or None .. attribute:: id Metabolite ID. :type: str .. attribute:: atoms_info equivalent => coefficient, e.g., {'abcd': 1.0} or {'abcd': 0.5, 'dcba': 0.5}. :type: dict .. attribute:: n_carbons # of carbons in metabolite. :type: int .. attribute:: host_reactions Reactions hosting the metabolite. :type: set of Reaction or None .. py:attribute:: id .. py:attribute:: atoms :value: None .. py:attribute:: host_reactions :value: None .. py:method:: __hash__() .. py:method:: __eq__(other) :param other: :type other: Metabolite .. py:property:: atoms_info .. py:property:: n_carbons .. py:method:: __repr__() .. 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__() .. py:class:: Model(name='unnamed') Model class is the fundamental class of FreeFlux hosting operations for 13C MFA. A model can be built by adding reactions one by one or reading set of reactions from .tsv or .xlsx file. :param name: Model name. :type name: str .. attribute:: name Model name. :type: str .. attribute:: metabolites_info Metabolite ID => list of Metabolites. :type: dict .. attribute:: reactions_info Reaction ID => Reaction. :type: OrderedDict .. attribute:: metabolites Metabolite IDs, in alphabetical order. :type: list .. attribute:: metabolites_with_atoms IDs of metabolite with atom assignment, in alphabetical order. :type: list .. attribute:: end_substrates Initial substrates of the model, in alphabetical order. :type: list .. attribute:: end_products Final products of the model, in alphabetical order. :type: list .. attribute:: reactions Reaction IDs, in order of addition. :type: list .. attribute:: n_metabolites # of metabolites. :type: int .. attribute:: n_reactions # of reactions. :type: int .. attribute:: _full_net_stoichiometric_matrix Complete stoichiometric matrix for net reaction with all metabolites in rows, net reactions in columns. :type: df .. attribute:: _full_total_stoichiometric_matrix Complete stoichiometric matrix for total reaction with all metabolites in rows, total reactions in columns. :type: df .. attribute:: metabolite_adjacency_matrix Metabolite adjacency matrix (MAM). Metabolites with atoms are in index and columns (no duplicates). List of Reactions are in cells if reactions exists between (sub, pro), [] otherwise. :type: df .. attribute:: net_fluxes_bounds Reaction ID => [lb, ub] by setting. :type: dict .. attribute:: net_fluxes_range Reaction ID => estimeted [lb, ub]. All required net fluxes are included. :type: dict .. attribute:: netfluxids Net flux IDs, alias of reactions. :type: list .. attribute:: concentrations Concentrations, metabolite ID => float. :type: ser .. attribute:: concentrations_bounds Metabolite ID => [lb, ub] by setting. :type: dict .. attribute:: concentrations_range Metabolite ID => [lb, ub]. All required concentrations are included. :type: dict .. attribute:: concids Concentration IDs (used only in computation process). :type: list .. attribute:: total_fluxes Total fluxes, fluxe ID (e.g., 'v1_f' or 'v2') => float. :type: ser .. attribute:: totalfluxids Total flux IDs. :type: list .. attribute:: target_EMUs Target EMU IDs. :type: list .. attribute:: timepoints Sorted time points for MDV simulation. :type: list .. attribute:: substrate_MDVs Substrate EMU => MDV. :type: dict .. attribute:: substrate_MDVs_der_p Substrate EMU => derivatives of substrate MDV w.r.t. variables in shape of (len(MDV), # of vars). # of vars = # of free fluxes for steady state MFA; # of vars = # of free fluxes + # of concentrations for INST MFA. :type: dict .. attribute:: initial_matrix_Xs Size => initial MDVs of EMU in matrix X, i.e., the natural MDVs. The initial MDV matrix has the same shape of matrix X. :type: dict .. attribute:: initial_matrix_Ys Size => initial MDVs of EMU in matrix Y, i.e., either natural MDVs or labeled MDVs. The initial MDV matrix has the same shape of matrix Y. :type: dict .. attribute:: initial_matrix_Xs_der_p, initial_matrix_Ys_der_p Size => 3-D array in shape of (# of vars), X(Y).shape[0], X(Y).shape[1]) which is the initial MDV derivatives of EMUs in matrix X(Y) w.r.t. variables. # of vars = # of free fluxes + # of concentrations for INST MFA. :type: dict .. attribute:: initial_sim_MDVs EMU ID => {t0 => MDV}. MDV of target EMUs at t0. :type: dict .. attribute:: EAMs Size => EMU adjacency matrix (EAM). Cells are symbolic expression of flux. :type: dict of df .. attribute:: matrix_As, matrix_Bs Size => [lambdified matrix A(B), [flux IDs], [EMUs]]. :type: dict .. attribute:: matrix_As_der_p, matrix_Bs_der_p Size => 3-D array in shape of (# of vars, A(B).shape[0], A(B).shape[1]) which is the derivatives of matrix A(B) w.r.t. variables. # of vars = # of free fluxes for steady state MFA; # of vars = # of free fluxes + # of concentrations for INST MFA. :type: dict .. attribute:: matrix_Ms Size => [lambdified matrix M, [metabolite IDs]]. :type: dict .. attribute:: matrix_Ms_der_p Size => 3-D array in shape of (# of vars, M.shape[0], M.shape[1]), which is the derivatives of matrix M w.r.t. variables. # of vars = # of free fluxes for steady state MFA; # of vars = # of free fluxes + # of concentrations for INST MFA. :type: dict .. attribute:: label_atom Labeled atom, i.e., the base atom in MDV, currently only supprts "H", "C" and "N". :type: str .. attribute:: labeling_strategy Metabolite ID => [labeling_pattern(s), percentage(s), purity(s)]. :type: dict .. attribute:: measured_MDVs EMU ID (metabolite ID + '_' + atom NOs) => [means of MDV, SDs of MDV]. :type: dict .. attribute:: measured_MDVs_inv_cov Inversed covariance matrix of measured MDVs with variances on the diagnol, other elements are zero. :type: array .. attribute:: measured_fluxes Irreversible reaction ID => [mean, SD]. :type: dict .. attribute:: measured_fluxes_inv_cov Inversed covariance matrix of measured fluxes with variances on the diagnol, other elements are zero. :type: array .. attribute:: measured_fluxes_der_p Derivative of measured fluxes w.r.t. variables in shape of (# of measured fluxes, # of vars), # of vars = # of free fluxes for steady state MFA; # of vars = # of free fluxes + # of concentrations for INST MFA. :type: array .. attribute:: measured_inst_MDVs EMU ID (metabolite ID + '_' + atom NOs) => {timepoint => [means of MDV, SDs of MDV]}. :type: dict .. attribute:: measured_inst_MDVs_inv_cov Inversed covariance matrix of measured concatenated MDVs with variances on the diagnol, other elements are zero. Timepoints are concatenated except t0. :type: array .. attribute:: null_space Null space of total stoichiometric matrix. :type: 2-D array .. attribute:: transform_matrix Transform matrix letting vnet = transform_matrix*v. :type: 2-D array .. py:attribute:: name :value: 'unnamed' .. py:attribute:: reactions_info .. py:attribute:: target_EMUs :value: [] .. py:attribute:: timepoints :value: [] .. py:attribute:: substrate_MDVs .. py:attribute:: substrate_MDVs_der_p .. py:attribute:: EAMs .. py:attribute:: matrix_As .. py:attribute:: matrix_Bs .. py:attribute:: matrix_Ms .. py:attribute:: matrix_As_der_p .. py:attribute:: matrix_Bs_der_p .. py:attribute:: matrix_Ms_der_p .. py:attribute:: null_space :value: None .. py:attribute:: transform_matrix :value: None .. py:attribute:: initial_matrix_Xs .. py:attribute:: initial_matrix_Ys .. py:attribute:: initial_matrix_Xs_der_p .. py:attribute:: initial_matrix_Ys_der_p .. py:attribute:: initial_sim_MDVs .. py:attribute:: label_atom :value: None .. py:attribute:: labeling_strategy .. py:attribute:: measured_MDVs .. py:attribute:: measured_fluxes .. py:attribute:: measured_inst_MDVs .. py:attribute:: measured_MDVs_inv_cov :value: None .. py:attribute:: measured_inst_MDVs_inv_cov :value: None .. py:attribute:: measured_fluxes_inv_cov :value: None .. py:attribute:: measured_fluxes_der_p :value: None .. py:attribute:: unbalanced_metabolites .. py:attribute:: net_fluxes_bounds .. py:attribute:: net_fluxes_range .. py:attribute:: concentrations_bounds .. py:attribute:: concentrations_range .. py:attribute:: total_fluxes .. py:attribute:: concentrations .. py:method:: add_reactions(reactions) :param reactions: :type reactions: Reaction or list of Reaction .. py:method:: remove_reactions(reactions) :param reactions: :type reactions: Reaction or list of Reaction .. py:method:: read_from_file(file) :param file: tsv or excel file with reactions with fields "reaction_ID", "substrate_IDs(atom)", "product_IDs(atom)" and "reversibility". Header line starts with "#", and will be skiped. :type file: file path .. py:property:: metabolites_info returns: **metabsInfo** -- metabolite ID => list of Metabolites :rtype: dict .. py:property:: metabolites .. py:property:: metabolites_with_atoms .. py:property:: reactions .. py:property:: n_metabolites .. py:property:: n_reactions .. py:method:: _full_net_stoichiometric_matrix(metabolites, reactions) Re-estimate stoichiometric matrix if metabolites or reactions changes. :param metabolites: metabolite IDs :type metabolites: tuple :param reactions: reaction IDs :type reactions: tuple :returns: **netS** -- Complete stoichiometric matrix for net reaction with all metabolites in rows and net reactions in columns. :rtype: df .. py:method:: _full_total_stoichiometric_matrix(metabolites, reactions) Re-estimate stoichiometric matrix if metabolites or reactions changes. :param metabolites: metabolite IDs :type metabolites: tuple :param reactions: reaction IDs :type reactions: tuple :returns: **totalS** -- Complete stoichiometric matrix for total reaction with all metabolites in rows and total reactions in columns. :rtype: df .. py:property:: end_substrates .. py:property:: end_products .. py:method:: get_net_stoichiometric_matrix(exclude_metabs=None, include_ends=False) :param exclude_metabs: Excluded metabolites. :type exclude_metabs: list or set :param include_ends: Whether to include end metabolites (i.e., initial substrates and final products). :type include_ends: bool :param Returns: :param netS: Net stoichiometric matrix with balanced metabolites in rows and net reactions in columns :type netS: df .. py:method:: get_total_stoichiometric_matrix(exclude_metabs=None, include_ends=False) :param exclude_metabs: Excluded metabolites. :type exclude_metabs: list or set :param include_ends: Whether to include end metabolites (initial substrates and final products). :type include_ends: bool :param Returns: :param totalS: Total stoichiometric matrix with balanced metabolites in rows and total reactions in columns :type totalS: df .. py:property:: netfluxids .. py:property:: totalfluxids .. py:property:: concids .. py:property:: metabolite_adjacency_matrix returns: **MAM** -- Metabolite adjacency matrix (MAM). Metabolites with atoms are in index and columns (no duplicates). List of Reactions are in cells if reactions exists between sub (index) and pro (columns), [] otherwise :rtype: df .. py:method:: __repr__() .. py:method:: _BFS(iniEMU) :param iniEMU: Starting EMU of the decomposition. Metabolite of iniEMU can be any Metabolite instance with the same id. :type iniEMU: EMU :returns: **EAMsInfo** -- Size => list of [EMU, [precursor EMUs], symbolic expression of flux]. :rtype: dict of list .. py:method:: _get_original_EAMs(iniEMU) :param iniEMU: Starting EMU of the decomposition. :type iniEMU: EMU :returns: **EAMs** -- Size => original EMU adjacency matrix (EAM), cells are symbolic expression of flux。 :rtype: dict of df .. py:method:: _replace_list_item(iterable, toReplace, value) :param iterable: Iterable can be nested. :type iterable: iterable :param toReplace: Value to be replaced. :type toReplace: scalar :param value: Value that replaces toReplace. :type value: scalar :returns: **newLst** -- New tuple with toReplace recursively replaced. :rtype: tuple .. py:method:: _uniquify_dataFrame_index(df) :param df: DataFrame to be uniquify. :type df: df :returns: **uniqueDf** -- DataFrame with duplicate rows combined (summated). :rtype: df .. py:method:: _lump_linear_EMUs(EAMs, iniEMU) :param EAMs: Size => original EMU adjacency matrix (EAM), cells are symbolic expression of flux. :type EAMs: dict of df :param iniEMU: Starting EMU of the decomposition. :type iniEMU: EMU :returns: **lumpedEAMs** -- Size => lumped EMU adjacency matrix (EAM), cells are symbolic expression of flux. :rtype: dict of df .. py:method:: _combine_equivalent_EMUs(EAMs) :param EAMs: Size => original EMU adjacency matrix (EAM), cells are symbolic expression of flux. :type EAMs: dict of df :returns: **combinedEAMs** -- Size => EAM with equivalent EMUs combined, cells are symbolic expression of flux. :rtype: dict df .. py:method:: get_emu_adjacency_matrices(iniEMU, lump=True) :param iniEMU: Starting EMU of the decomposition. :type iniEMU: EMU :param lump: Whether to lump linear EMUs. :type lump: bool :returns: **EAMs** -- Size => EMU adjacency matrix (EAM) after lumping of linear EMUs and combination of equivalent EMUs. Index and columns are EMUs, cells are symbolic expression of flux. :rtype: dict of df .. rubric:: Notes EMUs in sequential reactions can not be lumped in transient MFA. .. py:method:: _merge_EAMs(EAM1, EAM2) :param EAM1: EMU adjacency matrix (EAM) to merge :type EAM1: df :param EAM2: EMU adjacency matrix (EAM) to merge :type EAM2: df :returns: **mergedEAM** -- merged EAM :rtype: df .. py:method:: _merge_all_EAMs(*EAMsAll) :param EAMsAll: EAMs is dict of DataFrame, i.e., Size => EMU adjacency matrix (EAM). :type EAMsAll: tuple of EAMs :returns: **mergedEAMs** -- Size => merged EAM :rtype: dict of df .. py:method:: _decompose_network(metabolites, atom_nos, lump=True, n_jobs=1) :param metabolites: List of metabolite IDs from which initial EMU will be generated to start the decomposition. :type metabolites: list of str :param atom_nos: Atom NOs of corresponding metabolites, len(atom_nos) should be equal to len(metabolites). :type atom_nos: list of str :param lump: Whether to lump linear EMUs. :type lump: bool :param n_jobs: # of jobs to run in parallel. :type n_jobs: int :returns: **mergedEAMs** -- Size => merged EMU adjacency matrix (EAM). :rtype: dict of df .. rubric:: Notes EMUs in sequential reactions can not be lumped in transient MFA. .. py:method:: decompose_network(ini_emus, lump=True, n_jobs=1) :param ini_emus: Metabolite ID => atom NOs or list of atom NOs. Atom NOs can be int list or str, e.g., {'Ala': [[1,2,3], '23'], 'Ser': '123'} :type ini_emus: dict :param lump: Whether to lump linear EMUs. :type lump: bool :param n_jobs: # of jobs to run in parallel. :type n_jobs: int :returns: **mergedEAMs** -- Size => merged EMU adjacency matrix (EAM) :rtype: dict of df .. rubric:: Notes EMUs in sequential reactions can not be lumped in transient MFA. .. py:method:: optimizer() .. py:method:: simulator(kind) :param kind: * If "ss", simulation at isotopic steady state is performed. * If "inst", simulation at isotopically nonstationary state is performed. :type kind: {"ss", "inst"} .. py:method:: fitter(kind) :param kind: * If "ss", fitting at isotopic steady state is performed. * If "inst", fitting at isotopically nonstationary state is performed. :type kind: {"ss", "inst"} .. py:class:: EMU(id, metabolite, atom_nos) Define EMU (i.e., elementary metabolite unit) object and its operations. EMUs in the same metabolite and with the same atom NOs are considered as identical, while metabolites which they derived from could be different. EMUs can be compared based self.metabolite_id and self.atom_nos. EMU and iterable object of EMUs can also be compared. In this case EMU will be put into the same iterable object with single item, and comparison between two iterables are performed. Currently only binary equivalents are considered. :param id: EMU ID :type id: str :param metabolite: Which metabolite the EMU comes from. :type metabolite: Metabolite or str :param atom_nos: Atom NOs, sorted by number. :type atom_nos: list of int or str .. attribute:: id EMU ID :type: str .. attribute:: metabolite Which metabolite the EMU comes from. :type: Metabolite .. attribute:: metabolite_id Metabolite ID. :type: str .. attribute:: atom_nos Atom NOs, sorted by number. :type: list of int .. attribute:: size Size of EMU. :type: int .. attribute:: equivalent_atom_nos Equivalent atom NOs, sorted by number. :type: None or list of int .. attribute:: equivalent Equivalent of EMU. :type: EMU .. py:attribute:: id .. py:attribute:: size .. py:method:: __hash__() .. py:method:: __eq__(other) :param other: :type other: EMU or iterable .. py:method:: __lt__(other) :param other: :type other: EMU or iterable .. py:method:: __gt__(other) :param other: :type other: EMU or iterable .. py:property:: equivalent_atom_nos returns: **equivAtomNOs** -- Equivalent atom NOs, sorted by number. :rtype: list of int or None .. py:property:: equivalent returns: **EMU** -- Equivalent of current EMU. :rtype: EMU .. py:method:: __repr__() .. 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:: 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:: 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