Description Usage Arguments Examples
View source: R/plot_alpha_diversity.R
This is a function for plotting alpha diversity. Alpha diversity can only accept intergers ( counts) OTU table!
1 2 3 4 5 6 7 8 9 10 11 12 |
phyloseq |
A phyloseq object contain OTU table, taxonomy table, sample metadata and phylogenetic tree, or a phyloseq object only contain constructed OTU table and metadata. OTU table of the phyloseq can only be intergers (counts) ! |
feature |
The column name of the feature you want to select from metadata. |
feature2 |
The column name of another feature you want to select from metadata. Default is NA. |
level |
Which taxonomy level will be used to calculate alpha diversity. Default is NA. If NA, the original OTU table in phyloseq will be used. If level is given, first an OTU table with taxonomy will be constructed using construct_otu_table, then the OTU table will be used to calculate alpha diversity through phyloseq::plot_richness(). The level name should be one of "Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species". |
measures |
The measures to calculate alpha diversity. Default is NA. If NA, all available alpha diversity measures will be calculated and generate a table. If not NA, measures should be one of c("Observed", "Chao1", "ACE", "Shannon", "Simpson", "InvSimpson", "Fisher"). Note: "Observed", "Chao1", "ACE", "Fisher" these 4 measures can accepts only integers. |
p_test |
The p-value to test alpha diversity. Default is FALSE, will not calculate p-value. p_test should be either "wilcox" or "kruskal". PS: "wilcox" can only work with two groups. |
colors |
A vector of colors. The number of colors should be larger than the number of feature. Default is NULL, if NULL, plot_alpha_diversity will use ggsci::jco theme for the plot. |
dotsize |
See geom_dotplot(dotsize). Default is 0.3. |
label |
Default is FALSE. If TRUE, add sample name labels to plot. |
print_to_screen |
Default is FALSE. If TRUE, print alpha-diversity table to the screen. |
1 2 | plot_alpha_diversity(demo_phyloseq_object, feature = "diagnosis", measures = "Chao1",
p_test = "kruskal")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.