test_matrix
¶
Tests for matrix properties performed on an instance of cobra.Model
.
Module Contents¶

test_matrix.
test_absolute_extreme_coefficient_ratio
(model, threshold=1000000000.0)[source]¶ Show the ratio of the absolute largest and smallest nonzero coefficients.
This test will return the absolute largest and smallest, nonzero coefficients of the stoichiometric matrix. A large ratio of these values may point to potential numerical issues when trying to solve different mathematical optimization problems such as fluxbalance analysis.
To pass this test the ratio should not exceed 10^9. This threshold has been selected based on experience, and is likely to be adapted when more data on solver performance becomes available.
Implementation: Compose the stoichiometric matrix, then calculate absolute coefficients and lastly use the maximal value and minimal nonzero value to calculate the ratio.

test_matrix.
test_number_independent_conservation_relations
(model)[source]¶ Show the number of independent conservation relations in the model.
This test will return the number of conservation relations, i.e., conservation pools through the left null space of the stoichiometric matrix. This test is not scored, as the dimension of the left null space is systemspecific.
Implementation: Calculate the left null space, i.e., the null space of the transposed stoichiometric matrix, using an algorithm based on the singular value decomposition adapted from https://scipy.github.io/oldwiki/pages/Cookbook/RankNullspace.html Then, return the estimated dimension of that null space.

test_matrix.
test_matrix_rank
(model)[source]¶ Show the rank of the stoichiometric matrix.
The rank of the stoichiometric matrix is system specific. It is calculated using singular value decomposition (SVD).
Implementation: Compose the stoichiometric matrix, then estimate the rank, i.e. the dimension of the column space, of a matrix. The algorithm used by this function is based on the singular value decomposition of the matrix.

test_matrix.
test_degrees_of_freedom
(model)[source]¶ Show the degrees of freedom of the stoichiometric matrix.
The degrees of freedom of the stoichiometric matrix, i.e., the number of ‘free variables’ is system specific and corresponds to the dimension of the (right) null space of the matrix.
Implementation: Compose the stoichiometric matrix, then calculate the dimensionality of the null space using the ranknullity theorem outlined by Alama, J. The Rank+Nullity Theorem. Formalized Mathematics 15, (2007).