yiluheihei / microbiomeMarker

R package for microbiome biomarker discovery
https://yiluheihei.github.io/microbiomeMarker
GNU General Public License v3.0
170 stars 40 forks source link

Error in run_test_multiple_groups function #96

Open W-xyue opened 1 year ago

W-xyue commented 1 year ago

Hi, thank you for providing us with a nice package.

I found an issue when running the run_test_multiple_groups() function on my data. The detailed code is posted below:

library(phyloseq)
library(microbiomeMarker)
ps <- import_picrust2("EC.abundance.xls", sam_tab="metadata.xls", trait="EC")
sample_data(ps)$group <- factor(sample_data(ps)$group, levels=unique(sample_data(ps)$group))
head(otu_table(ps))
#OTU Table:          [6 taxa and 9 samples]
#                     taxa are rows
#                  sa1      sa2      sa3      sa4      sa5      sa6      sa7
#EC:1.1.1.1   23215.29 22988.92 22831.58 27713.01 29019.83 28518.08 34853.03
#EC:1.1.1.100 23644.14 24475.45 24735.78 15840.55 15553.21 16932.30 16116.44
#EC:1.1.1.103  2938.16  3020.32  3065.17   726.75   548.03   953.46    21.92
#EC:1.1.1.108     2.00     6.00    20.00     1.00     0.00     3.00     0.00
#EC:1.1.1.11   2505.00  2538.51  2529.27   583.11   442.94   757.84    12.25
#EC:1.1.1.122   430.39   390.12   574.65    56.17    44.67    88.67     1.33
#                  sa8      sa9
#EC:1.1.1.1   34307.45 34425.01
#EC:1.1.1.100 16597.36 16498.08
#EC:1.1.1.103    25.50    39.89
#EC:1.1.1.108     0.00     0.00
#EC:1.1.1.11     21.25    28.00
#EC:1.1.1.122     1.67     1.67

sample_data(ps)
#Sample Data:        [9 samples by 2 sample variables]:
#    sample.id group
#sa1     CK1.1   CK1
#sa2     CK1.2   CK1
#sa3     CK1.3   CK1
#sa4     CK7.1   CK7
#sa5     CK7.2   CK7
#sa6     CK7.3   CK7
#sa7    CK60.1  CK60
#sa8    CK60.2  CK60
#sa9    CK60.3  CK60

head(tax_table(ps))
#Taxonomy Table:     [6 taxa by 2 taxonomic ranks]:
#             Picrust_trait  Picrust_description                         
#EC:1.1.1.1   "EC:1.1.1.1"   "Alcohol dehydrogenase"                     
#EC:1.1.1.100 "EC:1.1.1.100" "3-oxoacyl-[acyl-carrier-protein] reductase"
#EC:1.1.1.103 "EC:1.1.1.103" "L-threonine 3-dehydrogenase"               
#EC:1.1.1.108 "EC:1.1.1.108" "Carnitine 3-dehydrogenase"                 
#EC:1.1.1.11  "EC:1.1.1.11"  "D-arabinitol 4-dehydrogenase"              
#EC:1.1.1.122 "EC:1.1.1.122" "D-threo-aldose 1-dehydrogenase"   

res <- run_test_multiple_groups(
             ps = ps, norm = "TSS",
             method = "anova",
             p_adjust = "fdr",
             group = "group",
             taxa_rank = "none",
             pvalue_cutoff = 1
         )

then I got the following error:

Error in `purrr::map()`:
ℹ In index: 1.
Caused by error in `str2lang()`:
! <text>:1:7: unexpected numeric constant
1: EC:1.1.1
          ^
Run `rlang::last_error()` to see where the error occurred.

how is it possible to correct the error? thank you for your help.