溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

perl怎么分析相關(guān)性網(wǎng)絡(luò)節(jié)點(diǎn)度

發(fā)布時(shí)間:2022-05-27 15:29:05 來(lái)源:億速云 閱讀:147 作者:iii 欄目:大數(shù)據(jù)

這篇文章主要介紹“perl怎么分析相關(guān)性網(wǎng)絡(luò)節(jié)點(diǎn)度”的相關(guān)知識(shí),小編通過(guò)實(shí)際案例向大家展示操作過(guò)程,操作方法簡(jiǎn)單快捷,實(shí)用性強(qiáng),希望這篇“perl怎么分析相關(guān)性網(wǎng)絡(luò)節(jié)點(diǎn)度”文章能幫助大家解決問(wèn)題。

以相關(guān)網(wǎng)絡(luò)為例進(jìn)行分析:
#計(jì)算節(jié)點(diǎn)度diag(rcorr)=0degree=numeric(ncol(rcorr))for (i in 1:ncol(rcorr)) {  degree[i]=length(which(rcorr[i,]!=0))}#計(jì)算度中心性centdeg=degree/(ncol(rcorr)-1)nodedata=data.frame(degree, centdeg, row.names=rownames(rcorr))nodedata=nodedata[order(nodedata[,2],decreasing=TRUE),]#節(jié)點(diǎn)度分布圖library(ggplot2)ggplot(nodedata, aes(x=degree)) +   geom_histogram(position='identity', alpha=0.5, fill="cyan", binwidth=1, aes(y=..density..)) +  stat_density(geom='line', position='identity', col="cyan4") +  xlab("Node Degree") + ylab("Density")

此外,可以直接使用函數(shù)計(jì)算節(jié)點(diǎn)度等指標(biāo):

degree(g)#計(jì)算節(jié)點(diǎn)度

closeness(g)#計(jì)算接近度中心性

betweenness(g)#中介系數(shù)中心性

evcent(g)#計(jì)算特征向量中心性

節(jié)點(diǎn)度分布圖是不同節(jié)點(diǎn)度范圍內(nèi)的節(jié)點(diǎn)數(shù)目統(tǒng)計(jì)情況,可以反映網(wǎng)絡(luò)的異質(zhì)性,也即節(jié)點(diǎn)之間的連接狀況是否均勻,理論上高關(guān)聯(lián)度節(jié)點(diǎn)越多網(wǎng)絡(luò)結(jié)構(gòu)越復(fù)雜,做圖結(jié)果如下所示:

perl怎么分析相關(guān)性網(wǎng)絡(luò)節(jié)點(diǎn)度

接下來(lái)我們可以篩選出度中心性高的節(jié)點(diǎn),來(lái)看那些物種或者環(huán)境因子在相關(guān)性網(wǎng)絡(luò)中的影響較大:

#節(jié)點(diǎn)度中心性條形圖nodedata=nodedata[1:20, ]ggplot(nodedata, aes(x=factor(rownames(nodedata), levels=rev(rownames(nodedata))), y=centdeg)) +   geom_bar(stat="identity", fill="cyan", alpha=0.6) +   xlab("Node") + ylab("Node degree centrality") + coord_flip()

做圖結(jié)果如下所示:

perl怎么分析相關(guān)性網(wǎng)絡(luò)節(jié)點(diǎn)度

接下來(lái),我們可以篩選受環(huán)境因子直接影響(相關(guān)系數(shù)之和不為0)的物種,并提取其相對(duì)豐度信息以便進(jìn)行比較分析:

#提取篩選環(huán)境因子與物種相關(guān)性envcor=rcorr[1:m, (m+1):(m+n)]sumcor=numeric(m)for (i in 1:m) {  sumcor[i]=sum(abs(envcor[i,]))}ecocor=data.frame(cbind(envcor, sumcor))ecocor=ecocor[order(abs(ecocor$sumcor), decreasing=TRUE),]abund=numeric(m)for (i in 1:m) {  abund[i]=100*mean(com[, i])}names(abund)=colnames(com)abundance=abund[rownames(ecocor)]cordata=data.frame(ecocor, abundance)cordata=cordata[cordata$sumcor!=0,]write.csv(cordata, file="cordata.csv", row.names=TRUE, quote=FALSE)

經(jīng)整理結(jié)果如下所示:

perl怎么分析相關(guān)性網(wǎng)絡(luò)節(jié)點(diǎn)度

關(guān)于“perl怎么分析相關(guān)性網(wǎng)絡(luò)節(jié)點(diǎn)度”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí),可以關(guān)注億速云行業(yè)資訊頻道,小編每天都會(huì)為大家更新不同的知識(shí)點(diǎn)。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI