-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functions for correlation matrix, copula indicator and plotting #103
Functions for correlation matrix, copula indicator and plotting #103
Conversation
dingo/utils.py
Outdated
print(positive, "out of", i+1, "copulas were positive correlated based on copula indicator") | ||
print(negative, "out of", i+1, "copulas were negative correlated based on copula indicator") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prints should be requested by the user I think. These numbers could be part of the output as with a label for each copula: "positive" or "negative"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a dictionary of this format that is returned
{'ACONTb_ACONTa': {'pearson': 0.9999999999999996, 'indicator': 700000000.9999999, 'classification': 'positive'},
'ACt2r_ACKr': {'pearson': 1.0, 'indicator': 700000000.9999999, 'classification': 'positive'}}
dingo/utils.py
Outdated
'indicator': indicator, | ||
'classification': "no correlation"} | ||
|
||
print("Completed process of",i+1,"from",corr_indices.shape[0],"copulas") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the prints should ideally requested by the user and be off by default.
I'd use a flag verbose: bool
as an input variable with False
as default value. Then, print any message only if verbose is true.
dingo/preprocess.py
Outdated
self._model.reactions.get_by_id(reaction).bounds = self._reaction_bounds_dict[reaction] | ||
|
||
|
||
print(len(self._removed_reactions), "of the", len(self._initial_reactions), \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plz, see my comment below for the printed messages.
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.