Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encounter errors in diff_analysis #40

Closed
Turbinenoli opened this issue Jan 13, 2022 · 6 comments
Closed

Encounter errors in diff_analysis #40

Turbinenoli opened this issue Jan 13, 2022 · 6 comments

Comments

@Turbinenoli
Copy link

Turbinenoli commented Jan 13, 2022

Hello all

First of all, I really appreciate this package and so far I like it a lot, thank you for your work. It's my first try to get an issue solved via the github community and I will try my best to make it reproducible. It think my issue is similar to this closed issue here -> #Error in seq_len(ncol(taxdf)) : argument must be coercible to non-negative integer #13

My issue: I'd like to make a diff_analysis and later process it to ggdiffclade but fail to produce the object "deres <- diff_analysis(......). The code works just fine when using the provided example data. However, my command stops with following error message:

deres_dud <- diff_analysis(obj = lime_dud, classgroup = "plot", #this is my ps object and relevant factors

  •                    mlfun = "lda",
    
  •                    filtermod = "pvalue",
    
  •                    firstcomfun = "kruskal_test",
    
  •                    firstalpha = 0.05,
    
  •                    strictmod = TRUE,
    
  •                    secondcomfun = "wilcox_test",
    
  •                    subclmin = 3,
    
  •                    subclwilc = TRUE,
    
  •                    secondalpha = 0.01,
    
  •                    lda=3)
    

Error in seq_len(ncol(taxdf)) :
argument must be coercible to non-negative integer
In addition: Warning message:
In seq_len(ncol(taxdf)) : first element used of 'length.out' argument

My assumption is, that the code can not handle certain structures within my data, more precisely the tax_table within my phyloseq object, as unassigned taxa get the entry e.g "g__" instead of "g__Gaiella".

My ps object consists of an otu_table(), tax_table() and sample_data() and looks like this:

lime_dud
phyloseq-class experiment-level object
otu_table() OTU Table: [ 28139 taxa and 27 samples ]
sample_data() Sample Data: [ 27 samples by 5 sample variables ]
tax_table() Taxonomy Table: [ 28139 taxa by 6 taxonomic ranks ]

head(otu_table(lime_dud))[,1:5]
OTU Table: [5 taxa and 6 samples]
taxa are columns
ASV1 ASV2 ASV3 ASV4 ASV5
D1-1 351 133 300 272 139
D1-2 361 205 339 215 179
D1-3 414 236 418 268 245
D1-4 385 210 441 272 295
D1-5 324 165 355 242 196
D1-6 359 179 378 293 185

head(tax_table(lime_dud))[1:5,]
Taxonomy Table: [5 taxa by 6 taxonomic ranks]:
Kingdom Phylum Class Order Family Genus
ASV1 "k__Bacteria" "p__Proteobacteria" "c__Alphaproteobacteria" "o__Rhizobiales" "f__Xanthobacteraceae" "g__"
ASV2 "k__Bacteria" "p__Proteobacteria" "c__Alphaproteobacteria" "o__Rhizobiales" "f__Methyloligellaceae" "g__"
ASV3 "k__Bacteria" "p__Proteobacteria" "c__Alphaproteobacteria" "o__Rhizobiales" "f__Methyloligellaceae" "g__"
ASV4 "k__Bacteria" "p__Nitrospirota" "c__Nitrospiria" "o__Nitrospirales" "f__Nitrospiraceae" "g__Nitrospira"
ASV5 "k__Bacteria" "p__Proteobacteria" "c__Alphaproteobacteria" "o__Rhizobiales" "f__Xanthobacteraceae" "g__Bradyrhizobium"

head(sample_data(lime_dud))[1:6,1:5]
Sample Data: [6 samples by 5 sample variables]:
sample_ID location plot run ph
D1-1 D1BCS1 Düdingen BCS 1 6.0
D1-2 D1BCS2 Düdingen BCS 1 5.9
D1-3 D1BCS3 Düdingen BCS 1 5.8
D1-4 D1BBD1 Düdingen BBD 1 5.9
D1-5 D1BBD2 Düdingen BBD 1 5.9
D1-6 D1BBD3 Düdingen BBD 1 5.9

I tried several work-arounds such as converting my ps object to MPSE via the as.MPSE() command but keep getting the same error message:

mpse_dud <- lime_dud %>% as.MPSE()
Error in seq_len(ncol(taxdf)) :
argument must be coercible to non-negative integer
In addition: Warning message:
In seq_len(ncol(taxdf)) : first element used of 'length.out' argument

Any help is certainly appreciated, if the example lacks sufficient information to reproduce or understand my issue I am glad to provide further infos. Thanks in advance and best regards

@xiangpin
Copy link
Member

The example does lack sufficient information, I cannot reproduce your issue. But I can build an MPSE class with the provided information (See the following). Would you mind sending me the dataset by email? I will not distribute this data without your permission. My email is xshuangbin@163.com

> library(MicrobiotaProcess) 
> otutab <- read.table("./otu_tab.txt", header = T, row.names = 1)
> otutab
     ASV1 ASV2 ASV3 ASV4 ASV5
D1-1  351  133  300  272  139
D1-2  361  205  339  215  179
D1-3  414  236  418  268  245
D1-4  385  210  441  272  295
D1-5  324  165  355  242  196
D1-6  359  179  378  293  185
> taxatab <- read.table("./taxa_tab.txt", header = T, row.names = 1) 
> taxatab
         Kingdom            Phylum                  Class            Order
ASV1 k__Bacteria p__Proteobacteria c__Alphaproteobacteria   o__Rhizobiales
ASV2 k__Bacteria p__Proteobacteria c__Alphaproteobacteria   o__Rhizobiales
ASV3 k__Bacteria p__Proteobacteria c__Alphaproteobacteria   o__Rhizobiales
ASV4 k__Bacteria   p__Nitrospirota         c__Nitrospiria o__Nitrospirales
ASV5 k__Bacteria p__Proteobacteria c__Alphaproteobacteria   o__Rhizobiales
                    Family             Genus
ASV1  f__Xanthobacteraceae               g__
ASV2 f__Methyloligellaceae               g__
ASV3 f__Methyloligellaceae               g__
ASV4     f__Nitrospiraceae     g__Nitrospira
ASV5  f__Xanthobacteraceae g__Bradyrhizobium
> sampleda <- read.table("./sample_tab.txt", header = T, row.names = 1) 
> sampled
     sample_ID location plot run  ph
D1-1    D1BCS1 Düdingen  BCS   1 6.0
D1-2    D1BCS2 Düdingen  BCS   1 5.9
D1-3    D1BCS3 Düdingen  BCS   1 5.8
D1-4    D1BBD1 Düdingen  BBD   1 5.9
D1-5    D1BBD2 Düdingen  BBD   1 5.9
D1-6    D1BBD3 Düdingen  BBD   1 5.9
> mpse <- MPSE(assays=list(Abundance=t(otutab)), colData=sampleda)
> mpse
# A MPSE-tibble (MPSE object) abstraction: 30 × 8
# OTU=5 | Samples=6 | Assays=Abundance | Taxanomy=NULL
   OTU   Sample Abundance sample_ID location plot    run    ph
   <chr> <chr>      <int> <chr>     <chr>    <chr> <int> <dbl>
 1 ASV1  D1-1         351 D1BCS1    Düdingen BCS       1   6
 2 ASV1  D1-2         361 D1BCS2    Düdingen BCS       1   5.9
 3 ASV1  D1-3         414 D1BCS3    Düdingen BCS       1   5.8
 4 ASV2  D1-1         133 D1BCS1    Düdingen BCS       1   6
 5 ASV2  D1-2         205 D1BCS2    Düdingen BCS       1   5.9
 6 ASV2  D1-3         236 D1BCS3    Düdingen BCS       1   5.8
 7 ASV3  D1-1         300 D1BCS1    Düdingen BCS       1   6
 8 ASV3  D1-2         339 D1BCS2    Düdingen BCS       1   5.9
 9 ASV3  D1-3         418 D1BCS3    Düdingen BCS       1   5.8
10 ASV4  D1-1         272 D1BCS1    Düdingen BCS       1   6
# … with 20 more rows
> taxonomy(mpse) <- taxatab
> mpse
# A MPSE-tibble (MPSE object) abstraction: 30 × 14
# OTU=5 | Samples=6 | Assays=Abundance | Taxanomy=Kingdom, Phylum, Class, Order, Family, Genus
   OTU   Sample Abundance sample_ID location plot    run    ph Kingdom  Phylum
   <chr> <chr>      <int> <chr>     <chr>    <chr> <int> <dbl> <chr>    <chr>
 1 ASV1  D1-1         351 D1BCS1    Düdingen BCS       1   6   k__Bact… p__Prot…
 2 ASV1  D1-2         361 D1BCS2    Düdingen BCS       1   5.9 k__Bact… p__Prot…
 3 ASV1  D1-3         414 D1BCS3    Düdingen BCS       1   5.8 k__Bact… p__Prot…
 4 ASV2  D1-1         133 D1BCS1    Düdingen BCS       1   6   k__Bact… p__Prot…
 5 ASV2  D1-2         205 D1BCS2    Düdingen BCS       1   5.9 k__Bact… p__Prot…
 6 ASV2  D1-3         236 D1BCS3    Düdingen BCS       1   5.8 k__Bact… p__Prot…
 7 ASV3  D1-1         300 D1BCS1    Düdingen BCS       1   6   k__Bact… p__Prot…
 8 ASV3  D1-2         339 D1BCS2    Düdingen BCS       1   5.9 k__Bact… p__Prot…
 9 ASV3  D1-3         418 D1BCS3    Düdingen BCS       1   5.8 k__Bact… p__Prot…
10 ASV4  D1-1         272 D1BCS1    Düdingen BCS       1   6   k__Bact… p__Nitr…
# … with 20 more rows, and 4 more variables: Class <chr>, Order <chr>,
#   Family <chr>, Genus <chr>

@xiangpin
Copy link
Member

By the way, the following is my R session information. And the version of MicrobiotaProcess is the newest (1.7.5)

> sessioninfo::session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.1.1 (2021-08-10)
 os       Ubuntu 18.04.4 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Asia/Shanghai
 date     2022-01-13

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package              * version    date       lib source
 ape                    5.6-1      2022-01-07 [1] CRAN (R 4.1.1)
 aplot                  0.1.2      2022-01-10 [1] CRAN (R 4.1.1)
 assertthat             0.2.1      2019-03-21 [1] CRAN (R 4.1.1)
 Biobase                2.54.0     2021-10-26 [1] Bioconductor
 BiocGenerics           0.40.0     2021-10-26 [1] Bioconductor
 BiocManager            1.30.16    2021-06-15 [1] CRAN (R 4.1.1)
 Biostrings             2.62.0     2021-10-26 [1] Bioconductor
 bitops                 1.0-7      2021-04-24 [1] CRAN (R 4.1.1)
 cachem                 1.0.6      2021-08-19 [1] CRAN (R 4.1.1)
 cli                    3.1.0      2021-10-27 [1] CRAN (R 4.1.1)
 cluster                2.1.2      2021-04-17 [1] CRAN (R 4.1.1)
 codetools              0.2-18     2020-11-04 [1] CRAN (R 4.1.1)
 coin                   1.4-2      2021-10-08 [1] CRAN (R 4.1.1)
 colorspace             2.0-2      2021-06-24 [1] CRAN (R 4.1.1)
 conflicted           * 1.0.4      2019-06-21 [1] CRAN (R 4.1.1)
 crayon                 1.4.2      2021-10-29 [1] CRAN (R 4.1.1)
 DBI                    1.1.2      2021-12-20 [1] CRAN (R 4.1.1)
 DelayedArray           0.20.0     2021-10-26 [1] Bioconductor
 dplyr                  1.0.7      2021-06-18 [1] CRAN (R 4.1.1)
 ellipsis               0.3.2      2021-04-29 [1] CRAN (R 4.1.1)
 fansi                  1.0.0      2022-01-10 [1] CRAN (R 4.1.1)
 fastmap                1.1.0      2021-01-25 [1] CRAN (R 4.1.1)
 foreach                1.5.1      2020-10-15 [1] CRAN (R 4.1.1)
 generics               0.1.1      2021-10-25 [1] CRAN (R 4.1.1)
 GenomeInfoDb           1.30.0     2021-10-26 [1] Bioconductor
 GenomeInfoDbData       1.2.7      2021-10-29 [1] Bioconductor
 GenomicRanges          1.46.0     2021-10-26 [1] Bioconductor
 ggfun                  0.0.4      2021-09-17 [1] CRAN (R 4.1.1)
 ggnewscale             0.4.5      2021-01-11 [1] CRAN (R 4.1.1)
 ggplot2                3.3.5      2021-06-25 [1] CRAN (R 4.1.1)
 ggplotify              0.1.0      2021-09-02 [1] CRAN (R 4.1.1)
 ggrepel                0.9.1      2021-01-15 [1] CRAN (R 4.1.1)
 ggsignif               0.6.3      2021-09-09 [1] CRAN (R 4.1.1)
 ggstar                 1.0.3      2021-12-03 [1] CRAN (R 4.1.1)
 ggtree                 3.3.1      2021-12-31 [1] Bioconductor
 ggtreeExtra            1.5.1      2021-11-24 [1] Bioconductor
 glue                   1.6.0      2021-12-17 [1] CRAN (R 4.1.1)
 gridExtra              2.3        2017-09-09 [1] CRAN (R 4.1.1)
 gridGraphics           0.5-1      2020-12-13 [1] CRAN (R 4.1.1)
 gtable                 0.3.0      2019-03-25 [1] CRAN (R 4.1.1)
 IRanges                2.28.0     2021-10-26 [1] Bioconductor
 iterators              1.0.13     2020-10-15 [1] CRAN (R 4.1.1)
 jsonlite               1.7.2      2020-12-09 [1] CRAN (R 4.1.1)
 lattice                0.20-45    2021-09-22 [1] CRAN (R 4.1.1)
 lazyeval               0.2.2      2019-03-15 [1] CRAN (R 4.1.1)
 libcoin                1.0-9      2021-09-27 [1] CRAN (R 4.1.1)
 lifecycle              1.0.1      2021-09-24 [1] CRAN (R 4.1.1)
 magrittr             * 2.0.1      2020-11-17 [1] CRAN (R 4.1.1)
 MASS                   7.3-54     2021-05-03 [1] CRAN (R 4.1.1)
 Matrix                 1.3-4      2021-06-01 [1] CRAN (R 4.1.1)
 MatrixGenerics         1.6.0      2021-10-26 [1] Bioconductor
 matrixStats            0.61.0     2021-09-17 [1] CRAN (R 4.1.1)
 mgcv                   1.8-38     2021-10-06 [1] CRAN (R 4.1.1)
 MicrobiotaProcess    * 1.7.5      2021-12-31 [1] Bioconductor
 modeltools             0.2-23     2020-03-05 [1] CRAN (R 4.1.1)
 multcomp               1.4-17     2021-04-29 [1] CRAN (R 4.1.1)
 munsell                0.5.0      2018-06-12 [1] CRAN (R 4.1.1)
 mvtnorm                1.1-3      2021-10-08 [1] CRAN (R 4.1.1)
 nlme                   3.1-153    2021-09-07 [1] CRAN (R 4.1.1)
 patchwork              1.1.1      2020-12-17 [1] CRAN (R 4.1.1)
 permute                0.9-5      2019-03-12 [1] CRAN (R 4.1.1)
 pillar                 1.6.4      2021-10-18 [1] CRAN (R 4.1.1)
 pkgconfig              2.0.3      2019-09-22 [1] CRAN (R 4.1.1)
 purrr                  0.3.4      2020-04-17 [1] CRAN (R 4.1.1)
 R6                     2.5.1      2021-08-19 [1] CRAN (R 4.1.1)
 Rcpp                   1.0.7      2021-07-07 [1] CRAN (R 4.1.1)
 RCurl                  1.98-1.5   2021-09-17 [1] CRAN (R 4.1.1)
 rlang                  0.4.12     2021-10-18 [1] CRAN (R 4.1.1)
 rvcheck              * 0.2.0      2021-09-14 [1] CRAN (R 4.1.1)
 S4Vectors              0.32.0     2021-10-26 [1] Bioconductor
 sandwich               3.0-1      2021-05-18 [1] CRAN (R 4.1.1)
 scales                 1.1.1      2020-05-11 [1] CRAN (R 4.1.1)
 sessioninfo            1.1.1      2018-11-05 [1] CRAN (R 4.1.1)
 SummarizedExperiment   1.24.0     2021-10-26 [1] Bioconductor
 survival               3.2-13     2021-08-24 [1] CRAN (R 4.1.1)
 TH.data                1.1-0      2021-09-27 [1] CRAN (R 4.1.1)
 tibble                 3.1.6      2021-11-07 [1] CRAN (R 4.1.1)
 tidyr                  1.1.4.9000 2022-01-12 [1] Github (tidyverse/tidyr@3abfa55)
 tidyselect             1.1.1      2021-04-30 [1] CRAN (R 4.1.1)
 tidytree               0.3.7      2022-01-10 [1] CRAN (R 4.1.1)
 treeio                 1.18.0     2021-10-26 [1] Bioconductor
 utf8                   1.2.2      2021-07-24 [1] CRAN (R 4.1.1)
 vctrs                  0.3.8      2021-04-29 [1] CRAN (R 4.1.1)
 vegan                  2.5-7      2020-11-28 [1] CRAN (R 4.1.1)
 wget                 * 0.0.1      2021-12-06 [1] local
 withr                  2.4.3      2021-11-30 [1] CRAN (R 4.1.1)
 XVector                0.34.0     2021-10-26 [1] Bioconductor
 yulab.utils            0.0.4      2021-10-09 [1] CRAN (R 4.1.1)
 zlibbioc               1.40.0     2021-10-26 [1] Bioconductor
 zoo                    1.8-9      2021-03-09 [1] CRAN (R 4.1.1)

[1] /mnt/d/UbuntuApps/R/4.1.1/lib/R/library

@Turbinenoli
Copy link
Author

Hey, thank you for your fast answer and your suggested approach.

I will just quickly double check your R session information with mine to make sure I used the right libraries. Furthermore I try to reproduce your suggestion above to convert it to MPSE.

In case it should fail again, I will send you my metadata and the code used to produce the ps object "lime" and it's location based subset "lime_dud" via e-mail. I appreciate your willingness to help a lot!

Cheers and I keep you posted

@Turbinenoli
Copy link
Author

Turbinenoli commented Jan 13, 2022

Hello again

I encounter the same error on the command:> taxonomy(mpse) <- taxatab and you should have received a mail with my metadata. The packages check out so far, but still here is my session info:

 sessioninfo::session_info()
- Session info ---------------------------------------------------------------------------------------------------------------------------------------
 setting  value
 version  R version 4.1.1 (2021-08-10)
 os       Windows 10 x64 (build 19043)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  German_Switzerland.1252
 ctype    German_Switzerland.1252
 tz       Europe/Berlin
 date     2022-01-13
 rstudio  2021.09.0+351 Ghost Orchid (desktop)
 pandoc   2.14.0.3 @ C:/Program Files/RStudio/bin/pandoc/ (via rmarkdown)

- Packages -------------------------------------------------------------------------------------------------------------------------------------------
 ! package              * version    date (UTC) lib source
   abind                  1.4-5      2016-07-21 [1] CRAN (R 4.1.1)
   ade4                   1.7-18     2021-09-16 [1] CRAN (R 4.1.1)
   ape                    5.5        2021-04-25 [1] CRAN (R 4.1.1)
   aplot                  0.1.2      2022-01-10 [1] CRAN (R 4.1.1)
   assertthat             0.2.1      2019-03-21 [1] CRAN (R 4.1.1)
   backports              1.4.1      2021-12-13 [1] CRAN (R 4.1.2)
   Biobase                2.52.0     2021-05-19 [1] Bioconductor
   BiocGenerics           0.40.0     2021-10-26 [1] Bioconductor
   BiocManager            1.30.16    2021-06-15 [1] CRAN (R 4.1.1)
   biomformat             1.20.0     2021-05-19 [1] Bioconductor
   Biostrings             2.60.2     2021-08-05 [1] Bioconductor
   bitops                 1.0-7      2021-04-24 [1] CRAN (R 4.1.1)
   broom                  0.7.11     2022-01-03 [1] CRAN (R 4.1.2)
   car                    3.0-12     2021-11-06 [1] CRAN (R 4.1.2)
   carData                3.0-5      2022-01-06 [1] CRAN (R 4.1.2)
   caret                  6.0-90     2021-10-09 [1] CRAN (R 4.1.1)
   cellranger             1.1.0      2016-07-27 [1] CRAN (R 4.1.1)
   class                  7.3-19     2021-05-03 [2] CRAN (R 4.1.1)
   cli                    3.1.0      2021-10-27 [1] CRAN (R 4.1.1)
   cluster                2.1.2      2021-04-17 [2] CRAN (R 4.1.1)
   codetools              0.2-18     2020-11-04 [2] CRAN (R 4.1.1)
   coin                 * 1.4-2      2021-10-08 [1] CRAN (R 4.1.2)
   colorspace             2.0-2      2021-06-24 [1] CRAN (R 4.1.1)
   conquer                1.2.1      2021-11-01 [1] CRAN (R 4.1.2)
   crayon                 1.4.2      2021-10-29 [1] CRAN (R 4.1.1)
   data.table             1.14.2     2021-09-27 [1] CRAN (R 4.1.1)
   DBI                    1.1.2      2021-12-20 [1] CRAN (R 4.1.2)
   dbplyr                 2.1.1      2021-04-06 [1] CRAN (R 4.1.1)
   DelayedArray           0.18.0     2021-05-19 [1] Bioconductor
   digest                 0.6.29     2021-12-01 [1] CRAN (R 4.1.2)
   dplyr                * 1.0.7      2021-06-18 [1] CRAN (R 4.1.1)
   ellipsis               0.3.2      2021-04-29 [1] CRAN (R 4.1.1)
   evaluate               0.14       2019-05-28 [1] CRAN (R 4.1.1)
   extrafont              0.17       2014-12-08 [1] CRAN (R 4.1.1)
   extrafontdb            1.0        2012-06-11 [1] CRAN (R 4.1.1)
   fansi                  0.5.0      2021-05-25 [1] CRAN (R 4.1.1)
   farver                 2.1.0      2021-02-28 [1] CRAN (R 4.1.1)
   fastmap                1.1.0      2021-01-25 [1] CRAN (R 4.1.1)
   forcats              * 0.5.1      2021-01-27 [1] CRAN (R 4.1.1)
   foreach                1.5.1      2020-10-15 [1] CRAN (R 4.1.1)
   fs                     1.5.2      2021-12-08 [1] CRAN (R 4.1.2)
   future                 1.23.0     2021-10-31 [1] CRAN (R 4.1.1)
   future.apply           1.8.1      2021-08-10 [1] CRAN (R 4.1.1)
   gdtools                0.2.3      2021-01-06 [1] CRAN (R 4.1.1)
   generics               0.1.1      2021-10-25 [1] CRAN (R 4.1.1)
   GenomeInfoDb           1.30.0     2021-10-26 [1] Bioconductor
   GenomeInfoDbData       1.2.7      2022-01-13 [1] Bioconductor
   GenomicRanges          1.44.0     2021-05-19 [1] Bioconductor
   ggforce              * 0.3.3      2021-03-05 [1] CRAN (R 4.1.2)
   ggfun                  0.0.4      2021-09-17 [1] CRAN (R 4.1.2)
   ggnewscale             0.4.5      2021-01-11 [1] CRAN (R 4.1.2)
   ggplot2              * 3.3.5      2021-06-25 [1] CRAN (R 4.1.1)
   ggplotify              0.1.0      2021-09-02 [1] CRAN (R 4.1.2)
   ggpmisc              * 0.4.5      2021-12-11 [1] CRAN (R 4.1.2)
   ggpp                 * 0.4.3      2021-12-17 [1] CRAN (R 4.1.2)
   ggpubr               * 0.4.0      2020-06-27 [1] CRAN (R 4.1.1)
   ggrepel                0.9.1      2021-01-15 [1] CRAN (R 4.1.1)
   ggsignif               0.6.3      2021-09-09 [1] CRAN (R 4.1.1)
   ggstar                 1.0.3      2021-12-03 [1] CRAN (R 4.1.2)
   ggthemes             * 4.2.4      2021-01-20 [1] CRAN (R 4.1.2)
   ggtree                 3.2.1      2021-11-16 [1] Bioconductor
   ggtreeExtra            1.4.1      2021-11-28 [1] Bioconductor
   globals                0.14.0     2020-11-22 [1] CRAN (R 4.1.1)
   glue                   1.4.2      2020-08-27 [1] CRAN (R 4.1.1)
   gower                  0.2.2      2020-06-23 [1] CRAN (R 4.1.1)
   gridExtra            * 2.3        2017-09-09 [1] CRAN (R 4.1.2)
   gridGraphics           0.5-1      2020-12-13 [1] CRAN (R 4.1.2)
   gtable                 0.3.0      2019-03-25 [1] CRAN (R 4.1.1)
   haven                  2.4.3      2021-08-04 [1] CRAN (R 4.1.1)
   hms                    1.1.1      2021-09-26 [1] CRAN (R 4.1.1)
   hrbrthemes           * 0.8.0      2020-03-06 [1] CRAN (R 4.1.2)
   htmltools              0.5.2      2021-08-25 [1] CRAN (R 4.1.1)
   httr                   1.4.2      2020-07-20 [1] CRAN (R 4.1.1)
   igraph                 1.2.6      2020-10-06 [1] CRAN (R 4.1.1)
   ipred                  0.9-12     2021-09-15 [1] CRAN (R 4.1.1)
   IRanges                2.26.0     2021-05-19 [1] Bioconductor
   iterators              1.0.13     2020-10-15 [1] CRAN (R 4.1.1)
   jsonlite               1.7.2      2020-12-09 [1] CRAN (R 4.1.1)
   knitr                  1.37       2021-12-16 [1] CRAN (R 4.1.2)
   lattice              * 0.20-44    2021-05-02 [2] CRAN (R 4.1.1)
   lava                   1.6.10     2021-09-02 [1] CRAN (R 4.1.1)
   lazyeval               0.2.2      2019-03-15 [1] CRAN (R 4.1.1)
   libcoin                1.0-9      2021-09-27 [1] CRAN (R 4.1.2)
   lifecycle              1.0.1      2021-09-24 [1] CRAN (R 4.1.1)
   listenv                0.8.0      2019-12-05 [1] CRAN (R 4.1.1)
   lubridate              1.8.0      2021-10-07 [1] CRAN (R 4.1.1)
   magick               * 2.7.3      2021-08-18 [1] CRAN (R 4.1.2)
   magrittr               2.0.1      2020-11-17 [1] CRAN (R 4.1.1)
   MASS                   7.3-54     2021-05-03 [2] CRAN (R 4.1.1)
   Matrix                 1.3-4      2021-06-01 [2] CRAN (R 4.1.1)
   MatrixGenerics         1.6.0      2021-10-26 [1] Bioconductor
   MatrixModels           0.5-0      2021-03-02 [1] CRAN (R 4.1.1)
   matrixStats            0.61.0     2021-09-17 [1] CRAN (R 4.1.1)
   mgcv                   1.8-36     2021-06-01 [2] CRAN (R 4.1.1)
   MicrobiotaProcess    * 1.7.5      2022-01-13 [1] Github (YuLab-SMU/MicrobiotaProcess@23dc564)
   ModelMetrics           1.2.2.2    2020-03-17 [1] CRAN (R 4.1.1)
   modelr                 0.1.8      2020-05-19 [1] CRAN (R 4.1.1)
   modeltools             0.2-23     2020-03-05 [1] CRAN (R 4.1.1)
   multcomp               1.4-18     2022-01-04 [1] CRAN (R 4.1.2)
   multtest               2.48.0     2021-05-19 [1] Bioconductor
   munsell                0.5.0      2018-06-12 [1] CRAN (R 4.1.1)
   mvtnorm                1.1-3      2021-10-08 [1] CRAN (R 4.1.1)
   nlme                   3.1-152    2021-02-04 [2] CRAN (R 4.1.1)
   nnet                   7.3-16     2021-05-03 [2] CRAN (R 4.1.1)
   parallelly             1.30.0     2021-12-17 [1] CRAN (R 4.1.2)
   patchwork            * 1.1.1      2020-12-17 [1] CRAN (R 4.1.1)
   permute              * 0.9-5      2019-03-12 [1] CRAN (R 4.1.1)
   phyloseq             * 1.36.0     2021-05-19 [1] Bioconductor
   pillar                 1.6.4      2021-10-18 [1] CRAN (R 4.1.1)
   pkgconfig              2.0.3      2019-09-22 [1] CRAN (R 4.1.1)
   plyr                 * 1.8.6      2020-03-03 [1] CRAN (R 4.1.1)
   polyclip               1.10-0     2019-03-14 [1] CRAN (R 4.1.1)
   pROC                   1.18.0     2021-09-03 [1] CRAN (R 4.1.1)
   prodlim                2019.11.13 2019-11-17 [1] CRAN (R 4.1.1)
   purrr                * 0.3.4      2020-04-17 [1] CRAN (R 4.1.1)
   quantreg             * 5.86       2021-06-06 [1] CRAN (R 4.1.1)
   R6                     2.5.1      2021-08-19 [1] CRAN (R 4.1.1)
   Rcpp                   1.0.7      2021-07-07 [1] CRAN (R 4.1.1)
   RCurl                  1.98-1.5   2021-09-17 [1] CRAN (R 4.1.1)
   readr                * 2.1.1      2021-11-30 [1] CRAN (R 4.1.2)
   readxl                 1.3.1      2019-03-13 [1] CRAN (R 4.1.1)
   recipes                0.1.17     2021-09-27 [1] CRAN (R 4.1.1)
   reprex                 2.0.1      2021-08-05 [1] CRAN (R 4.1.1)
   reshape2               1.4.4      2020-04-09 [1] CRAN (R 4.1.1)
   rhdf5                  2.36.0     2021-05-19 [1] Bioconductor
 D rhdf5filters           1.4.0      2021-05-19 [1] Bioconductor
   Rhdf5lib               1.14.2     2021-07-06 [1] Bioconductor
   rlang                  0.4.11     2021-04-30 [1] CRAN (R 4.1.1)
   rmarkdown              2.11       2021-09-14 [1] CRAN (R 4.1.1)
   rpart                  4.1-15     2019-04-12 [2] CRAN (R 4.1.1)
   rstatix                0.7.0      2021-02-13 [1] CRAN (R 4.1.1)
   rstudioapi             0.13       2020-11-12 [1] CRAN (R 4.1.1)
   Rttf2pt1               1.3.9      2021-07-22 [1] CRAN (R 4.1.1)
   rvest                  1.0.2      2021-10-16 [1] CRAN (R 4.1.1)
   S4Vectors              0.30.2     2021-10-03 [1] Bioconductor
   sandwich               3.0-1      2021-05-18 [1] CRAN (R 4.1.2)
   scales               * 1.1.1      2020-05-11 [1] CRAN (R 4.1.1)
   scico                * 1.3.0      2021-12-08 [1] CRAN (R 4.1.2)
   sessioninfo            1.2.2      2021-12-06 [1] CRAN (R 4.1.2)
   SparseM              * 1.81       2021-02-18 [1] CRAN (R 4.1.1)
   stringi                1.7.5      2021-10-04 [1] CRAN (R 4.1.1)
   stringr              * 1.4.0      2019-02-10 [1] CRAN (R 4.1.1)
   SummarizedExperiment   1.24.0     2021-10-26 [1] Bioconductor
   survival             * 3.2-11     2021-04-26 [2] CRAN (R 4.1.1)
   systemfonts            1.0.3      2021-10-13 [1] CRAN (R 4.1.1)
   TH.data                1.1-0      2021-09-27 [1] CRAN (R 4.1.2)
   tibble               * 3.1.5      2021-09-30 [1] CRAN (R 4.1.1)
   tidyr                * 1.1.4      2021-09-27 [1] CRAN (R 4.1.1)
   tidyselect             1.1.1      2021-04-30 [1] CRAN (R 4.1.1)
   tidytree               0.3.7      2022-01-10 [1] CRAN (R 4.1.1)
   tidyverse            * 1.3.1      2021-04-15 [1] CRAN (R 4.1.2)
   timeDate               3043.102   2018-02-21 [1] CRAN (R 4.1.1)
   treeio                 1.18.1     2021-11-14 [1] Bioconductor
   tweenr                 1.0.2      2021-03-23 [1] CRAN (R 4.1.2)
   tzdb                   0.2.0      2021-10-27 [1] CRAN (R 4.1.1)
   utf8                   1.2.2      2021-07-24 [1] CRAN (R 4.1.1)
   vctrs                  0.3.8      2021-04-29 [1] CRAN (R 4.1.1)
   vegan                * 2.5-7      2020-11-28 [1] CRAN (R 4.1.1)
   viridis              * 0.6.2      2021-10-13 [1] CRAN (R 4.1.1)
   viridisLite          * 0.4.0      2021-04-13 [1] CRAN (R 4.1.1)
   withr                  2.4.3      2021-11-30 [1] CRAN (R 4.1.2)
   xfun                   0.29       2021-12-14 [1] CRAN (R 4.1.2)
   xml2                   1.3.3      2021-11-30 [1] CRAN (R 4.1.2)
   XVector                0.32.0     2021-05-19 [1] Bioconductor
   yulab.utils            0.0.4      2021-10-09 [1] CRAN (R 4.1.2)
   zlibbioc               1.38.0     2021-05-19 [1] Bioconductor
   zoo                    1.8-9      2021-03-09 [1] CRAN (R 4.1.1)

 [1] C:/Users/Simon/Documents/R/win-library/4.1
 [2] C:/Program Files/R/R-4.1.1/library

 D -- DLL MD5 mismatch, broken installation.

@xiangpin
Copy link
Member

I checked the taxonomy table and found some Kingdom of ASVs is k__, which means the annotation of kingdom level is Unknown. The original version cannot handle this. Now, this issue was fixed by github version. You can reinstall it via remotes::install_github("YuLab-SMU/MicrobiotaProcess")

> library(MicrobiotaProcess)
> otuda <- read.csv("./otu_table.csv", row.names=1)
> taxada <- read.csv("./tax_table.csv", row.names=1)
> taxada %>% filter(Kingdom=="k__")
         Kingdom Phylum Class Order Family Genus
ASV23455     k__    p__   c__   o__    f__   g__
ASV24768     k__    p__   c__   o__    f__   g__
ASV24998     k__    p__   c__   o__    f__   g__
ASV25075     k__    p__   c__   o__    f__   g__
ASV26098     k__    p__   c__   o__    f__   g__
ASV26141     k__    p__   c__   o__    f__   g__
ASV26149     k__    p__   c__   o__    f__   g__
ASV26302     k__    p__   c__   o__    f__   g__
ASV26318     k__    p__   c__   o__    f__   g__
ASV26466     k__    p__   c__   o__    f__   g__
ASV26526     k__    p__   c__   o__    f__   g__
ASV26527     k__    p__   c__   o__    f__   g__
ASV26848     k__    p__   c__   o__    f__   g__
ASV26912     k__    p__   c__   o__    f__   g__
ASV26931     k__    p__   c__   o__    f__   g__
ASV27027     k__    p__   c__   o__    f__   g__
ASV27040     k__    p__   c__   o__    f__   g__
ASV27165     k__    p__   c__   o__    f__   g__
> mpse <- MPSE(assays=list(Abundance=t(otuda)))
> mpse
# A MPSE-tibble (MPSE object) abstraction: 1,519,506 × 3
# OTU=28139 | Samples=54 | Assays=Abundance | Taxonomy=NULL
   OTU   Sample Abundance
   <chr> <chr>      <int>
 1 ASV1  S1-1         204
 2 ASV2  S1-1         269
 3 ASV3  S1-1           0
 4 ASV4  S1-1         113
 5 ASV5  S1-1          67
 6 ASV6  S1-1          54
 7 ASV7  S1-1         127
 8 ASV8  S1-1         103
 9 ASV9  S1-1           0
10 ASV10 S1-1           0
# … with 1,519,496 more rows
> taxonomy(mpse) <- taxada
> mpse
# A MPSE-tibble (MPSE object) abstraction: 1,519,506 × 9
# OTU=28139 | Samples=54 | Assays=Abundance | Taxonomy=Kingdom, Phylum, Class, Order, Family, Genus
   OTU   Sample Abundance Kingdom     Phylum   Class    Order   Family   Genus
   <chr> <chr>      <int> <chr>       <chr>    <chr>    <chr>   <chr>    <chr>
 1 ASV1  S1-1         204 k__Bacteria p__Prot… c__Alph… o__Rhi… f__Xant… g__un_…
 2 ASV2  S1-1         269 k__Bacteria p__Prot… c__Alph… o__Rhi… f__Meth… g__un_…
 3 ASV3  S1-1           0 k__Bacteria p__Prot… c__Alph… o__Rhi… f__Meth… g__un_…
 4 ASV4  S1-1         113 k__Bacteria p__Nitr… c__Nitr… o__Nit… f__Nitr… g__Nit…
 5 ASV5  S1-1          67 k__Bacteria p__Prot… c__Alph… o__Rhi… f__Xant… g__Bra…
 6 ASV6  S1-1          54 k__Bacteria p__Prot… c__Alph… o__Rhi… f__Xant… g__un_…
 7 ASV7  S1-1         127 k__Bacteria p__Myxo… c__bact… o__un_… f__un_c… g__un_…
 8 ASV8  S1-1         103 k__Bacteria p__Acti… c__Acti… o__Mic… f__Micr… g__Pse…
 9 ASV9  S1-1           0 k__Bacteria p__Prot… c__Gamm… o__Bur… f__SC-I… g__un_…
10 ASV10 S1-1           0 k__Bacteria p__Chlo… c__Chlo… o__Chl… f__Rose… g__un_…
# … with 1,519,496 more rows

Or you can use convert_to_treedata to convert the taxada to a treedata class first, then specifying the taxatree in MPSE function.

> taxa.tree <- taxada %>% convert_to_treedata(include.rownames=T)
> mpse2 <- MPSE(assays=list(Abundance=t(otuda)), taxatree=taxa.tree)
> identical(mpse, mpse2)

Then you can use as.phyloseq to convert the MPSE class to phyloseq class, if you want to do it.

ps <- mpse %>% as.phyloseq(.abundance=Abundance)
ps

@Turbinenoli
Copy link
Author

image

Thank you very much for taking your time and the adaptation to the package. It worked right from the start and I am therefore closing this issue. Looking forward to do more work with MicrobiotaProcess!

Cheers and best regards

Simon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants