Shians / Glimma

Glimma R package
GNU Lesser General Public License v3.0
50 stars 10 forks source link

Values are rounded incorrectly #175

Open sam-israel opened 5 years ago

sam-israel commented 5 years ago

Some values are incorrectly rounded. It seems that this happens when the value is high, and it has a decimal point.


# install.packages("devtools")
# devtools::install_github("shians/Glimma")

library(Glimma)

DE <- as.data.frame(cbind(202197.7, -1.410116), byrow=T)

colnames(DE) <- c("baseMean", "log2FoldChange")
DE$sig <- 1

glMDPlot(x=DE, xval="baseMean", yval="log2FoldChange", counts=NULL,
         anno=NULL,samples=NULL, group = NULL, status=DE$sig, 
         side.main = "baseMean",html="One_Gene_from_vector_final",
         display.columns = c("baseMean","log2FoldChange"))

Produces the following graph, where the value of baseMean is 202200.

image

While rounding to the to zero decimal places (that would give 202198) would have been reasonable, rounding to the closest power of ten is not practised widely

R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C          
 [3] LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8    
 [5] LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C             
 [9] LC_ADDRESS=C           LC_TELEPHONE=C        
[11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

other attached packages:
[1] Glimma_1.9.4

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2        rstudioapi_0.10   edgeR_3.26.7     
 [4] magrittr_1.5      usethis_1.5.1     devtools_2.1.0   
 [7] pkgload_1.0.2     lattice_0.20-38   R6_2.4.0         
[10] rlang_0.4.0       tools_3.6.0       grid_3.6.0       
[13] pkgbuild_1.0.4    sessioninfo_1.1.1 cli_1.1.0        
[16] withr_2.1.2       remotes_2.1.0     assertthat_0.2.1 
[19] digest_0.6.20     rprojroot_1.3-2   crayon_1.3.4     
[22] processx_3.4.1    callr_3.3.1       fs_1.3.1         
[25] ps_1.3.0          curl_4.0          testthat_2.2.1   
[28] memoise_1.1.0     glue_1.3.1        limma_3.40.6     
[31] compiler_3.6.0    desc_1.2.0        backports_1.1.4  
[34] prettyunits_1.0.2 locfit_1.5-9.1    jsonlite_1.6     

The current BioConductor version of Glimma (which I use most of the time) has this problem as well; not just the development version.