Functions for correlation matrix, copula indicator and plotting #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Aim of this PR is:
PreProcess
class.The
correlated_reactions
function that calculates a pearson correlation matrix from reactions steady states is appended to the scriptdingo/utils.py
Correlations that do not make the pearson cutoff are replaced with 0. For pairwise reactions with a greater pearson coefficient than the cutoff, a copula indicator is computed to filter false-positive correlations. Parameters of this function can adjust the width of the copula's diagonal for the calculation of the indicator and return only the lower triangle of the symmetric matrix. Cutoffs for pearson and indicator filtering can be adjusted from the user too.The
plot_corr_matrix
function that creates a heatmap plot of a correlation matrix is appended to the scriptdingo/illustrations.py
Parameters of this function can specify the format of the saved image plot and place as labels only the remained reactions for reduced models.The
reduce
function of thePreProcess
class for theextend
parameter set toTrue
has also changed to identify additional reactions for removal in bigger models. It uses the newcorrelated_reactions
function to calculate a correlation matrix and order reactions based on their sum of absolute correlations with other reactions. Reactions with smaller values of overall correlation are removed first. The removal stops in the first reaction that alters the value of the objective function.A
correlation.py
unittest is also created in thetests
directory and thepreprocess.py
unittest is updated too.