FrederickHuangLin / ANCOMBC

Differential abundance (DA) and correlation analyses for microbial absolute abundance data
https://www.nature.com/articles/s41467-020-17041-7
108 stars 29 forks source link

Beginner encountering error with secom_linear() : Error in DescTools::Winsorize(x, probs = wins_quant, na.rm = TRUE) : unused arguments (probs = wins_quant, na.rm = TRUE) #278

Closed millermorganOSU closed 1 month ago

millermorganOSU commented 3 months ago

Hello all. I am working on my first microbiome analysis and I am interested in using SECOM to estimate taxa-taxa correlation (and hopefully taxa-host-phenotype correlation at some point although I don't know if that is possible with SECOM).

Originally I tried running secom_linear() on my phyloseq object in R 4.3.0. I got the error:

Error in DescTools::Winsorize(x, probs = wins_quant, na.rm = TRUE) : unused arguments (probs = wins_quant, na.rm = TRUE)

I assumed that my R and package versions were out of date, so I updated R to 4.4.1. Unfortunately this did not fix the problem.

Has anyone else encountered this? Does anyone have any ideas for a potential solution? Below is a modified example from the documentation.

# load library
library(ANCOMBC)

# grab data and covert to TSE
data(dietswap, package = "microbiome")
tse <- mia::makeTreeSummarizedExperimentFromPhyloseq(dietswap)
tse <- tse[, tse$timepoint == 1]

# set seed
set.seed(123)

# package and R versions
packageVersion('ANCOMBC') # 2.6.0
packageVersion('DescTools') # 0.99.55
packageVersion('BiocManager') # 1.30.23
R.version.string # R version 4.4.1 Patched (2024-08-05 r86980)

# Error in DescTools::Winsorize(x, probs = wins_quant, na.rm = TRUE) : unused arguments (probs = wins_quant, na.rm = TRUE)
res_linear <- secom_linear(data = list(tse), assay_name = "counts",
                          tax_level = "Phylum", pseudo = 0,
                          prv_cut = 0.5, lib_cut = 1000, corr_cut = 0.5,
                          wins_quant = c(0.05, 0.95), method = "pearson",
                          soft = FALSE, thresh_len = 20, n_cv = 10,
                          thresh_hard = 0.3, max_p = 0.005, n_cl = 2)
zclaas commented 2 months ago

I'm encountering the same error. I think the issue is that sparse_linear and sparse_dist call DescTools::Winsorize as though probs and na.rm are arguments of the function, where they actually seem to be arguments of quantile. Specifically, this line: DescTools::Winsorize(x, probs = wins_quant, na.rm = TRUE) Should probably be: DescTools::Winsorize(x, val = quantile(x, probs = wins_quant, na.rm = TRUE))