YuLab-SMU / MicrobiotaProcess

:microbe: A comprehensive R package for deep mining microbiome

Home Page:https://www.sciencedirect.com/science/article/pii/S2666675823000164

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

include.lowest = FALSE in mp_filter_taxa seems not work

Hua-CM opened this issue · comments

When I use the mp_filter_taxa function, I found that include.lowest seems not work, which always return the include.lowest=False reuslt. However, when try it using example dataset mouse.time.mpse, it works fine. I could not figure out why but I think this is very important, because many users may not notice this.
My dataset is unpublic, so if you need it to test, welcome to contact me.

> mp_filter_taxa(mp_raw, .abundance = Abundance, min.abun = 1, min.prop = 0.1, iclude.lowest=FALSE)
# A MPSE-tibble (MPSE object) abstraction: 825,086 × 15
# OTU=6763 | Samples=122 | Assays=Abundance | Taxonomy=Kingdom, Phylum, Class, Order, Family, Genus, Species
   OTU    Sample Abundance origin suborigin bioreptype biotype oritype Kingdom     Phylum      Class Order Family Genus Species
   <chr>  <chr>      <int> <chr>  <chr>     <chr>      <chr>   <chr>   <chr>       <chr>       <chr> <chr> <chr>  <chr> <chr>  
 1 OTU_1  JLBX1E         0 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Ef__Yeg__Ss__Ser2 OTU_2  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Bug__Bs__Par3 OTU_3  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Xf__Rhg__us__un_4 OTU_4  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Ao__Sf__Spg__Ss__un_5 OTU_5  JLBX1E        11 JL     BX        1          E       JLE     k__Bacteria p__Bacteroc__Bo__Ff__Weg__Cs__Chr6 OTU_6  JLBX1E         0 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Ao__Rf__Rhg__Ps__Phy7 OTU_7  JLBX1E         4 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Bug__Bs__un_8 OTU_8  JLBX1E        27 JL     BX        1          E       JLE     k__Bacteria p__Actinobc__Ao__Mf__Mig__Ms__un_9 OTU_9  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Xf__Rhg__us__un_10 OTU_10 JLBX1E         2 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Oxg__Cs__Col# ℹ 825,076 more rows
# ℹ Use `print(n = ...)` to see more rows
> 
> mp_filter_taxa(mp_raw, .abundance = Abundance, min.abun = 1, min.prop = 0.1, iclude.lowest=TRUE)
# A MPSE-tibble (MPSE object) abstraction: 825,086 × 15
# OTU=6763 | Samples=122 | Assays=Abundance | Taxonomy=Kingdom, Phylum, Class, Order, Family, Genus, Species
   OTU    Sample Abundance origin suborigin bioreptype biotype oritype Kingdom     Phylum      Class Order Family Genus Species
   <chr>  <chr>      <int> <chr>  <chr>     <chr>      <chr>   <chr>   <chr>       <chr>       <chr> <chr> <chr>  <chr> <chr>  
 1 OTU_1  JLBX1E         0 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Ef__Yeg__Ss__Ser2 OTU_2  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Bug__Bs__Par3 OTU_3  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Xf__Rhg__us__un_4 OTU_4  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Ao__Sf__Spg__Ss__un_5 OTU_5  JLBX1E        11 JL     BX        1          E       JLE     k__Bacteria p__Bacteroc__Bo__Ff__Weg__Cs__Chr6 OTU_6  JLBX1E         0 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Ao__Rf__Rhg__Ps__Phy7 OTU_7  JLBX1E         4 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Bug__Bs__un_8 OTU_8  JLBX1E        27 JL     BX        1          E       JLE     k__Bacteria p__Actinobc__Ao__Mf__Mig__Ms__un_9 OTU_9  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Xf__Rhg__us__un_10 OTU_10 JLBX1E         2 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Oxg__Cs__Col# ℹ 825,076 more rows
# ℹ Use `print(n = ...)` to see more rows
> mp_filter_taxa(mp_raw, .abundance = Abundance, min.abun = 2, min.prop = 0.1, iclude.lowest=TRUE)
# A MPSE-tibble (MPSE object) abstraction: 545,462 × 15
# OTU=4471 | Samples=122 | Assays=Abundance | Taxonomy=Kingdom, Phylum, Class, Order, Family, Genus, Species
   OTU    Sample Abundance origin suborigin bioreptype biotype oritype Kingdom     Phylum      Class Order Family Genus Species
   <chr>  <chr>      <int> <chr>  <chr>     <chr>      <chr>   <chr>   <chr>       <chr>       <chr> <chr> <chr>  <chr> <chr>  
 1 OTU_1  JLBX1E         0 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Ef__Yeg__Ss__Ser2 OTU_2  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Bug__Bs__Par3 OTU_3  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Xf__Rhg__us__un_4 OTU_4  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Ao__Sf__Spg__Ss__un_5 OTU_5  JLBX1E        11 JL     BX        1          E       JLE     k__Bacteria p__Bacteroc__Bo__Ff__Weg__Cs__Chr6 OTU_6  JLBX1E         0 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Ao__Rf__Rhg__Ps__Phy7 OTU_7  JLBX1E         4 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Bug__Bs__un_8 OTU_8  JLBX1E        27 JL     BX        1          E       JLE     k__Bacteria p__Actinobc__Ao__Mf__Mig__Ms__un_9 OTU_9  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Xf__Rhg__us__un_10 OTU_10 JLBX1E         2 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Oxg__Cs__Col# ℹ 545,452 more rows
# ℹ Use `print(n = ...)` to see more rows
> mp_filter_taxa(mp_raw, .abundance = Abundance, min.abun = 2, min.prop = 0.1, iclude.lowest=FALSE)
# A MPSE-tibble (MPSE object) abstraction: 545,462 × 15
# OTU=4471 | Samples=122 | Assays=Abundance | Taxonomy=Kingdom, Phylum, Class, Order, Family, Genus, Species
   OTU    Sample Abundance origin suborigin bioreptype biotype oritype Kingdom     Phylum      Class Order Family Genus Species
   <chr>  <chr>      <int> <chr>  <chr>     <chr>      <chr>   <chr>   <chr>       <chr>       <chr> <chr> <chr>  <chr> <chr>  
 1 OTU_1  JLBX1E         0 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Ef__Yeg__Ss__Ser2 OTU_2  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Bug__Bs__Par3 OTU_3  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Xf__Rhg__us__un_4 OTU_4  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Ao__Sf__Spg__Ss__un_5 OTU_5  JLBX1E        11 JL     BX        1          E       JLE     k__Bacteria p__Bacteroc__Bo__Ff__Weg__Cs__Chr6 OTU_6  JLBX1E         0 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Ao__Rf__Rhg__Ps__Phy7 OTU_7  JLBX1E         4 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Bug__Bs__un_8 OTU_8  JLBX1E        27 JL     BX        1          E       JLE     k__Bacteria p__Actinobc__Ao__Mf__Mig__Ms__un_9 OTU_9  JLBX1E         1 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Xf__Rhg__us__un_10 OTU_10 JLBX1E         2 JL     BX        1          E       JLE     k__Bacteria p__Proteobc__Go__Bf__Oxg__Cs__Col# ℹ 545,452 more rows
# ℹ Use `print(n = ...)` to see more rows

You can try a larger min.abun value and include.lowest=T (meaning >= min.abun) or include.lowest=F (meaning >min.abun), and you can extract the specified assay to make statistics.

> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% `>`(1) %>% table()
.
FALSE  TRUE
 2521  1621
> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% `>=`(1) %>% table()
.
FALSE  TRUE
 2521  1621
> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% `>`(2) %>% table()
.
FALSE  TRUE
 2535  1607
> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% `>=`(2) %>% table()
.
FALSE  TRUE
 2521  1621
> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% `>`(3) %>% table()
.
FALSE  TRUE
 2570  1572
> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% `>=`(3) %>% table()
.
FALSE  TRUE
 2535  1607
> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% `>`(4) %>% table()
.
FALSE  TRUE
 2609  1533
> mouse.time.mpse %>% mp_extract_assays(.abundance=Abundance) %>% `>=`(4) %>% table()
.
FALSE  TRUE
 2570  1572