10.1.1.1.1. freeflux.analysis.fit

Define the Fitter class.

10.1.1.1.1.1. Attributes

__author__

10.1.1.1.1.2. Classes

Fitter

10.1.1.1.1.3. Module Contents

freeflux.analysis.fit.__author__ = 'Chao Wu'[source]
class freeflux.analysis.fit.Fitter(model)[source]

Bases: freeflux.optim.optim.Optimizer, freeflux.analysis.simulate.Simulator

Parameters:

model (Model) – Freeflux Model.

calculator[source]
set_measured_MDV(fragmentid, mean, sd)[source]

Set measured MDV.

Parameters:
  • fragmentid (str) – Metabolite ID + “_” + atom NOs, e.g., “Glu_12345”.

  • mean (array) – Means of measured MDV vector.

  • sd (array) – Standard deviations of measured MDV vector.

set_measured_MDVs_from_file(file)[source]

Read measured MDVs from file.

Parameters:

file (file path) –

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.

_unset_measured_MDVs(fragmentids)[source]
Parameters:

fragmentids (str or list of str) – Measured MDV ID(s).

set_measured_flux(fluxid, mean, sd)[source]

Set measured flux.

Parameters:
  • fluxid (str) – Flux ID, i.e., reaction ID. Typically, measured fluxes are substrate consumption product formation or cell growth, etc. They should be irreversible.

  • mean (float) – Mean of measured flux.

  • sd (float) – Standard deviation of measured flux.

set_measured_fluxes_from_file(file)[source]

Read measured fluxes from file.

Parameters:

file (file path) –

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.

_unset_measured_fluxes(fluxids)[source]
Parameters:

fluxids (str or list of str) – Measured flux ID(s).

set_unbalanced_metabolites(metabids)[source]
Parameters:

metabids (str or list of str) – Unbalanced metabolite ID(s).

_unset_unbalanced_metabolites(metabids)[source]
Parameters:

metabids (list of str) – Unbalanced metabolite IDs.

set_flux_bounds(fluxid, bounds)[source]

Set lower and upper bounds of flux.

Parameters:
  • fluxid (str or 'all') –

    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.

  • bounds (2-list) –

    [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].

_decompose_network(n_jobs)[source]
Parameters:

n_jobs (int) – # of jobs to run in parallel.

_unset_decomposition()[source]
_calculate_matrix_As_and_Bs_derivatives_p(kind, n_jobs)[source]
Parameters:

kind ({"ss", "inst"}) –

  • If “ss”, variables are free fluxes only.

  • If “inst”, variables include both free fluxes and concentrations.

_unset_matrix_As_and_Bs_derivatives_p()[source]
_calculate_substrate_MDV_derivatives_p(kind, extra_subs=None)[source]
Parameters:
  • kind ({"ss", "inst"}) –

    • If “ss”, variables are free fluxes only.

    • If “inst”, variables include free fluxes and concentrations.

  • extra_subs (str or list of str) – Metabolite ID(s), additional metabolites considered as substrates.

_unset_substrate_MDV_derivatives_p()[source]
_calculate_null_space()[source]
_unset_null_space()[source]
_calculate_transform_matrix()[source]
_unset_transform_matrix()[source]
_calculate_measured_MDVs_inversed_covariance_matrix()[source]
_unset_measured_MDVs_inversed_covariance_matrix()[source]
_calculate_measured_fluxes_inversed_covariance_matrix()[source]
_unset_measured_fluxes_inversed_covariance_matrix()[source]
_calculate_measured_fluxes_derivative_p(kind)[source]
Parameters:

kind ({"ss", "inst"}) –

  • If “ss”, variables are free fluxes only.

  • If “inst”, variables include free fluxes and concentrations.

_unset_measured_fluxes_derivative_p()[source]
_estimate_fluxes_range(exclude_metabs=None)[source]
Parameters:

exclude_metabs (list) – Metabolite IDs, metabolites excluded from mass balance.

_unset_net_fluxes_range(fluxids)[source]
Parameters:

fluxids (str or list of str) – Fluxe ID(s).

prepare(dilution_from=None, n_jobs=1)[source]
Parameters:
  • dilution_from (str or list of str) – ID(s) of unlabeled (inactive) metabolite leading to dilution effect. These metabolites have zero stoichiometric coefficients in reaction network.

  • n_jobs (int) – If n_jobs > 1, preparation will run in parallel.

_check_dependencies(fit_measured_fluxes)[source]
Parameters:

fit_measured_fluxes (bool) – Whether to fit measured fluxes.

solve(fit_measured_fluxes=True, ini_fluxes=None, solver='slsqp', tol=1e-06, max_iters=400, show_progress=True)[source]
Parameters:
  • fit_measured_fluxes (bool) – Whether to fit measured fluxes.

  • ini_fluxes (ser or file in .tsv or .xlsx) – Initial values of net fluxes

  • solver ({"slsqp", "ralg"}) –

    • If “slsqp”, scipy.optimize.minimze will be used.

    • If “ralg”, openopt NLP solver will be used.

  • tol (float) – Tolerance for termination.

  • max_iters (int) – Maximum # of iterations.

  • show_progress (bool) – Whether to show the progress bar.

_solve_with_confidence_intervals(fit_measured_fluxes, ini_fluxes, solver, tol, max_iters, nruns)[source]
Parameters:
  • fit_measured_fluxes (bool) – Whether to fit measured fluxes.

  • ini_fluxes (ser or file in .tsv or .xlsx or None) – Initial values of net fluxes.

  • solver ({"slsqp", "ralg"}) –

    • If “slsqp”, scipy.optimize.minimze will be used.

    • If “ralg”, openopt NLP solver will be used.

  • tol (float) – Tolerance for termination.

  • max_iters (int) – Maximum # of iterations.

  • nruns (int) – # of estimations in each worker.

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)[source]
Parameters:
  • fit_measured_fluxes (bool) – Whether to fit measured fluxes.

  • ini_fluxes (ser or file in .tsv or .xlsx) – Initial values of net fluxes.

  • solver ({"slsqp", "ralg"}) –

    • If “slsqp”, scipy.optimize.minimze will be used.

    • If “ralg”, openopt NLP solver will be used.

  • tol (float) – Tolerance for termination.

  • max_iters (int) – Maximum # of iterations.

  • show_progress (bool) – Whether to show the progress bar.

  • n_runs (int) – # of runs to estimate confidence intervals.

  • n_jobs (int) – # of jobs to run in parallel.