freeflux.analysis.fit ===================== .. py:module:: freeflux.analysis.fit .. autoapi-nested-parse:: Define the Fitter class. Attributes ---------- .. autoapisummary:: freeflux.analysis.fit.__author__ Classes ------- .. autoapisummary:: freeflux.analysis.fit.Fitter Module Contents --------------- .. py:data:: __author__ :value: 'Chao Wu' .. py:class:: Fitter(model) Bases: :py:obj:`freeflux.optim.optim.Optimizer`, :py:obj:`freeflux.analysis.simulate.Simulator` :param model: Freeflux Model. :type model: Model .. py:attribute:: calculator .. py:method:: set_measured_MDV(fragmentid, mean, sd) Set measured MDV. :param fragmentid: Metabolite ID + "_" + atom NOs, e.g., "Glu_12345". :type fragmentid: str :param mean: Means of measured MDV vector. :type mean: array :param sd: Standard deviations of measured MDV vector. :type sd: array .. py:method:: set_measured_MDVs_from_file(file) Read measured MDVs from file. :param file: tsv or excel file with fields "fragment_ID", "mean" and "sd". "fragment_ID" is metabolite ID + "_" + atom NOs, e.g., 'Glu_12345'; "mean" and "sd" are the mean and standard deviation of MDV with element seperated by ",". Header line starts with "#", and will be skiped. :type file: file path .. py:method:: _unset_measured_MDVs(fragmentids) :param fragmentids: Measured MDV ID(s). :type fragmentids: str or list of str .. py:method:: set_measured_flux(fluxid, mean, sd) Set measured flux. :param fluxid: Flux ID, i.e., reaction ID. Typically, measured fluxes are substrate consumption product formation or cell growth, etc. They should be irreversible. :type fluxid: str :param mean: Mean of measured flux. :type mean: float :param sd: Standard deviation of measured flux. :type sd: float .. py:method:: set_measured_fluxes_from_file(file) Read measured fluxes from file. :param file: tsv or excel file with fields "reaction_ID", "mean" and "sd". "reaction_ID" is reaction ID, typically measured fluxes are substrate consumption, product formation or cell growth, etc. They should be irreversible; "mean" and "sd" are the mean and standard deviation of measured flux. Header line starts with "#", and will be skiped. :type file: file path .. py:method:: _unset_measured_fluxes(fluxids) :param fluxids: Measured flux ID(s). :type fluxids: str or list of str .. py:method:: set_unbalanced_metabolites(metabids) :param metabids: Unbalanced metabolite ID(s). :type metabids: str or list of str .. py:method:: _unset_unbalanced_metabolites(metabids) :param metabids: Unbalanced metabolite IDs. :type metabids: list of str .. py:method:: set_flux_bounds(fluxid, bounds) Set lower and upper bounds of flux. :param fluxid: Flux ID, i.e., reaction ID. Since forward and backward fluxes of reversible reaction are usually unknown, the method is used to set the range of net fluxes. If 'all', all fluxes will be set to the range. :type fluxid: str or 'all' :param bounds: [lower bound, upper bound]. Lower bound is not allow to equal upper bound. Use set_measured_flux (or set_measured_fluxes_from_file) to set fixed value of flux. For irreversible reaction, the lower bound will be set to zero ignorant of bounds[0]. :type bounds: 2-list .. py:method:: _decompose_network(n_jobs) :param n_jobs: # of jobs to run in parallel. :type n_jobs: int .. py:method:: _unset_decomposition() .. py:method:: _calculate_matrix_As_and_Bs_derivatives_p(kind, n_jobs) :param kind: * If "ss", variables are free fluxes only. * If "inst", variables include both free fluxes and concentrations. :type kind: {"ss", "inst"} .. py:method:: _unset_matrix_As_and_Bs_derivatives_p() .. py:method:: _calculate_substrate_MDV_derivatives_p(kind, extra_subs=None) :param kind: * If "ss", variables are free fluxes only. * If "inst", variables include free fluxes and concentrations. :type kind: {"ss", "inst"} :param extra_subs: Metabolite ID(s), additional metabolites considered as substrates. :type extra_subs: str or list of str .. py:method:: _unset_substrate_MDV_derivatives_p() .. py:method:: _calculate_null_space() .. py:method:: _unset_null_space() .. py:method:: _calculate_transform_matrix() .. py:method:: _unset_transform_matrix() .. py:method:: _calculate_measured_MDVs_inversed_covariance_matrix() .. py:method:: _unset_measured_MDVs_inversed_covariance_matrix() .. py:method:: _calculate_measured_fluxes_inversed_covariance_matrix() .. py:method:: _unset_measured_fluxes_inversed_covariance_matrix() .. py:method:: _calculate_measured_fluxes_derivative_p(kind) :param kind: * If "ss", variables are free fluxes only. * If "inst", variables include free fluxes and concentrations. :type kind: {"ss", "inst"} .. py:method:: _unset_measured_fluxes_derivative_p() .. py:method:: _estimate_fluxes_range(exclude_metabs=None) :param exclude_metabs: Metabolite IDs, metabolites excluded from mass balance. :type exclude_metabs: list .. py:method:: _unset_net_fluxes_range(fluxids) :param fluxids: Fluxe ID(s). :type fluxids: str or list of str .. py:method:: prepare(dilution_from=None, n_jobs=1) :param dilution_from: ID(s) of unlabeled (inactive) metabolite leading to dilution effect. These metabolites have zero stoichiometric coefficients in reaction network. :type dilution_from: str or list of str :param n_jobs: If n_jobs > 1, preparation will run in parallel. :type n_jobs: int .. py:method:: _check_dependencies(fit_measured_fluxes) :param fit_measured_fluxes: Whether to fit measured fluxes. :type fit_measured_fluxes: bool .. py:method:: solve(fit_measured_fluxes=True, ini_fluxes=None, solver='slsqp', tol=1e-06, max_iters=400, show_progress=True) :param fit_measured_fluxes: Whether to fit measured fluxes. :type fit_measured_fluxes: bool :param ini_fluxes: Initial values of net fluxes :type ini_fluxes: ser or file in .tsv or .xlsx :param solver: * If "slsqp", scipy.optimize.minimze will be used. * If "ralg", openopt NLP solver will be used. :type solver: {"slsqp", "ralg"} :param tol: Tolerance for termination. :type tol: float :param max_iters: Maximum # of iterations. :type max_iters: int :param show_progress: Whether to show the progress bar. :type show_progress: bool .. py:method:: _solve_with_confidence_intervals(fit_measured_fluxes, ini_fluxes, solver, tol, max_iters, nruns) :param fit_measured_fluxes: Whether to fit measured fluxes. :type fit_measured_fluxes: bool :param ini_fluxes: Initial values of net fluxes. :type ini_fluxes: ser or file in .tsv or .xlsx or None :param solver: * If "slsqp", scipy.optimize.minimze will be used. * If "ralg", openopt NLP solver will be used. :type solver: {"slsqp", "ralg"} :param tol: Tolerance for termination. :type tol: float :param max_iters: Maximum # of iterations. :type max_iters: int :param nruns: # of estimations in each worker. :type nruns: int .. py:method:: solve_with_confidence_intervals(fit_measured_fluxes=True, ini_fluxes=None, solver='slsqp', tol=1e-06, max_iters=400, n_runs=100, n_jobs=1, show_progress=True) :param fit_measured_fluxes: Whether to fit measured fluxes. :type fit_measured_fluxes: bool :param ini_fluxes: Initial values of net fluxes. :type ini_fluxes: ser or file in .tsv or .xlsx :param solver: * If "slsqp", scipy.optimize.minimze will be used. * If "ralg", openopt NLP solver will be used. :type solver: {"slsqp", "ralg"} :param tol: Tolerance for termination. :type tol: float :param max_iters: Maximum # of iterations. :type max_iters: int :param show_progress: Whether to show the progress bar. :type show_progress: bool :param n_runs: # of runs to estimate confidence intervals. :type n_runs: int :param n_jobs: # of jobs to run in parallel. :type n_jobs: int