hasaru-k / GlimmaV2

interactive plots for differential expression analysis
GNU Lesser General Public License v3.0
25 stars 8 forks source link

"all.equal(counts, round(counts))" causes errors in GlimmaMA (or GlimmaXY) #65

Closed yejilee-biostat closed 3 years ago

yejilee-biostat commented 3 years ago

Hello,

After installing the development version of GlimmaV2 here, I tried to use "GlimmaMA" using DGEexact and DGEList objects generated from edgeR packages. However, It gave me the following error message :

Error in !all.equal(counts, round(counts)) : invalid argument type Calls: <Anonymous> ... eval -> <Anonymous> -> glimmaMA.DGEExact -> buildXYData

I took a "counts" matrix from DGEList and ran all.equal(counts, round(counts)) separately, which returned this value :

[1] "Mean relative difference: 0.0001543401"

Then I checked "GlimmaV2/glimmaXY.R", and it seems the error message I got is due to line 113 in the R code. Line 113 of glimmaXY.R is

if (!all.equal(counts, round(counts))) {

and since the outcome of all.equal is not logical, it will naturally be failed.

The document of all.equal also says "Do not use all.equal directly in if expressions---either use isTRUE(all.equal(....)) or identical if appropriate.", so I think it is possibly a bug in the developmental version.

Would it be possible for you to fix this? Or If I miss something, could you help me on solving this issue? Thanks a lot!

Best, Yeji

hasaru-k commented 3 years ago

hi Yeji,

Thanks for looking into this! I've updated the usage to isTRUE(all.equal(...)) as you suggested in the master branch, so it will be available if you reinstall from github :)

To give you some background on the error itself, the all.equal() check is trying to ascertain whether or not your counts matrix has already been transformed in some way (ie. by seeing if it consists entirely of integers, hence the rounding). If the matrix has already been transformed in some way, we throw an error and suggest you pass in transform.counts="none" into your glimmaMA()call to prevent glimma's default behaviour of log-cpm transforming the counts matrix. This is to avoid silently transforming counts a second time.

Hope this helps!

yejilee-biostat commented 3 years ago

Thanks for your kind reply :) !!