ggloor / ALDEx_bioc

ALDEx_bioc is the working directory for updating bioconductor
27 stars 13 forks source link

aldex.corr giving unexpected results #54

Open LunavdL opened 1 year ago

LunavdL commented 1 year ago

Hi,

I have a matrix with read counts for 91 samples per KEGG module. I wanted to calculate the correlation with salinity, which I did as follows:

conditions <- model.matrix(~salinity, metadata)
x <- aldex.clr(reads= t(module_counts), conditions, mc.samples=1000, denom="all", verbose=F)
x.corr.modules <- aldex.corr(x, metadata$salinity)

In the results, I see for example that module M00015 has a Pearson correlation of 0.2924729 and this is significant (Pearson.eBH = 2.896241e-02) If I plot the CLR transformed counts for module M00015 across salinity (ranging from 0-30) however, the correlation looks to be negative rather than positive (if it is significant at all): image

Is there something I am doing wrong?

ggloor commented 1 year ago

this is unexpected. what is the correlation of the plot you show? it could simply be a direction issue I will check the code to see if aldex.corr accepts a mm, but if it did not throw an error that is likely not the problem

LunavdL commented 1 year ago

The Pearson correlation of the plot is -0.2542577, spearman = -0.3036871, and kendall = -0.1935915 (uncorrected for multiple comparisons). Whereas the aldex.corr results give pearson correlation = 0.2925046, spearman rho = 0.2933636, and kendall tau = 0.1961180 (all are significant when BH corrected).