1、介绍
NetCoMi是一个微生物数据的网络构建和比较的R包,集成了单个可重复计算工作流中每个分析步骤的现有方法。该软件包提供了构建和分析单一微生物关联网络以及量化网络差异的功能。NetCoMi还包含了构建差异网络的功能,从而允许评估两个组之间的单对类群是否有差异关联。此外,NetCoMi促进了微生物组样本不同网络的构建和分析,使整个微生物组样本收集的异质性的高层次图形总结成为可能。
2、安装包
2.1 安装并载入"NetCoMi"包
install.packages("devtools")devtools::install_github("stefpeschel/NetCoMi", dependencies=TRUE,repos=c("https://cloud.r-project.org/", BiocManager::repositories()))library("NetCoMi")
2.2 安装并载入"SpiecEasi"包,并加载数据
install.packages("SpiecEasi")library("SpiecEasi")data("amgut1.filt")data("amgut2.filt.phy")
3、以SPRING作为关联度量的单一网络
3.1 网络构建与分析
net_single <- netConstruct(amgut1.filt, filtTax="highestFreq",filtTaxPar=list(highestFreq = 100), filtSamp="totalReads",filtSampPar=list(totalReads = 1000), measure="spring",measurePar=list(nlambda=10,rep.num=10), normMethod="none",zeroMethod="none", sparsMethod="none",dissFunc="signed", verbose=3, seed=123456)
3.2 分析构建的网络
props_single <- netAnalyze(net_single, centrLCC=TRUE,clustMethod="cluster_fast_greedy", hubPar="eigenvector",weightDeg=FALSE, normDeg=FALSE)
3.3 可视化网络
png("图1.png")plot(props_single, nodeColor="cluster", nodeSize="eigenvector",title1="Network on OTU level with SPRING associations",showTitle=TRUE, cexTitle=2.3)legend(0.7, 1.1, cex=2.2, title="estimated association:",legend=c("+","-"), lty=1, lwd=3, col=c("#009900","red"),bty="n", horiz=TRUE)dev.off()
4、以Pearson correlation作为关联度量的单一网络
4.1 网络构建与分析
net_single2 <- netConstruct(amgut2.filt.phy, measure="pearson",normMethod="clr", zeroMethod="multRepl",sparsMethod="threshold", thresh=0.3, verbose=3)
4.2 分析构建的网络
props_single2 <- netAnalyze(net_single2, clustMethod="cluster_fast_greedy")
4.3 可视化网络
png("图2.png")plot(props_single2, nodeColor="cluster", nodeSize="eigenvector",title1="Network on OTU level with Pearson correlations",showTitle=TRUE, cexTitle=2.3)legend(0.7, 1.1, cex=2.2, title="estimated correlation:",legend=c("+","-"), lty=1, lwd=3, col=c("#009900","red"),bty="n", horiz=TRUE)dev.off()
4.4 调整参数可视化网络
png("图3.png")plot(props_single2, nodeColor="cluster", nodeSize="eigenvector",repulsion=0.8, rmSingles=TRUE, labelScale=FALSE,cexLabels=1.6, nodeSizeSpread=3, cexNodes=2,title1="Network on OTU level with Pearson correlations",showTitle=TRUE, cexTitle=2.3)legend(0.7, 1.1, cex=2.2, title="estimated correlation:",legend=c("+","-"), lty=1, lwd=3, col=c("#009900","red"),bty="n", horiz=TRUE)dev.off()
今天的分享就到这里啦,对上述分析方法感兴趣或者没有研究思路的小伙伴,欢迎前来咨询哦!
中科生信
微信公众号 | 中科生信
提供“一站式”科研服务

