Cytoscape繪制相關(guān)網(wǎng)絡(luò)圖

導(dǎo)讀

用R軟件corr.test函數(shù)進(jìn)行兩組數(shù)組的相關(guān)性分析,用Cytoscape繪制相關(guān)網(wǎng)絡(luò)圖。

一、輸入數(shù)據(jù)

代謝數(shù)據(jù):metabo.txt

示例數(shù)據(jù)

16S數(shù)據(jù):genus.txt

示例數(shù)據(jù)

二、R分析相關(guān)性

計(jì)算genus和metabo相關(guān)性

利用psych函數(shù)包中的corr.test函數(shù)計(jì)算兩組數(shù)據(jù)之間的相關(guān)性
參數(shù)說明:
pairwise: 樣品配對(duì)剔除
use: 相關(guān)性計(jì)算方法pearson/spearman/kendall
adjust: 矯正方法
ci & alpha: 置信區(qū)間
minlength: 縮寫長(zhǎng)度

# 加載函數(shù)包
library(psych)

# 數(shù)據(jù)導(dǎo)入
genus=read.table("genus.txt", row.names=1, header=T, sep="\t")
metabo=read.table("metabo.txt", row.names=1, header=T, sep="\t")

# 計(jì)算相關(guān)性: print & data.frame調(diào)整結(jié)果格式
result_pair=data.frame(print(corr.test(genus, metabo, use="pairwise", method="spearman", adjust="fdr", alpha=.05, ci=TRUE, minlength=10), short=FALSE))

# 查看結(jié)果
head(result_pair)

三、整理分析結(jié)果

pair=rownames(result_pair)  # 行名
result_pair2=data.frame(result_pair[, c(2, 4)], pair)  # 提取信息

# P值排序
result_pair3=data.frame(result_pair2[order(result_pair2[,"raw.p"], decreasing=F),])

# 統(tǒng)計(jì)顯著相關(guān)的數(shù)量
n=0
for(i in 1:nrow(result_pair3))
{
    if(result_pair3[i, 2]<=0.05)
    {
        n=n+1    
    }
}
# n=71

# 提取顯著相關(guān)結(jié)果
result_pair4=result_pair3[result_pair3$raw.p<=0.05, ]

# 保存提取的結(jié)果
write.table(result_pair4, file="corr.txt", sep="\t", row.names=F, quote=F)

查看結(jié)果:相關(guān)性大于在[-1, 1]之間,絕對(duì)值越接近1表示相關(guān)性越強(qiáng)

corr.txt

四、準(zhǔn)備Cytoscape輸入文件

相關(guān)數(shù)據(jù):input_network.txt

用vlookup把genus和keggID換成具體的名稱;正相關(guān)標(biāo)記為pos,負(fù)相關(guān)標(biāo)記為neg,r值去掉正負(fù)。

分組數(shù)據(jù):input_group.txt

五、Cytoscape數(shù)據(jù)導(dǎo)入

  • 1 打開cytoscape3.5.1
  • 2 點(diǎn)擊With Empty Network
  • 3 輸入network name,點(diǎn)擊OK
圖片.png
  • 4 導(dǎo)入相關(guān)數(shù)據(jù)
  • 5 以genus為source node,kegg為target,點(diǎn)擊OK
雛形
  • 6 導(dǎo)入分組文件:打開,OK

六、Cytoscape圖形設(shè)置

1 設(shè)置圖形大小、線條粗細(xì)

顯著相關(guān)越多,圖形越大;相關(guān)性越強(qiáng)線條越粗

選中所有點(diǎn)
依次點(diǎn)擊
依次點(diǎn)擊,X掉最后的窗口
依次點(diǎn)擊
依次選擇、點(diǎn)擊
搞定圖形大小、線條粗細(xì)

2 設(shè)置圖形顏色

3 設(shè)置線條顏色

七、保存結(jié)果

保存:整個(gè)工作

保存:pdf或png

結(jié)果示例

參考:
微生物研究必備:Cytoscape繪制網(wǎng)絡(luò)圖(一)
微生物研究必備:Cytoscape繪制網(wǎng)絡(luò)圖(二)
微生物研究必備:Cytoscape繪制網(wǎng)絡(luò)圖(三)
微生物研究必備:Cytoscape繪制網(wǎng)絡(luò)圖(四)
微生物研究必備:Cytoscape繪制網(wǎng)絡(luò)圖(五)

\color{green}{????原創(chuàng)文章,碼字不易,轉(zhuǎn)載請(qǐng)注明出處????}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容