10.1.1.1.1. freeflux.analysis.fit¶
Define the Fitter class.
10.1.1.1.1.1. Attributes¶
10.1.1.1.1.2. Classes¶
10.1.1.1.1.3. Module Contents¶
- class freeflux.analysis.fit.Fitter(model)[source]¶
Bases:
freeflux.optim.optim.Optimizer,freeflux.analysis.simulate.Simulator- Parameters:
model (Model) – Freeflux Model.
- 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.
- 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.
- 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].
- _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.
- _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.
- _estimate_fluxes_range(exclude_metabs=None)[source]¶
- Parameters:
exclude_metabs (list) – Metabolite IDs, metabolites excluded from mass balance.
- _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.