cobamp.nullspace package¶
Submodules¶
cobamp.nullspace.nullspace module¶
cobamp.nullspace.subset_reduction module¶
Inspired by Metatool’s code
-
class
cobamp.nullspace.subset_reduction.
SubsetReducer
[source]¶ Bases:
cobamp.core.transformer.ModelTransformer
-
ABSOLUTE_BOUNDS
= 'SUBSET_REDUCER-ABSOLUTE_BOUNDS'¶
-
TO_BLOCK
= 'SUBSET_REDUCER-TO_BLOCK'¶
-
TO_KEEP_SINGLE
= 'SUBSET_REDUCER-TO_KEEP_SINGLE'¶
-
-
class
cobamp.nullspace.subset_reduction.
SubsetReducerProperties
(keep=None, block=None, absolute_bounds=False, reaction_id_sep='_+_')[source]¶ Bases:
cobamp.utilities.property_management.PropertyDictionary
-
cobamp.nullspace.subset_reduction.
reduce
(S, sub, irrev_reduced=None)[source]¶ Reduces a stoichiometric matrix according to the subset information present in the sub matrix and irrev_reduced.
Parameters
S: Stoichiometric matrix
sub: Subset matrix as computed by <subset_correlation_matrix>
irrev_reduced: Irreversibility vector regarding the subsets.
Returns reduced, reduced_indexes, irrev_reduced
-
cobamp.nullspace.subset_reduction.
subset_candidates
(kernel, tol=None)[source]¶ Computes a matrix of subset candidates from the nullspace of the S matrix
Parameters
kernel: Nullspace of the S matrix
tol: Tolerance to 0.
-
cobamp.nullspace.subset_reduction.
subset_correlation_matrix
(S, kernel, irrev, cr, keepSingle=None)[source]¶ S: Stoichiometric matrix as ndarray
kernel: The nullspace of S
irrev: List of booleans representing irreversible reactions (when True)
cr: The subset candidate matrix, computed using <subset_candidates>
keepSingle: List of reaction indices that will not be compressed.
Returns sub, irrev_sub, irrev_violating_subsets
sub : subset matrix, n-subsets by n-reactions -> numpy.array
irrev_sub : subset reversibilities -> numpy.array of type bool
irrev_violating_subsets : same as sub, but list if empty. Contains subsets discarded due to irreversibility faults
-
cobamp.nullspace.subset_reduction.
subset_reduction
(S, irrev, to_remove=[], to_keep_single=[])[source]¶ Reduces a stoichiometric matrix using nullspace analysis by identifying linearly dependent (enzyme) subsets. These reactions are then compressed.
S: Stoichiometric matrix as an ndarray.
irrev: A boolean array with size equal to the number of columns in the S matrix.
to_remove: A list of indices specifying columns of the S matrix to remove before the compression (usually blocked reactions)
to_keep_single: A list of indices specifying columns of the S matrix not to compress.
Returns rd, sub, irrev_reduced, rdind, irrv_subsets, kept_reactions, kernel, correlation_matrix
rd : compressed stoichiometric matrix -> numpy.array
sub : subset matrix, n-subsets by n-reactions -> numpy.array
irrev_reduced : subset reversibilities -> numpy.array of type bool
rdind : metabolite indices -> numpy.array of type int
irrv_subsets : same as sub, but list if empty
kept_reactions : indexes for reactions used in the network compression
kernel : numpy.array with the right nullspace of S
correlation_matrix : numpy.array with reaction correlation matrix