View source: R/aggregate_count.R
aggregate_count | R Documentation |
Aggregate read counts based on taxonomic level
aggregate_count(count_df, tax_df = NULL, aggregate_by = NULL)
count_df |
dataframe. count table with samples in columns and ASV in rows. feature IDs in row names. |
tax_df |
dataframe. featureID column should
match rownames of |
aggregate_by |
Aggregate counts by taxonomic level.
Set to |
If tax_df
has sequences column and features are aggregated,
the sequence column is set to NA. If tax_df has Taxon column with
notation of p__phylum;c__class;o__order... then those are truncated
at the aggregation level.
All taxa downstream of aggregation level are set to NA
The aggregated taxonomy table has an additional column, n_collapse
,
which is the number of ASVs that were aggregated.
returns a list of aggregated count table
(count_df
) and updated taxonomy table (tax_df
)
data(dss_example)
feature_count <- dss_example$merged_abundance_id %>%
tibble::column_to_rownames('featureID')
# cleanup sample names
colnames(feature_count) <- paste0('id', colnames(feature_count))
feature_tax <- dss_example$merged_taxonomy
# set row order of count and tax tables to be the same
feature_count <- feature_count[feature_tax$featureID,]
aggregated_list <- aggregate_count(feature_count, feature_tax,
aggregate_by = "Family")
summary(aggregated_list)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.