psctb.analyse._symca package

Submodules

psctb.analyse._symca._symca module

class psctb.analyse._symca._symca.Symca(mod, auto_load=False, internal_fixed=False, ignore_steady_state=False, keep_zero_elasticities=True)[source]

Bases: object

A class that performs Symbolic Metabolic Control Analysis.

This class takes pysces model as an input and performs symbolic inversion of the E matrix using Sympy by calculating the determinant and adjoint matrices of this E matrix.

Parameters
modPysMod

The pysces model on which to perform symbolic control analysis.

auto_loadboolean

If true

Returns
——
Attributes
ematrix
esL
es_matrix
fluxes
fluxes_dependent
fluxes_independent
kmatrix
lmatrix
nmatrix
num_ind_fluxes
num_ind_species
scaled_k
scaled_k0
scaled_l
scaled_l0
species
species_dependent
species_independent
subs_fluxes

Methods

do_symca

load_session

path_to

save_results

save_session

do_symca(internal_fixed=None, auto_save_load=False)[source]
property ematrix
property esL
property es_matrix
property fluxes
property fluxes_dependent
property fluxes_independent
property kmatrix
property lmatrix
load_session(file_name=None)[source]
property nmatrix
property num_ind_fluxes
property num_ind_species
path_to(path)[source]
save_results(file_name=None, separator=',', fmt='%.9f')[source]
save_session(file_name=None)[source]
property scaled_k
property scaled_k0
property scaled_l
property scaled_l0
property species
property species_dependent
property species_independent
property subs_fluxes

psctb.analyse._symca.ccobjects module

class psctb.analyse._symca.ccobjects.CCBase(mod, name, expression, ltxe)[source]

Bases: object

The base object for the control coefficients and control patterns

Attributes
latex_expression
latex_name
value

The value property.

property latex_expression
property latex_name
property value

The value property. Calls self._calc_value() when self._value is None and returns self._value

class psctb.analyse._symca.ccobjects.CCoef(mod, name, expression, denominator, ltxe)[source]

Bases: psctb.analyse._symca.ccobjects.CCBase

The object the stores control coefficients. Inherits from CCBase

Attributes
abs_value
latex_expression
latex_expression_full
latex_name
latex_numerator
value

The value property.

Methods

do_par_scan

highlight_patterns

property abs_value
do_par_scan(parameter, scan_range, scan_type='percentage', init_return=True, par_scan=False, par_engine='multiproc', force_legacy=False)[source]
highlight_patterns(width=None, height=None, show_dummy_sinks=False, show_external_modifier_links=False, pos_dic=None)[source]
property latex_expression
property latex_expression_full
property latex_name
property latex_numerator
class psctb.analyse._symca.ccobjects.CPattern(mod, name, expression, denominator, parent, ltxe)[source]

Bases: psctb.analyse._symca.ccobjects.CCBase

docstring for CPattern

Attributes
latex_expression
latex_expression_full
latex_name
latex_numerator
percentage
value

The value property.

property latex_expression
property latex_expression_full
property latex_name
property latex_numerator
property percentage
psctb.analyse._symca.ccobjects.cctype(obj)[source]
psctb.analyse._symca.ccobjects.get_state(mod, do_state=False)[source]

psctb.analyse._symca.symca_toolbox module

class psctb.analyse._symca.symca_toolbox.SymcaToolBox[source]

Bases: object

The class with the functions used to populate SymcaData. The project is structured in this way to abstract the ‘work’ needed to build the various matrices away from the SymcaData class.

Methods

adjugate_matrix(matrix)

Returns the adjugate matrix which is the transpose of the cofactor matrix.

build_cc_matrix(j, jind, sind, jdep, sdep)

Produces the matrices j_cci, j_ccd, s_cci and s_ccd which holds the symbols for the independent and dependent flux control coefficients and the independent and dependent species control coefficients respectively

det_bareis(matrix)

Adapted from original det_bareis function in Sympy 0.7.3.

get_es_matrix(mod, nmatrix, fluxes, species)

Gets the esmatrix.

get_es_matrix_no_mca(mod, nmatrix, fluxes, ...)

Gets the esmatrix.

get_fluxes_vector(mod)

Gets the dependent and independent fluxes (in the correct order)

get_nmatrix(mod)

Returns a sympy matrix made from the N matrix in a Pysces model where the elements are in the same order as they appear in the k and l matrices in pysces.

get_species_vector(mod)

Returns a vector (sympy matrix) with the species in the correct order

invert(matrix, path_to)

Returns the numerators of the inverted martix separately from the common denominator (the determinant of the matrix)

maxima_factor(expression, path_to)

This function is equivalent to the sympy.cancel() function but uses maxima instead

scale_matrix(all_elements, mat, inds)

Scales the k or l matrix.

simplify_matrix(matrix)

Replaces floats with ints and puts elements with fractions on a single demoninator.

solve_dep(cc_i_num, scaledk0, scaledl0, ...)

Calculates the dependent control matrices from the independent control matrix CC_i_solution

substitute_fluxes(all_fluxes, kmatrix)

Substitutes equivalent fluxes in the kmatrix (e.i.

build_inner_dict

build_outer_dict

fix_expressions

generic_populate

get_fix_denom

get_fix_denom_jannie

get_num_ind_fluxes

get_num_ind_species

make_CC_dot_dict

make_inner_dict

make_internals_dict

populate_with_fake_elasticities

populate_with_fake_fluxes

populate_with_fake_ss_concentrations

spawn_cc_objects

static adjugate_matrix(matrix)[source]

Returns the adjugate matrix which is the transpose of the cofactor matrix.

Contains code adapted from sympy. Specifically:

cofactorMatrix() minorEntry() minorMatrix() cofactor()

static build_cc_matrix(j, jind, sind, jdep, sdep)[source]

Produces the matrices j_cci, j_ccd, s_cci and s_ccd which holds the symbols for the independent and dependent flux control coefficients and the independent and dependent species control coefficients respectively

static build_inner_dict(cc_object)[source]
static build_outer_dict(symca_object)[source]
static det_bareis(matrix)[source]

Adapted from original det_bareis function in Sympy 0.7.3. cancel() and expand() are removed from function to speed up calculations. Maxima will be used to simplify the result

Original docstring below:

Compute matrix determinant using Bareis’ fraction-free algorithm which is an extension of the well known Gaussian elimination method. This approach is best suited for dense symbolic matrices and will result in a determinant with minimal number of fractions. It means that less term rewriting is needed on resulting formulae.

static fix_expressions(cc_num, common_denom_expr, lmatrix, species_independent, species_dependent)[source]
static generic_populate(mod, function, value=1)[source]
static get_es_matrix(mod, nmatrix, fluxes, species)[source]

Gets the esmatrix.

Goes down the columns of the nmatrix (which holds the fluxes) to get the rows of the esmatrix.

Nested loop goes down the rows of the nmatrix (which holds the species) to get the columns of the esmatrix

so the format is

ecReationN0_M0 ecReationN0_M1 ecReationN0_M2 ecReationN1_M0 ecReationN1_M1 ecReationN1_M2 ecReationN2_M0 ecReationN2_M1 ecReationN2_M2

static get_es_matrix_no_mca(mod, nmatrix, fluxes, species)[source]

Gets the esmatrix.

Goes down the columns of the nmatrix (which holds the fluxes) to get the rows of the esmatrix.

Nested loop goes down the rows of the nmatrix (which holds the species) to get the columns of the esmatrix

so the format is

ecReationN0_M0 ecReationN0_M1 ecReationN0_M2 ecReationN1_M0 ecReationN1_M1 ecReationN1_M2 ecReationN2_M0 ecReationN2_M1 ecReationN2_M2

static get_fix_denom(lmatrix, species_independent, species_dependent)[source]
get_fix_denom_jannie(species_independent, species_dependent)[source]
static get_fluxes_vector(mod)[source]

Gets the dependent and independent fluxes (in the correct order)

static get_nmatrix(mod)[source]

Returns a sympy matrix made from the N matrix in a Pysces model where the elements are in the same order as they appear in the k and l matrices in pysces.

We need this to make calculations easier later on.

static get_num_ind_fluxes(mod)[source]
static get_num_ind_species(mod)[source]
static get_species_vector(mod)[source]

Returns a vector (sympy matrix) with the species in the correct order

static invert(matrix, path_to)[source]

Returns the numerators of the inverted martix separately from the common denominator (the determinant of the matrix)

static make_CC_dot_dict(cc_objects)[source]
static make_inner_dict(cc_container, cc_container_name)[source]
static make_internals_dict(cc_sol, cc_names, common_denom_expr, path_to)[source]
static maxima_factor(expression, path_to)[source]

This function is equivalent to the sympy.cancel() function but uses maxima instead

static populate_with_fake_elasticities(mod)[source]
static populate_with_fake_fluxes(mod)[source]
static populate_with_fake_ss_concentrations(mod)[source]
static scale_matrix(all_elements, mat, inds)[source]

Scales the k or l matrix.

The procedure is the same for each matrix:

(D^x)^(-1) * y * D^(x_i)

Inverse diagonal The matrix to be The diagonal of of the x where scaled. i.e. the the independent x x is either the k or l matrix where x is the species or the species or the fluxes fluxes

static simplify_matrix(matrix)[source]

Replaces floats with ints and puts elements with fractions on a single demoninator.

static solve_dep(cc_i_num, scaledk0, scaledl0, num_ind_fluxes, path_to)[source]

Calculates the dependent control matrices from the independent control matrix CC_i_solution

static spawn_cc_objects(mod, cc_names, cc_sol, common_denom_exp, ltxe)[source]
static substitute_fluxes(all_fluxes, kmatrix)[source]

Substitutes equivalent fluxes in the kmatrix (e.i. dependent fluxes with independent fluxes or otherwise equal fluxes)

Module contents