build_tax_table: Build a 'tax_table' from a named possibly-jagged list

Description Usage Arguments Value See Also Examples

View source: R/IO-methods.R

Description

Build a tax_table from a named possibly-jagged list

Usage

1
build_tax_table(taxlist)

Arguments

taxlist

(Required). A list in which each element is a vector of taxonomic assignments named by rank. Every element of every vector must be named by the rank it represents. Every element of the list (every vector) should correspond to a single OTU and be named for that OTU.

Value

A tax_table (taxonomyTable-class) that has been built from taxlist. The OTU names of this output will be the element names of taxlist, and a separate taxonomic rank (column) will be included for each unique rank found among the element names of each vector in the list. NA_character_ is the default value of elements in the tax_table for which there is no corresponding information in taxlist.

See Also

import_biom import_qiime

Examples

1
2
3
4
5
6
7
8
9
 taxvec1 = c("Root", "k__Bacteria", "p__Firmicutes", "c__Bacilli", "o__Bacillales", "f__Staphylococcaceae")
 parse_taxonomy_default(taxvec1)
 parse_taxonomy_greengenes(taxvec1)
 taxvec2 = c("Root;k__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;f__Staphylococcaceae")
 parse_taxonomy_qiime(taxvec2)
 taxlist1 = list(OTU1=parse_taxonomy_greengenes(taxvec1), OTU2=parse_taxonomy_qiime(taxvec2))
 taxlist2 = list(OTU1=parse_taxonomy_default(taxvec1), OTU2=parse_taxonomy_qiime(taxvec2))
 build_tax_table(taxlist1)
 build_tax_table(taxlist2)

Example output

                 Rank1                  Rank2                  Rank3 
                "Root"          "k__Bacteria"        "p__Firmicutes" 
                 Rank4                  Rank5                  Rank6 
          "c__Bacilli"        "o__Bacillales" "f__Staphylococcaceae" 
              Rank1             Kingdom              Phylum               Class 
             "Root"          "Bacteria"        "Firmicutes"           "Bacilli" 
              Order              Family 
       "Bacillales" "Staphylococcaceae" 
              Rank1             Kingdom              Phylum               Class 
             "Root"          "Bacteria"        "Firmicutes"           "Bacilli" 
              Order              Family 
       "Bacillales" "Staphylococcaceae" 
Taxonomy Table:     [2 taxa by 6 taxonomic ranks]:
     Rank1  Kingdom    Phylum       Class     Order        Family             
OTU1 "Root" "Bacteria" "Firmicutes" "Bacilli" "Bacillales" "Staphylococcaceae"
OTU2 "Root" "Bacteria" "Firmicutes" "Bacilli" "Bacillales" "Staphylococcaceae"
Taxonomy Table:     [2 taxa by 11 taxonomic ranks]:
     Rank1  Rank2         Rank3           Rank4        Rank5          
OTU1 "Root" "k__Bacteria" "p__Firmicutes" "c__Bacilli" "o__Bacillales"
OTU2 "Root" NA            NA              NA           NA             
     Rank6                  Kingdom    Phylum       Class     Order       
OTU1 "f__Staphylococcaceae" NA         NA           NA        NA          
OTU2 NA                     "Bacteria" "Firmicutes" "Bacilli" "Bacillales"
     Family             
OTU1 NA                 
OTU2 "Staphylococcaceae"

phyloseq documentation built on Nov. 8, 2020, 6:41 p.m.