yijuanhu / LOCOM-Archive

A logistic regression model for testing differential abundance in compositional microbiome data
12 stars 2 forks source link

Error in PermutationParallel(freq_table = freq.table.ref, X = X, W_init = rbind(0.5 * : inv(): matrix is singular #2

Open XbiomeAnalysis opened 1 year ago

XbiomeAnalysis commented 1 year ago

Hi, Dr. Hu. I met error when I performed differential analysis by LOCOM. The following is my codes:

The amplicon_ps_genus.RDS dataset is here

library(phyloseq)
library(dplyr)
library(tibble)
library(LOCOM)

amplicon_ps_genus <- readRDS("amplicon_ps_genus.RDS")
sam.table <- sample_data(amplicon_ps_genus) %>%
  data.frame() %>%
  tibble::rownames_to_column("Temp") %>%
  dplyr::filter(SampleType %in% c("gut", "tongue")) %>%
  tibble::column_to_rownames("Temp")

amplicon_ps_genus_v2 <- amplicon_ps_genus
sample_data(amplicon_ps_genus_v2) <- sample_data(sam.table)
otu.table <- otu_table(amplicon_ps_genus_v2) %>%
  data.frame() %>%
  t()

res <- locom(otu.table = otu.table, 
             Y = as.numeric(factor(sam.table$SampleType)) - 1, 
             fdr.nominal = 0.1, 
             seed = 1, 
             n.cores = 1)

and my error was that: matrix is singular

Would you like to figure it out and thank you very much in advance.

YINGTIAN-HU commented 1 year ago

Hi @XbiomeAnalysis,

Thank you very much for pointing out this error. We have now updated the package to versions 1.1. Would it be possible to try the new version?

Best, Yingtian

XbiomeAnalysis commented 1 year ago

Hello, @YINGTIAN-HU . Thanks very much. Sorry to reply so late.

After reinstalling the package of new version, the error was solved.

Thanks again.