Skip to content
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

Differences in pvalues in MONSTER #335

Open
violafanfani opened this issue Nov 14, 2024 · 11 comments
Open

Differences in pvalues in MONSTER #335

violafanfani opened this issue Nov 14, 2024 · 11 comments
Assignees

Comments

@violafanfani
Copy link

violafanfani commented Nov 14, 2024

I am trying to measure the pvalues for each TF and I started using the "monsterCalculateTmPValues".
However, after getting some confusing results I checked the code in the function and compared it to the one inside "monsterdTFIPlot" and they differ at least here:
ssodm <- apply(res@tm,2,function(x){t(x)%*%x})
ssodm <- apply(res@tm,1,function(x){t(x)%*%x})

ssodm <- apply(monsterObj@tm,1,function(x){t(x)%*%x})

Which one is correct? Can you check if this is a mistake or a desired function?

@violafanfani violafanfani changed the title Differences in pvalues Differences in pvalues in MONSTER Nov 14, 2024
@marouenbg marouenbg self-assigned this Nov 17, 2024
@marouenbg
Copy link
Collaborator

marouenbg commented Nov 17, 2024

Hey @violafanfani cc @taraeicher ,

They're the same because transition matrices are symmetrical.

Marouen

@marouenbg
Copy link
Collaborator

I take that back monsterdTFIPlot is the correct one!

@marouenbg
Copy link
Collaborator

marouenbg commented Nov 17, 2024

Good catch Viola! Can you please PR these 2 lines?

apply(x,1,function(y){t(y)%*%y})

ssodm <- apply(monsterObj@tm,1,function(x){t(x)%*%x})

@marouenbg
Copy link
Collaborator

But I am expecting the results to be only very slightly different because the statistic measures deviation from the identity matrix. So for a given matrix, comparing the columns to those of a null or the rows to the rows of the same null matrix are similar statistics. I am thinking they might be equal even but for consistency, let's change it.

@violafanfani
Copy link
Author

violafanfani commented Nov 17, 2024

I am not super familiar, so I can only tell you what I observed. The results are heavily different, which is something we can also expect by looking at figure 2 in the paper (https://pubmed.ncbi.nlm.nih.gov/29237467/#&gid=article-figures&pid=fig-2-uid-1). You can see that the TM is behaving different on the columns and the rows, TM are not symmetrical (at all).

@marouenbg
Copy link
Collaborator

@violafanfani Yes, I took back my comment about symmetry. Can you post some p-values for TFs with each function?

@marouenbg
Copy link
Collaborator

It is not just the values of rows vs columns, the functions also compares rows or columns to a null distribution of rows or columns.
As you can see below, the null is also sampled across rows or columns, that's why I am not expecting a strong difference (aka a nonsignificant TF becomes significant)

apply(x,2,function(y){t(y)%*%y})

apply(x,1,function(y){t(y)%*%y})

@violafanfani
Copy link
Author

From my experiment on yeast cell cycle test data, it is very (very) different. I get as significant TFs that are in the middle of the dTFI plot

@marouenbg
Copy link
Collaborator

Can you post them heree?

@violafanfani
Copy link
Author

I am uploading the dTFI figure with the TF significant at pval<0.05, old: is the code on netzoor to compute pvalues, whole the other file is the one where I use the pvals computed as in the dTFI figure. In the logs there I also print the first 10 pvals in the two cases,

Old (monsterCalculateTmPValues(res, method = 'z-score')):
pval
RCS1 2.339182e-01
RLR1 1.245712e-04
SIG1 1.776618e-05
YBL005W 4.750487e-02
YBL021C 1.000000e+00
YBL103C 9.997405e-01
YBR049C 8.400741e-01
YBR083W 3.208280e-03
YBR182C 4.997253e-01
YBR240C 4.766604e-03

Correct (monsterCalculateTmPValues(res, method = 'z-score') with axis =2):
pval
RCS1 0.7948747
RLR1 0.7697828
SIG1 0.7697748
YBL005W 0.4145877
YBL021C 0.2524840
YBL103C 0.5372631
YBR049C 0.6533847
YBR083W 0.4694112
YBR182C 0.2339759
YBR240C 0.6460631

old_monster_figure.pdf
monster_figure.pdf
old_my_log.txt
my_log.txt

@marouenbg
Copy link
Collaborator

Wow this is really different! Thanks for finding this 👍 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants