top_taxa | R Documentation |
Arrange top taxa in descending order. Assessed based on cumulative sum, so only the top (80% for example) taxa are returned.
top_taxa(relab_df, cutoff)
cutoff |
numeric. between 0 and 1. Cut-off abundance for what is considered as "top taxa." Default 0.8. Taxa with abundances less than the cut-off are lumped together as "Other" |
relab |
dataframe or matrix. relative abundance matrix with taxa in rows (as rownames) and samples in columns |
dataframe of taxa, sample_id, relative abundance, and cumulative sum of relative abundance.
# put asv relative abundance features in same order as taxonomy table
# get relative abundance data
asv_mat <- dss_example$merged_abundance_id[,2:ncol(dss_example$merged_abundance_id)]
rownames(asv_mat) <- dss_example$merged_abundance_id$featureID
relab_data <- relab(asv_mat)
# match row order of relative abundance and taxonomy data
relab_data <- relab_data[match(dss_example$merged_taxonomy$featureID,
rownames(relab_data)),]
# prepend X to column names
colnames(relab_data) <- sprintf("X%s", colnames(relab_data))
# get genus-level relative abundance
genus_df <- aggregate_count(relab_data, dss_example$merged_taxonomy, 'Genus')$count_df
# get top taxa
top80 <- top_taxa(genus_df, cutoff=0.8)
print(top80 %>% filter(sample_id == unique(top80$sample_id)[1]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.