microeco icon indicating copy to clipboard operation
microeco copied to clipboard

trans_diff with lefse method returns Negative numbers of LDA

Open Irisescat opened this issue 1 year ago • 3 comments

Hi Chi,

I have an issue with the LDA value of the trans_diff with lefse method. negativeLDA

I used following scripts

library(microeco)
library(r2excel)
t1 <- readRDS("meco_t1.RDS")
lefse_diff <- trans_diff$new(dataset = t1, method = "lefse", group = "Group", p_adjust_method = "none")
xlsx.writeFile(lefse_diff$res_diff,sheetName = "LEfSe_result","LEfSe_result.xlsx",row.names = F)

I try to figure out, and test with trans_diff source code. It seems like this step %>% abs doesn't work well. https://github.com/ChiLiubio/microeco/blob/094994c42dbb251773f0fb67251eb013c5757e29/R/trans_diff.R#L457C9-L457C46

Thanks, Sonia

meco_t1.zip

R version 4.2.0 (2022-04-22)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /home/sonia/miniconda3/envs/r_4.2.0/lib/libopenblasp-r0.3.21.so

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

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

other attached packages:
[1] r2excel_1.0.0   xlsx_0.6.5      microeco_0.19.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10        pillar_1.9.0       compiler_4.2.0     RColorBrewer_1.1-3
 [5] plyr_1.8.8         tools_4.2.0        digest_0.6.31      lifecycle_1.0.3
 [9] tibble_3.2.1       nlme_3.1-162       gtable_0.3.3       lattice_0.21-8
[13] mgcv_1.8-42        pkgconfig_2.0.3    rlang_1.1.1        Matrix_1.5-4.1
[17] igraph_1.4.3       cli_3.6.1          parallel_4.2.0     rJava_1.0-6
[21] stringr_1.5.0      dplyr_1.1.2        cluster_2.1.4      xlsxjars_0.6.1
[25] generics_0.1.3     vctrs_0.6.2        grid_4.2.0         tidyselect_1.2.0
[29] glue_1.6.2         data.table_1.14.8  R6_2.5.1           fansi_1.0.4
[33] ggplot2_3.4.2      reshape2_1.4.4     magrittr_2.0.3     scales_1.2.1
[37] MASS_7.3-60        splines_4.2.0      permute_0.9-7      ape_5.7-1
[41] colorspace_2.1-0   utf8_1.2.3         stringi_1.7.6      munsell_0.5.0
[45] vegan_2.6-4

Irisescat avatar Jun 27 '23 06:06 Irisescat

Hi Sonia,

Thanks very much! It is a bug! The negative values may occure when the abs fail to work. I should not use pipe operator here as it is a simple expression. I have updated the package in github. The formal version v0.20.0 will be released in CRAN in the next days. Thanks again for your finding!

Best regards, Chi

ChiLiubio avatar Jun 27 '23 09:06 ChiLiubio

Dear Chi,

I still got negative value when using version v1.0.0, do you think I should switch back to v0.20.0 ?

finally-jay avatar Aug 02 '23 14:08 finally-jay

Hi. Do you mean it is fine with v0.20.0, but negative value occures in v1.0.0?

ChiLiubio avatar Aug 03 '23 05:08 ChiLiubio