View source: R/tax_stackplot.R
tax_stackplot | R Documentation |
Input taxonomy composition, and metadata (SampleID and groupID). Then select top N high abundance taxonomy and group other low abundance. When Select samples can draw sample composition by facet groups. If used group can show mean of each group. Finally, return a ggplot2 object.
tax_stackplot(
tax_sum,
metadata,
topN = 8,
groupID = "Group",
style = "group",
sorted = "abundance"
)
tax_sum |
composition matrix, like OTU table and rowname is taxonomy, typical output of usearch -sintax_summary; |
metadata |
matrix or dataframe, including sampleID and groupID; |
topN |
Top N taxonomy to show, default 8, alternative 4, 6, 10 ...; |
groupID |
column name for groupID; |
style |
group or sample, default group |
sorted |
Legend sorted type, default abundance, alternative alphabet |
By default, returns top 8 taxonomy and group mean stackplot The available style include the following:
group: group mean stackplot
sample: each sample stackplot and facet by group
ggplot2 object.
Contact: Yong-Xin Liu metagenome@126.com
Yong-Xin Liu, Yuan Qin, Tong Chen, Meiping Lu, Xubo Qian, Xiaoxuan Guo & Yang Bai. A practical guide to amplicon and metagenomic analysis of microbiome data. Protein Cell, 2020(41), 1-16, DOI: https://doi.org/10.1007/s13238-020-00724-8
tax_stackplot
# Taxonomy table in phylum level, rownames is Phylum, colnames is SampleID
data(tax_phylum)
# metadata, include SampleID, Group and Site
data(metadata)
# tax_sum and metadata as input, default include top 8 taxonomy, groupID is Group, show group mean and sorted by abundance
tax_stackplot(tax_sum = tax_phylum, metadata)
# Set top10 taxonomy, group by "Site", group mean, and sort by abundance
tax_stackplot(tax_sum = tax_phylum, metadata, topN = 10, groupID = "Site", style = "group", sorted = "abundance")
# Set top 10 taxonomy, group by "Group", and sample composition sorted by alphabet
tax_stackplot(tax_sum = tax_phylum, metadata, topN = 10, groupID = "Group", style = "sample", sorted = "alphabet")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.