freeflux.io.results =================== .. py:module:: freeflux.io.results .. autoapi-nested-parse:: Define classes of simulation and fitting results. Attributes ---------- .. autoapisummary:: freeflux.io.results.__author__ Classes ------- .. autoapisummary:: freeflux.io.results.pDict freeflux.io.results.FBAResults freeflux.io.results.FVAResults freeflux.io.results.SimResults freeflux.io.results.InstSimResults freeflux.io.results.FitResults freeflux.io.results.FitMCResults freeflux.io.results.InstFitResults freeflux.io.results.InstFitMCResults Module Contents --------------- .. py:data:: __author__ :value: 'Chao Wu' .. py:class:: pDict(*args, digits=3, **kwargs) Bases: :py:obj:`dict` dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) .. py:attribute:: digits :value: 3 .. py:method:: __repr__() Return repr(self). .. py:class:: FBAResults(obj, opt_obj, opt_fluxes) :param obj: Reaction ID => coefficient, i.e., the objective function. :type obj: dict :param opt_obj: Optimal objective. :type opt_obj: float :param opt_fluxes: Optimal fluxes. :type opt_fluxes: OrderedDict .. py:attribute:: _obj .. py:attribute:: _opt_obj .. py:attribute:: _opt_fluxes .. py:property:: objective .. py:property:: opt_objective .. py:property:: opt_fluxes .. py:method:: __repr__() .. py:class:: FVAResults(flux_ranges) :param flux_ranges: Reaction ID => [lower bound, upper bound]. :type flux_ranges: dict .. py:attribute:: _flux_ranges .. py:property:: flux_ranges .. py:method:: __repr__() .. py:class:: SimResults(simulated_MDVs) :param simulated_MDVs: EMU ID => MDV. :type simulated_MDVs: dict .. py:attribute:: _simulated_MDVs .. py:attribute:: _simulated_EMUs .. py:property:: simulated_EMUs .. py:method:: simulated_MDV(emuid) Parameters emuid: str EMU ID .. py:method:: __repr__() .. py:class:: InstSimResults(simulated_inst_MDVs) :param simulated_inst_MDVs: EMU IDs => {timepoints => MDV}. :type simulated_inst_MDVs: dict .. py:attribute:: _simulated_inst_MDVs .. py:attribute:: _simulated_EMUs .. py:attribute:: _timepoints .. py:property:: simulated_EMUs .. py:property:: timepoints .. py:method:: simulated_MDV(emuid) :param emuid: EMU ID. :type emuid: str .. py:method:: plot_MDV_kinetics(emuid, show_fig=True, output_dir=None) :param emuid: EMU ID. :type emuid: str :param show_fig: Whether to show figure. :type show_fig: bool :param output_dir: Output directory. :type output_dir: str .. py:method:: __repr__() .. py:class:: FitResults(opt_total_fluxes, opt_net_fluxes, opt_obj, opt_resids, n_meas, n_params, sim_MDVs, exp_MDVs, sim_fluxes, exp_fluxes, hessian, null_space, transform_matrix, sim_MDVs_der_u, sim_fluxes_der_u, exp_MDVs_inv_cov, exp_fluxes_inv_cov, is_success) :param opt_total_fluxes: Total fluxes at optimal objective. :type opt_total_fluxes: ser :param opt_net_fluxes: Net fluxes at optimal objective. :type opt_net_fluxes: ser :param opt_obj: Optimal value of objective. :type opt_obj: float :param opt_resids: Optimal weighted residuals. :type opt_resids: array :param n_meas: # of measurements. :type n_meas: int :param n_params: # of parameters. :type n_params: int :param sim_MDVs: EMU ID => simulated MDV. :type sim_MDVs: dict :param exp_MDVs: EMU ID => [means, sds]. :type exp_MDVs: dict :param sim_fluxes: Flux ID => simulated flux. :type sim_fluxes: dict :param exp_fluxes: Flux ID => [mean, sd]. :type exp_fluxes: dict :param hessian: Hessian matrix at convergence. :type hessian: array :param null_space: Null space of stoichiometric matrix. :type null_space: array :param transform_matrix: Transform matrix from total fluxes to net fluxes. :type transform_matrix: array :param sim_MDVs_der_u: Derivative of simulated MDVs w.r.t. free fluxes. :type sim_MDVs_der_u: array :param sim_fluxes_der_u: Derivative of simualted fluxes w.r.t. free fluxes. :type sim_fluxes_der_u: array :param exp_MDVs_inv_cov: Inversed covariance matrix of measured MDVs. :type exp_MDVs_inv_cov: array :param exp_fluxes_inv_cov: Inversed covariance matrix of measured fluxes. :type exp_fluxes_inv_cov: array :param is_success: Whether the optimization is successful. :type is_success: bool .. py:attribute:: _opt_total_fluxes .. py:attribute:: _opt_net_fluxes .. py:attribute:: _opt_obj .. py:attribute:: opt_resids .. py:attribute:: simulated_MDVs .. py:attribute:: measured_MDVs .. py:attribute:: simulated_fluxes .. py:attribute:: measured_fluxes .. py:attribute:: hessian .. py:attribute:: null_space .. py:attribute:: transform_matrix .. py:attribute:: n_meas .. py:attribute:: n_params .. py:attribute:: dof .. py:attribute:: sim_MDVs_der_u .. py:attribute:: sim_fluxes_der_u .. py:attribute:: exp_MDVs_inv_cov .. py:attribute:: exp_fluxes_inv_cov .. py:attribute:: is_success .. py:property:: n_total_fluxes .. py:property:: n_net_fluxes .. py:property:: n_free_fluxes .. py:property:: opt_objective .. py:property:: opt_total_fluxes .. py:property:: opt_net_fluxes .. py:property:: optimization_successful .. py:method:: chi2_test(confidence_level=0.999) Perform chi square test of the optimal objective. SSR < LB of chi square interval sometimes can be also considered as successful estimation. :param confidence_level: Confidence level, e.g. 0.95 as 95% confidence level. :type confidence_level: float .. py:method:: plot_normal_probability(show_fig=True, output_dir=None) Perform normal probability plot for residuals. :param show_fig: Whether to show figure. :type show_fig: bool :param output_dir: Output directory. :type output_dir: str .. py:method:: plot_simulated_vs_measured_MDVs(show_fig=True, output_dir=None) Plot simulated and measured MDVs. :param show_fig: Whether to show figure. :type show_fig: bool :param output_dir: Output directory. :type output_dir: str .. py:method:: plot_simulated_vs_measured_fluxes(show_fig=True, output_dir=None) Plot simulated and measured fluxes. :param show_fig: Whether to show figure. :type show_fig: bool :param output_dir: Output directory. :type output_dir: str .. py:method:: estimate_confidence_intervals(which='net', confidence_level=0.95) Calculate CI of net (total) fluxes using local estimation. :param which: * "net" if net fluxes. * "total" if total fluxes. :type which: {"net", "total"} :param confidence_level: Confidence level, e.g. 0.95 as 95% confidence level. :type confidence_level: float .. py:method:: estimate_contribution_matrix(which='net') Calculate contribution matrix of measurement variance to net (total) flux variance. :param which: * "net" if net fluxes. * "total" if total fluxes. :type which: {"net", "total"} .. py:method:: estimate_sensitivity(which='net') Calculate sensitivity matrix of estimated net (total) flux w.r.t. measurement changes. :param which: * "net" if net fluxes. * "total" if total fluxes. :type which: {"net", "total"} .. py:method:: _get_name_of_measurements(measured_MDVs) :staticmethod: :param measured_MDVs: EMU ID => [means, sds]. :type measured_MDVs: dict .. py:method:: __repr__() .. py:class:: FitMCResults(total_fluxes_set, net_fluxes_set) :param total_fluxes_set: Set of optimal total fluxes. :type total_fluxes_set: list of ser :param net_fluxes_set: Set of optimal net fluxes. :type net_fluxes_set: list of ser .. py:attribute:: total_fluxes_set .. py:attribute:: net_fluxes_set .. py:method:: estimate_confidence_intervals(which='net', confidence_level=0.95) Estimate CI from a set of fluxes. :param which: * "net" if net fluxes. * "total" if total fluxes. :type which: {"net", "total"} :param confidence_level: Confidence level, e.g. 0.95 as 95% confidence level. :type confidence_level: float .. py:method:: __repr__() .. py:class:: InstFitResults(opt_total_fluxes, opt_net_fluxes, opt_concs, opt_obj, opt_resids, n_meas, n_params, sim_inst_MDVs, exp_inst_MDVs, sim_fluxes, exp_fluxes, hessian, null_space, transform_matrix, sim_inst_MDVs_der_u, sim_fluxes_der_u, exp_inst_MDVs_inv_cov, exp_fluxes_inv_cov, is_success) Bases: :py:obj:`FitResults` :param opt_total_fluxes: Total fluxes at optimal objective. :type opt_total_fluxes: ser :param opt_net_fluxes: Net fluxes at optimal objective. :type opt_net_fluxes: ser :param opt_concs: Concentrations at optimal objective. :type opt_concs: ser :param opt_obj: Optimal value of objective. :type opt_obj: float :param opt_resids: Optimal weighted residuals. :type opt_resids: array :param n_meas: # of measurements. :type n_meas: int :param n_params: # of parameters. :type n_params: int :param sim_inst_MDVs: EMU ID => {t => simulated MDV}. :type sim_inst_MDVs: dict :param exp_inst_MDVs: EMU ID => {t => [means, sds]}. :type exp_inst_MDVs: dict :param sim_fluxes: Flux ID => simulated flux. :type sim_fluxes: dict :param exp_fluxes: Flux ID => [mean, sd]. :type exp_fluxes: dict :param hessian: Hessian matrix at convergence. :type hessian: array :param null_space: Null space of stoichiometric matrix. :type null_space: array :param transform_matrix: Transform matrix from total fluxes to net fluxes. :type transform_matrix: array :param sim_inst_MDVs_der_u: Derivative of simulated MDVs w.r.t. free fluxes. :type sim_inst_MDVs_der_u: array :param sim_fluxes_der_u: Derivative of simualted fluxes w.r.t. free fluxes. :type sim_fluxes_der_u: array :param exp_inst_MDVs_inv_cov: Inversed covariance matrix of measured MDVs. :type exp_inst_MDVs_inv_cov: array :param exp_fluxes_inv_cov: Inversed covariance matrix of measured fluxes. :type exp_fluxes_inv_cov: array :param is_success: Whether the optimization is successful. :type is_success: bool .. py:attribute:: _opt_total_fluxes .. py:attribute:: _opt_net_fluxes .. py:attribute:: _opt_concs .. py:attribute:: _opt_obj .. py:attribute:: opt_resids .. py:attribute:: simulated_inst_MDVs .. py:attribute:: measured_inst_MDVs .. py:attribute:: simulated_fluxes .. py:attribute:: measured_fluxes .. py:attribute:: hessian .. py:attribute:: null_space .. py:attribute:: transform_matrix .. py:attribute:: n_meas .. py:attribute:: n_params .. py:attribute:: dof .. py:attribute:: sim_inst_MDVs_der_u .. py:attribute:: sim_fluxes_der_u .. py:attribute:: exp_inst_MDVs_inv_cov .. py:attribute:: exp_fluxes_inv_cov .. py:attribute:: is_success .. py:property:: n_concentrations .. py:property:: opt_concentrations .. py:method:: plot_simulated_vs_measured_MDVs(show_fig=True, output_dir=None) Plot simulated and measured MDVs. :param show_fig: Whether to show figure. :type show_fig: bool :param output_dir: Output directory. :type output_dir: str .. py:method:: estimate_confidence_intervals(which='net', confidence_level=0.95) Calculate CI of fluxes and concentrations using local estimation. :param which: * "net" if net fluxes. * "total" if total fluxes. * "conc" if concentrations. :type which: {"net", "total", "conc"} :param confidence_level: Confidence level, e.g. 0.95 as 95% confidence level. :type confidence_level: float .. py:method:: estimate_contribution_matrix(which='net') Calculate contribution matrix of measurement variance to net (total) flux variance. :param which: * "net" if net fluxes. * "total" if total fluxes. :type which: {"net", "total"} .. py:method:: estimate_sensitivity(which='net') Calculate sensitivity matrix of estimated net (total) flux w.r.t. measurement changes. :param which: * "net" if net fluxes. * "total" if total fluxes. :type which: {"net", "total"} .. py:method:: _get_name_of_measurements(measured_MDVs) :staticmethod: :param measured_MDVs: EMU ID => {t => [means, sds]}. :type measured_MDVs: dict .. py:class:: InstFitMCResults(total_fluxes_set, net_fluxes_set, concs_set) Bases: :py:obj:`FitMCResults` :param total_fluxes_set: Set of optimal total fluxes. :type total_fluxes_set: list of ser :param net_fluxes_set: Set of optimal net fluxes. :type net_fluxes_set: list of ser :param concs_set: Set of optimal concentrations. :type concs_set: list of ser .. py:attribute:: concs_set .. py:method:: estimate_confidence_intervals(which='net', confidence_level=0.95) This method estimates CI from a set of fluxes. :param which: * "net" if net fluxes. * "total" if total fluxes. * "conc" if concentrations. :type which: {"net", "total", "conc"} :param confidence_level: Confidence level, e.g. 0.95 as 95% confidence level. :type confidence_level: float