KasperSkytte / ampvis2

Tools for visualising microbial community amplicon data
https://kasperskytte.github.io/ampvis2/
GNU General Public License v3.0
66 stars 23 forks source link

amp_filter_samples returns NA's in tax if taxonomy has fewer entries than abund #158

Closed KasperSkytte closed 11 months ago

KasperSkytte commented 11 months ago

Occurs somewhere around line 144 and onwards

Warning message: The OTU's between otutable and taxonomy do not match exactly. 44219 OTU's are missing in taxonomy compared to otutable, some of which are: "ASV50787", "ASV69726", "ASV49178", "ASV56244", "ASV69338", "ASV63891"

KasperSkytte commented 11 months ago

Just a note to myself. No reprex yet. Just observed

KasperSkytte commented 11 months ago
require("ampvis2")
#> Loading required package: ampvis2
#> Loading required package: ggplot2
abund <- example_otutable
tax <- example_taxonomy[1:5,]
d <- amp_load(
  otutable = abund,
  taxonomy = tax,
  metadata = example_metadata
)
#> Warning: The OTU's between otutable and taxonomy do not match exactly. 5 OTU's are missing in taxonomy compared to otutable, some of which are:
#> "OTU_6", "OTU_7", "OTU_8", "OTU_9", "OTU_10"
d
#> ampvis2 object with 3 elements. 
#> Summary of OTU table:
#>      Samples         OTUs  Total#Reads    Min#Reads    Max#Reads Median#Reads 
#>            8           10        32246         2522         5451         3839 
#>    Avg#Reads 
#>      4030.75 
#> 
#> Assigned taxonomy:
#> Kingdom  Phylum   Class   Order  Family   Genus Species 
#>  5(50%)  5(50%)  5(50%)  5(50%)  5(50%)  5(50%)   0(0%) 
#> 
#> Metadata variables: 4 
#>  SampleID, Plant, Date, Year
ds <- amp_filter_samples(d)
#> 0 samples have been filtered.
ds$tax
#>           Kingdom            Phylum                 Class               Order
#> OTU_1 k__Bacteria    p__Chloroflexi             c__SJA-15         o__C10_SB1A
#> OTU_2 k__Bacteria p__Actinobacteria     c__Actinobacteria    o__Micrococcales
#> OTU_3 k__Bacteria p__Actinobacteria     c__Acidimicrobiia o__Acidimicrobiales
#> OTU_4 k__Bacteria p__Proteobacteria c__Betaproteobacteria    o__Rhodocyclales
#> OTU_5 k__Bacteria    p__Chloroflexi       c__Anaerolineae   o__Anaerolineales
#> NA           <NA>              <NA>                  <NA>                <NA>
#> NA.1         <NA>              <NA>                  <NA>                <NA>
#> NA.2         <NA>              <NA>                  <NA>                <NA>
#> NA.3         <NA>              <NA>                  <NA>                <NA>
#> NA.4         <NA>              <NA>                  <NA>                <NA>
#>                      Family                       Genus Species   OTU
#> OTU_1           f__C10_SB1A    g__Candidatus Amarilinum     s__ OTU_1
#> OTU_2 f__Intrasporangiaceae             g__Tetrasphaera     s__ OTU_2
#> OTU_3    f__Microthricaceae    g__Candidatus Microthrix     s__ OTU_3
#> OTU_4     f__Rhodocyclaceae            g__Dechloromonas     s__ OTU_4
#> OTU_5    f__Anaerolineaceae g__Candidatus Villogracilis     s__ OTU_5
#> NA                     <NA>                        <NA>    <NA>  <NA>
#> NA.1                   <NA>                        <NA>    <NA>  <NA>
#> NA.2                   <NA>                        <NA>    <NA>  <NA>
#> NA.3                   <NA>                        <NA>    <NA>  <NA>
#> NA.4                   <NA>                        <NA>    <NA>  <NA>

Created on 2023-07-28 with reprex v2.0.2