在STRING數(shù)據(jù)庫(kù)中提交基因运准,獲取PPI網(wǎng)絡(luò)是比較常規(guī)的操作铭乾,包括下游使用cytoscape進(jìn)行美化和hub網(wǎng)絡(luò)的提取吉拳,但過(guò)程還是比較麻煩,本期介紹通過(guò)R語(yǔ)言來(lái)挖掘STRING數(shù)據(jù)庫(kù)
1. 效果展示
通過(guò)利用差異分析結(jié)果烈疚,使用STRINGdb
包挖掘蛋白交互關(guān)系黔牵,使用visNetwork
構(gòu)建互作網(wǎng)絡(luò)俏扩,并利用RPubs
將網(wǎng)絡(luò)上傳至服務(wù)器辑舷,實(shí)現(xiàn)蛋白互作網(wǎng)絡(luò)的交互式可視化
2. 前期準(zhǔn)備
2.1 R包
library(STRINGdb)
library(visNetwork)
2.2 差異分析結(jié)果
> head(diff_exp_example1)
genes logFC logCPM PValue FDR
1 CYP1A1 -9.900908 6.373327 6.248616e-10 8.596222e-06
2 CSF3 -10.224338 10.540303 4.759447e-09 3.273786e-05
3 IL1B -6.791297 7.881774 2.937997e-08 1.347267e-04
4 TNFSF13B 3.304202 5.305227 8.005570e-08 2.280509e-04
5 FOSB -5.449454 7.196261 8.288541e-08 2.280509e-04
6 PTGDS 3.771284 11.508825 2.298475e-07 5.270021e-04
2.3 備注
本期內(nèi)容主要借鑒了部分STRINGcb
的教程:STRINGdb.pdf,里面也有很多其他功能魄揉,并未納入進(jìn)來(lái)灯抛,感興趣的朋友可以看一下原文檔~
3. 代碼
將diffSig.xls
放入file
文件夾中金赦,一定保證列名順序一致
library(STRINGdb)
library(visNetwork)
string_db <- STRINGdb$new( version="11",# STRING版本
species=9606, # 物種
score_threshold=700, # 交互強(qiáng)度閾值,如果低于此閾值的關(guān)系將不被納入
input_directory="./file") #可以設(shè)置对嚼,將數(shù)據(jù)庫(kù)配置文件保存到本地
diff_exp_example1<-read.table("./file/diffSig.xls", #輸入文件
sep = "\t",header = T)
example1_mapped <- string_db$map(diff_exp_example1,
"genes",#gene列列名
removeUnmappedRows = TRUE )
inter_raw<-string_db$get_interactions(example1_mapped$STRING_id)
plot_data<-merge(inter_raw,example1_mapped,by.x = "from",by.y = "STRING_id")
edges <- plot_data[,c(1:2)]
nodes <- example1_mapped
nodes$type <- ifelse(nodes$logFC>0,"up","down")
nodes$label <- nodes$gene
colnames(nodes)[c(1,4,2,6,7,8)]<-c("gene", #genesymbol列
"pvalue", # P值列
"logFC",
"id", # ENSP列
"group", # 上下調(diào)列
"label") # genesymbol列
nodes <- nodes[nodes$id%in%c(edges$from,edges$to),]
visNetwork(nodes, edges) %>%
visIgraphLayout()%>%
# darkblue square with shadow for group "A"
visGroups(groupname = "down", color = "#034889", shape = "square",
shadow = list(enabled = TRUE)) %>%
# red triangle for group "B"
visGroups(groupname = "up", color = "#af002b", shape = "triangle")%>%
visLegend()%>%
visNodes(font=list(size = 50))%>%
visEdges(
shadow = FALSE,
color = list(color = "#0085AF", highlight = "#C62F4B")
) %>%
visOptions(highlightNearest = list(enabled = T, degree = 1, hover = T),
selectedBy = "group") %>%
visLayout(randomSeed = 123)%>%
visEdges(arrows = 'from')%>%
visInteraction(navigationButtons = TRUE)
4. 將交互網(wǎng)絡(luò)上傳至公共服務(wù)器
首先點(diǎn)擊這個(gè)像眼睛一樣的圖標(biāo)
我這里使用的是RPubs
然后跟著流程注冊(cè)賬號(hào)夹抗,設(shè)置網(wǎng)頁(yè)名稱(chēng)即可~
原始project后臺(tái)聯(lián)系獲取
感謝觀看,如果有用還請(qǐng)多多點(diǎn)贊纵竖,關(guān)注漠烧,在看杏愤,轉(zhuǎn)發(fā)!