Public methods
Method new()
Usage
trans_alpha$new(dataset = NULL, group = NULL, order_x = NULL)
Arguments
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.
Returns
alpha_data and alpha_stat stored in the object.
Examples
\donttest{
data(dataset)
t1 <- trans_alpha$new(dataset = dataset, group = "Group")
}
Method cal_diff()
Test the difference of alpha diversity across groups.
Usage
trans_alpha$cal_diff(
method = c("KW", "KW_dunn", "anova")[1],
measures = NULL,
p_adjust_method = "fdr",
anova_set = NULL,
...
)
Arguments
method
default "KW"; "KW_dunn" or "anova"; KW: Kruskal-Wallis Rank Sum Test (groups > 2) or Wilcoxon Rank Sum and Signed
Rank Tests (groups = 2); KW_dunn: Dunn's Kruskal-Wallis Multiple Comparisons, see dunnTest function in FSA package;
anova: Duncan's multiple range test for anova;
measures
default NULL; a vector; if null, all indexes will be calculated; see names of microtable$alpha_diversity,
e.g. Observed, Chao1, ACE, Shannon, Simpson, InvSimpson, Fisher, Coverage, PD.
p_adjust_method
default "fdr"; p.adjust method; see method parameter of p.adjust function for available options.
anova_set
default NULL; specified group set for anova, such as 'block + N*P*K', see aov
.
...
parameters passed to kruskal.test or wilcox.test function (method = "KW") or dunnTest function of FSA package (method = "KW_dunn") or
agricolae::duncan.test (method = "anova").
Returns
res_alpha_diff in object. A data.frame generally. A list for anova when anova_set is assigned.
Examples
\donttest{
t1$cal_diff(method = "KW")
t1$cal_diff(method = "KW_dunn")
t1$cal_diff(method = "anova")
}
Method plot_alpha()
Plotting the alpha diveristy.
Usage
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",
...
)
Arguments
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.
Returns
ggplot.
Examples
\donttest{
t1$plot_alpha(measure = "Shannon", group = "Group", pair_compare = TRUE)
}
Method print()
Print the trans_alpha object.
Usage
trans_alpha$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
trans_alpha$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.