Reorder taxa in otu_table/tax_table/refseq slot of a phyloseq object
Source:R/dada_phyloseq.R
reorder_taxa_pq.Rd
Note that the taxa order in a physeq object with a tree is locked by the order of leaf in the phylogenetic tree.
Arguments
- physeq
(required): a
phyloseq-class
object obtained using thephyloseq
package.- names_ordered
(required): Names of the taxa (must be the same as taxa in
taxa_names(physeq)
) in a given order- remove_phy_tree
(logical, default FALSE) If TRUE, the phylogenetic tree is removed. It is
Examples
data_fungi_ordered_by_genus <- reorder_taxa_pq(
data_fungi,
taxa_names(data_fungi)[order(as.vector(data_fungi@tax_table[, "Genus"]))]
)
data_fungi_mini_asc_ordered_by_abundance <- reorder_taxa_pq(
data_fungi_mini,
taxa_names(data_fungi_mini)[order(taxa_sums(data_fungi_mini))]
)