reorder_taxa_pq: Reorder taxa in otu_table/tax_table/refseq slot of a phyloseq...

View source: R/dada_phyloseq.R

reorder_taxa_pqR Documentation

Reorder taxa in otu_table/tax_table/refseq slot of a phyloseq object

Description

lifecycle-experimental

Note that the taxa order in a physeq object with a tree is locked by the order of leaf in the phylogenetic tree.

Usage

reorder_taxa_pq(physeq, names_ordered, remove_phy_tree = FALSE)

Arguments

physeq

(required): a phyloseq-class object obtained using the phyloseq 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

Value

A phyloseq object

Author(s)

Adrien Taudière

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))]
)

MiscMetabar documentation built on Oct. 8, 2024, 1:07 a.m.