This class is a wrapper for a series of alpha diveristy related analysis, including the statistics and plotting based on An et al. (2019) <doi:10.1016/j.geoderma.2018.09.035> and Paul et al. (2013) <doi:10.1371/journal.pone.0061217>.
new()
trans_alpha$new(dataset = NULL, group = NULL, order_x = NULL)
dataset
the object of microtable
Class.
group
default NULL; the sample column used for the statistics; If provided, can return alpha_stat.
order_x
default NULL; sample_table column name or a vector containg sample names; if provided, order samples by using factor.
alpha_data and alpha_stat stored in the object.
\donttest{ data(dataset) t1 <- trans_alpha$new(dataset = dataset, group = "Group") }
cal_diff()
Test the difference of alpha diversity across groups.
trans_alpha$cal_diff( method = c("KW", "anova")[1], measures = NULL, anova_set = NULL )
method
default "KW"; "KW" or "anova"; KW rank sum test or anova for the testing.
measures
default NULL; a vector; if null, all indexes will be calculated; see names of alpha_diversity of dataset, e.g. Observed, Chao1, ACE, Shannon, Simpson, InvSimpson, Fisher, Coverage, PD.
anova_set
default NULL; specified group set for anova, such as 'block + N*P*K', see aov
.
res_alpha_diff in object. A data.frame for method = 'KW' or 'anova'. A list for method = 'anova' and anova_set is assigned.
\donttest{ t1$cal_diff(method = "KW") t1$cal_diff(method = "anova") }
plot_alpha()
Plotting the alpha diveristy.
trans_alpha$plot_alpha( color_values = RColorBrewer::brewer.pal(8, "Dark2"), measure = "Shannon", group = NULL, add_letter = FALSE, use_boxplot = TRUE, boxplot_color = TRUE, boxplot_add = "jitter", order_x_mean = TRUE, pair_compare = FALSE, pair_compare_filter = "", pair_compare_method = "wilcox.test", xtext_angle = NULL, xtext_size = 10, ytitle_size = 17, base_font = "sans", ... )
color_values
colors used for presentation.
measure
default Shannon; alpha diveristy measurement; see names of alpha_diversity of dataset, e.g. Observed, Chao1, ACE, Shannon, Simpson, InvSimpson, Fisher, Coverage, PD.
group
default NULL; group name used for the plot.
add_letter
default FALSE; If TRUE, the letters of duncan test will be added in the plot.
use_boxplot
default TRUE; TRUE: boxplot, FALSE: mean_se plot.
boxplot_color
default TRUE; TRUE: use color_values, FALSE: use "black".
boxplot_add
default "jitter"; points type, see the add parameter in ggpubr::ggboxplot.
order_x_mean
default FALSE; whether order x axis by the means of groups from large to small.
pair_compare
default FALSE; whether perform paired comparisons.
pair_compare_filter
default ""; groups that need to be removed in the comparisons.
pair_compare_method
default wilcox.test; wilcox.test, kruskal.test, t.test or anova.
xtext_angle
default NULL; number (e.g. 30) used to make x axis text generate angle.
xtext_size
default 10, x axis text size.
ytitle_size
default 17, y axis title size.
base_font
default "sans", font in the plot.
...
parameters pass to ggpubr::ggboxplot function.
ggplot.
\donttest{ t1$plot_alpha(measure = "Shannon", group = "Group", pair_compare = TRUE) }
print()
Print the trans_alpha object.
trans_alpha$print()
clone()
The objects of this class are cloneable with this method.
trans_alpha$clone(deep = FALSE)
deep
Whether to make a deep clone.
# NOT RUN {
## ------------------------------------------------
## Method `trans_alpha$new`
## ------------------------------------------------
# }
# NOT RUN {
data(dataset)
t1 <- trans_alpha$new(dataset = dataset, group = "Group")
# }
# NOT RUN {
## ------------------------------------------------
## Method `trans_alpha$cal_diff`
## ------------------------------------------------
# }
# NOT RUN {
t1$cal_diff(method = "KW")
t1$cal_diff(method = "anova")
# }
# NOT RUN {
## ------------------------------------------------
## Method `trans_alpha$plot_alpha`
## ------------------------------------------------
# }
# NOT RUN {
t1$plot_alpha(measure = "Shannon", group = "Group", pair_compare = TRUE)
# }
Run the code above in your browser using DataLab