这次我们分享,trans_venn类用于venn分析。trans_alpha class,Alpha多样性可以使用trans_alpha类进行转换和绘制。
为了分析组的唯一otu和共享otu,我们首先根据sample_table中的"Group"列合并样本。
dataset1 <- dataset$merge_samples(use_group = "Group")
t1 <- trans_venn$new(dataset1, ratio = "seqratio")
t1$plot_venn()
#当组数过多,无法用维恩图表示时,可以用花瓣图表示。
dataset1 <- dataset$merge_samples(use_group = "Type")
t1 <- trans_venn$new(dataset1)
t1$plot_venn(petal_plot = TRUE)
Alpha多样性可以使用trans_alpha类进行转换和绘制
> t1 <- trans_alpha$new(dataset = dataset, group = "Group")
The transformed diversity data is stored in object$data_alpha ...
The group statistics are stored in object$data_stat ...
> t1
trans_alpha object:
data_alpha have 7 columns: Sample, Measure, Value, SampleID, Group, Type, Saline
data_alpha$Measure: Observed, Chao1, ACE, Shannon, Simpson, InvSimpson, Fisher, Pielou, Coverage
data_stat have 6 columns: Group, Measure, N, Mean, SD, SE
> # return t1$alpha_stat
> t1$data_stat[1:5, ]
Group Measure N Mean SD SE
1 CW Observed 30 1843.166667 220.57918796 40.272065654
2 CW Chao1 30 2552.635929 338.11686659 61.731411634
3 CW ACE 30 2715.680687 367.02577198 67.009431500
4 CW Shannon 30 6.307972 0.53551395 0.097771024
5 CW Simpson 30 0.989680 0.01304767 0.002382167
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| > t1$cal_diff(method = "KW") The result is stored in object$res_diff ... > # return t1$res_alpha_diff > t1$res_diff[1:5, ] Comparison Measure Test_method Group P.unadj P.adj Significance 1 IW - CW - TW Observed Kruskal-Wallis Rank Sum Test IW 0.15504659 0.27908386 ns 2 IW - CW - TW Chao1 Kruskal-Wallis Rank Sum Test IW 0.01696123 0.05088368 ns 3 IW - CW - TW ACE Kruskal-Wallis Rank Sum Test IW 0.01333436 0.05088368 ns 4 IW - CW - TW Shannon Kruskal-Wallis Rank Sum Test IW 0.53187046 0.79780569 ns 5 IW - CW - TW Simpson Kruskal-Wallis Rank Sum Test CW 0.80832094 0.90936106 ns
|
> t1$cal_diff(method = "anova")
Perform post hoc test with the method: duncan.test ...
The result is stored in object$res_diff ...
> t1$res_diff
Measure Test_method Group Letter
1 Observed anova IW a
2 Observed anova TW a
3 Observed anova CW a
4 Chao1 anova IW a
5 Chao1 anova TW ab
6 Chao1 anova CW b
7 ACE anova IW a
8 ACE anova TW b
9 ACE anova CW b
10 Shannon anova IW a
11 Shannon anova TW a
12 Shannon anova CW a
13 Simpson anova IW a
14 Simpson anova TW a
15 Simpson anova CW a
16 InvSimpson anova IW a
17 InvSimpson anova TW a
18 InvSimpson anova CW a
19 Fisher anova IW a
20 Fisher anova TW a
21 Fisher anova CW a
22 Pielou anova IW a
23 Pielou anova TW a
24 Pielou anova CW a
25 Coverage anova CW a
26 Coverage anova TW a
27 Coverage anova IW b
#现在,让我们绘制每个组的alpha多样性的平均值和se,并添加duncan。
> t1$plot_alpha(add_letter = T, measure = "Chao1", use_boxplot = FALSE)
> t1$plot_alpha(pair_compare = F, measure = "Chao1", shape = "Group")
今天,我发现一个很尴尬的问题,就是这个包更新了,兄弟以前的代码不能直接跑了。我尽量把它跑完。这些都是我跑完之后分享的,大家可以先跑。