10.1.2.1.4. freeflux.core.model¶
Define the Model class.
10.1.2.1.4.1. Attributes¶
10.1.2.1.4.2. Classes¶
Model class is the fundamental class of FreeFlux hosting operations for 13C MFA. |
10.1.2.1.4.3. Module Contents¶
- class freeflux.core.model.Model(name='unnamed')[source]¶
Model class is the fundamental class of FreeFlux hosting operations for 13C MFA. A model can be built by adding reactions one by one or reading set of reactions from .tsv or .xlsx file.
- Parameters:
name (str) – Model name.
- metabolites_with_atoms[source]¶
IDs of metabolite with atom assignment, in alphabetical order.
- Type:
- _full_net_stoichiometric_matrix[source]¶
Complete stoichiometric matrix for net reaction with all metabolites in rows, net reactions in columns.
- Type:
df
- _full_total_stoichiometric_matrix[source]¶
Complete stoichiometric matrix for total reaction with all metabolites in rows, total reactions in columns.
- Type:
df
- metabolite_adjacency_matrix[source]¶
Metabolite adjacency matrix (MAM). Metabolites with atoms are in index and columns (no duplicates). List of Reactions are in cells if reactions exists between (sub, pro), [] otherwise.
- Type:
df
- net_fluxes_range[source]¶
Reaction ID => estimeted [lb, ub]. All required net fluxes are included.
- Type:
- concentrations_range[source]¶
Metabolite ID => [lb, ub]. All required concentrations are included.
- Type:
- substrate_MDVs_der_p[source]¶
Substrate EMU => derivatives of substrate MDV w.r.t. variables in shape of (len(MDV), # of vars). # of vars = # of free fluxes for steady state MFA; # of vars = # of free fluxes + # of concentrations for INST MFA.
- Type:
- initial_matrix_Xs[source]¶
Size => initial MDVs of EMU in matrix X, i.e., the natural MDVs. The initial MDV matrix has the same shape of matrix X.
- Type:
- initial_matrix_Ys[source]¶
Size => initial MDVs of EMU in matrix Y, i.e., either natural MDVs or labeled MDVs. The initial MDV matrix has the same shape of matrix Y.
- Type:
- initial_matrix_Xs_der_p, initial_matrix_Ys_der_p
Size => 3-D array in shape of (# of vars), X(Y).shape[0], X(Y).shape[1]) which is the initial MDV derivatives of EMUs in matrix X(Y) w.r.t. variables. # of vars = # of free fluxes + # of concentrations for INST MFA.
- Type:
- EAMs[source]¶
Size => EMU adjacency matrix (EAM). Cells are symbolic expression of flux.
- Type:
dict of df
- matrix_As, matrix_Bs
Size => [lambdified matrix A(B), [flux IDs], [EMUs]].
- Type:
- matrix_As_der_p, matrix_Bs_der_p
Size => 3-D array in shape of (# of vars, A(B).shape[0], A(B).shape[1]) which is the derivatives of matrix A(B) w.r.t. variables. # of vars = # of free fluxes for steady state MFA; # of vars = # of free fluxes + # of concentrations for INST MFA.
- Type:
- matrix_Ms_der_p[source]¶
Size => 3-D array in shape of (# of vars, M.shape[0], M.shape[1]), which is the derivatives of matrix M w.r.t. variables. # of vars = # of free fluxes for steady state MFA; # of vars = # of free fluxes + # of concentrations for INST MFA.
- Type:
- label_atom[source]¶
Labeled atom, i.e., the base atom in MDV, currently only supprts “H”, “C” and “N”.
- Type:
- measured_MDVs_inv_cov[source]¶
Inversed covariance matrix of measured MDVs with variances on the diagnol, other elements are zero.
- Type:
array
- measured_fluxes_inv_cov[source]¶
Inversed covariance matrix of measured fluxes with variances on the diagnol, other elements are zero.
- Type:
array
- measured_fluxes_der_p[source]¶
Derivative of measured fluxes w.r.t. variables in shape of (# of measured fluxes, # of vars), # of vars = # of free fluxes for steady state MFA; # of vars = # of free fluxes + # of concentrations for INST MFA.
- Type:
array
- measured_inst_MDVs[source]¶
EMU ID (metabolite ID + ‘_’ + atom NOs) => {timepoint => [means of MDV, SDs of MDV]}.
- Type:
- measured_inst_MDVs_inv_cov[source]¶
Inversed covariance matrix of measured concatenated MDVs with variances on the diagnol, other elements are zero. Timepoints are concatenated except t0.
- Type:
array
- read_from_file(file)[source]¶
- Parameters:
file (file path) –
tsv or excel file with reactions with fields “reaction_ID”, “substrate_IDs(atom)”, “product_IDs(atom)” and “reversibility”.
Header line starts with “#”, and will be skiped.
- property metabolites_info[source]¶
returns: metabsInfo – metabolite ID => list of Metabolites :rtype: dict
- _full_net_stoichiometric_matrix(metabolites, reactions)[source]¶
Re-estimate stoichiometric matrix if metabolites or reactions changes.
- _full_total_stoichiometric_matrix(metabolites, reactions)[source]¶
Re-estimate stoichiometric matrix if metabolites or reactions changes.
- property metabolite_adjacency_matrix[source]¶
- returns: MAM – Metabolite adjacency matrix (MAM). Metabolites with atoms are in index and columns
(no duplicates). List of Reactions are in cells if reactions exists between sub (index) and pro (columns), [] otherwise
- Return type:
df
- _replace_list_item(iterable, toReplace, value)[source]¶
- Parameters:
iterable (iterable) – Iterable can be nested.
toReplace (scalar) – Value to be replaced.
value (scalar) – Value that replaces toReplace.
- Returns:
newLst – New tuple with toReplace recursively replaced.
- Return type:
- _uniquify_dataFrame_index(df)[source]¶
- Parameters:
df (df) – DataFrame to be uniquify.
- Returns:
uniqueDf – DataFrame with duplicate rows combined (summated).
- Return type:
df
- _combine_equivalent_EMUs(EAMs)[source]¶
- Parameters:
EAMs (dict of df) – Size => original EMU adjacency matrix (EAM), cells are symbolic expression of flux.
- Returns:
combinedEAMs – Size => EAM with equivalent EMUs combined, cells are symbolic expression of flux.
- Return type:
dict df
- get_emu_adjacency_matrices(iniEMU, lump=True)[source]¶
- Parameters:
- Returns:
EAMs – Size => EMU adjacency matrix (EAM) after lumping of linear EMUs and combination of equivalent EMUs. Index and columns are EMUs, cells are symbolic expression of flux.
- Return type:
dict of df
Notes
EMUs in sequential reactions can not be lumped in transient MFA.
- _merge_EAMs(EAM1, EAM2)[source]¶
- Parameters:
EAM1 (df) – EMU adjacency matrix (EAM) to merge
EAM2 (df) – EMU adjacency matrix (EAM) to merge
- Returns:
mergedEAM – merged EAM
- Return type:
df
- _decompose_network(metabolites, atom_nos, lump=True, n_jobs=1)[source]¶
- Parameters:
metabolites (list of str) – List of metabolite IDs from which initial EMU will be generated to start the decomposition.
atom_nos (list of str) – Atom NOs of corresponding metabolites, len(atom_nos) should be equal to len(metabolites).
lump (bool) – Whether to lump linear EMUs.
n_jobs (int) – # of jobs to run in parallel.
- Returns:
mergedEAMs – Size => merged EMU adjacency matrix (EAM).
- Return type:
dict of df
Notes
EMUs in sequential reactions can not be lumped in transient MFA.
- decompose_network(ini_emus, lump=True, n_jobs=1)[source]¶
- Parameters:
- Returns:
mergedEAMs – Size => merged EMU adjacency matrix (EAM)
- Return type:
dict of df
Notes
EMUs in sequential reactions can not be lumped in transient MFA.