R语言:microeco:一个用于微生物群落生态学数据挖掘的R包,第三,trans_venn class和trans_alpha class

这次我们分享,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")

今天,我发现一个很尴尬的问题,就是这个包更新了,兄弟以前的代码不能直接跑了。我尽量把它跑完。这些都是我跑完之后分享的,大家可以先跑。

相关推荐
newroad-for-myself11 分钟前
英文版本-带EXCEL函数的数据分析
数据挖掘·数据分析·excel
rubyw1 小时前
如何选择聚类算法、回归算法、分类算法?
算法·机器学习·分类·数据挖掘·回归·聚类
sp_fyf_20242 小时前
计算机前沿技术-人工智能算法-大语言模型-最新研究进展-2024-11-05
人工智能·深度学习·神经网络·算法·机器学习·语言模型·数据挖掘
dundunmm2 小时前
论文阅读:A fast, scalable and versatile tool for analysis of single-cell omics data
论文阅读·数据挖掘·单细胞数据·单细胞多组学数据·细胞聚类
dundunmm2 小时前
论文阅读:SIMBA: single-cell embedding along with features
论文阅读·人工智能·数据挖掘·embedding·生物信息·多组学细胞数据·单组学
WeeJot嵌入式4 小时前
线性代数与数据挖掘:人工智能中的核心工具
人工智能·线性代数·数据挖掘
kylin王国5 小时前
R语言p值矫正整的方法
开发语言·r语言·p值
HPC_fac130520678167 小时前
科研深度学习:如何精选GPU以优化服务器性能
服务器·人工智能·深度学习·神经网络·机器学习·数据挖掘·gpu算力
xiaoyalian12 小时前
R语言绘图过程中遇到图例的图块中出现字符“a“的解决方法
笔记·r语言·数据可视化
weixin_4662027812 小时前
第31周:天气识别(Tensorflow实战第三周)
分类·数据挖掘·tensorflow