10.1.1.1.2. freeflux.analysis.inst_fit

Define the InstFitter class.

10.1.1.1.2.1. Attributes

__author__

10.1.1.1.2.2. Classes

InstFitter

Estimated fluxes are in the unit of umol/gCDW/s if concentrations in the unit of

10.1.1.1.2.3. Module Contents

freeflux.analysis.inst_fit.__author__ = 'Chao Wu'[source]
class freeflux.analysis.inst_fit.InstFitter(model)[source]

Bases: freeflux.analysis.fit.Fitter, freeflux.analysis.inst_simulate.InstSimulator

Estimated fluxes are in the unit of umol/gCDW/s if concentrations in the unit of umol/gCDW and timepoints in the unit of s.

set_measured_MDVs(fragmentid, timepoints, means, sds)[source]

Set measured MDVs at various timepoints.

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

  • timepoints (float or list of float) – Timepoint(s).

  • means (array or list of array) – Mean of measured MDV(s). len(means) should be equal to len(timepoints).

  • sds (array or list of array) – Standard deviation of measured MDV(s). len(sds) should be equal to len(timepoints).

set_measured_MDVs_from_file(file)[source]

Read measured MDVs at various timepoints from file.

Parameters:

file (file path) –

Path of tsv or excel file with fields “fragment_ID”, “time”, “mean” and “sd”. “fragment_ID” is metabolite ID + ‘_’ + atom NOs, e.g., ‘Glu_12345’; “time” is timepoint when MDVs are measured (while some timepoints could be missing); “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(fragmentid_tpoints)[source]
Parameters:

fragmentid_tpoints (dict) – measured MDV ID => list of timepoints.

set_concentration_bounds(metabid, bounds)[source]

Set lower and upper bounds for concentration in unit of umol/gCDW.

Parameters:
  • metabid (str or 'all') – Metabolite ID. If ‘all’, all concentrations will be set to the range.

  • bounds (2-list) – [lower bound, upper bound]. Lower bound is not allow to equal upper bound.

_set_default_concentration_bounds()[source]

This method assign bounds of [0.01, 100] (umol/gCDW) for concentrations not set by set_concentration_bounds

_unset_concentration_bounds(metabids)[source]
Parameters:

metabids (str or list of str) – Metabolite ID(s).

_decompose_network(n_jobs)[source]
Parameters:

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

_set_timepoints()[source]
_calculate_matrix_Ms_derivatives_p()[source]
_unset_matrix_Ms_derivatives_p()[source]
_calculate_measured_inst_MDVs_inversed_covariance_matrix()[source]
_unset_measured_inst_MDVs_inversed_covariance_matrix()[source]
_calculate_initial_matrix_Xs_derivatives_p()[source]
_unset_initial_matrix_Xs_derivatives_p()[source]
_calculate_initial_matrix_Ys_derivatives_p()[source]
_unset_initial_matrix_Ys_derivatives_p()[source]
_estimate_concentrations_range()[source]
_unset_concentrations_range(metabids)[source]
Parameters:

metabids (str or list of str) – Metabolite 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, decomposition job 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, ini_concs=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.

  • ini_concs (ser or file in .tsv or .xlsx) – Initial values of concentrations.

  • solvor ({"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, ini_concs, 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.

  • ini_concs (ser or file in .tsv or .xlsx or None) – Initial values of concentrations.

  • solvor ({"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, ini_concs=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.

  • ini_concs (ser or file in .tsv or .xlsx) – Initial values of concentrations.

  • solvor ({"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) – Max # 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.