? ? ? ?蛋白質(zhì)-蛋白質(zhì)相互作用(protein-protein interaction, PPI)是指兩個(gè)或兩個(gè)以上的蛋白質(zhì)分子通過非共價(jià)鍵形成蛋白質(zhì)復(fù)合體(protein complex)的過程鱼炒。在進(jìn)行數(shù)據(jù)挖掘的時(shí)候往往會(huì)得到很多的差異表達(dá)的基因锣咒,當(dāng)你對(duì)著一堆基因毫無頭緒時(shí)浙宜,此時(shí)PPI數(shù)據(jù)庫對(duì)你的數(shù)據(jù)挖掘起了很大的助攻作用。
? ? ? ?接下來沫勿,跟著小編一起來學(xué)習(xí)下PPI分析吧!文中附詳細(xì)代碼刻帚,小伙伴們可以使用自己項(xiàng)目數(shù)據(jù)砖顷,一步步復(fù)現(xiàn)下結(jié)果草雕!
1? PPI分析的意義
? ? ? ?系統(tǒng)分析大量蛋白在生物系統(tǒng)中的相互作用關(guān)系巷屿,對(duì)了解生物系統(tǒng)中蛋白質(zhì)的工作原理,了解疾病等特殊生理狀態(tài)下生物信號(hào)和能量物質(zhì)代謝的反應(yīng)機(jī)制墩虹,以及了解蛋白之間的功能聯(lián)系都有重要意義嘱巾。在生物醫(yī)藥領(lǐng)域有助于從系統(tǒng)的角度研究疾病分子機(jī)制、發(fā)現(xiàn)新藥靶點(diǎn)等等诫钓。
? ? ? ?接下來旬昭,小編具體講解下基于STRING數(shù)據(jù)庫,提取目標(biāo)基因集的互作關(guān)系尖坤,構(gòu)建蛋白互作關(guān)系稳懒,同時(shí)利用igraph和ggraph對(duì)互作網(wǎng)絡(luò)進(jìn)行可視化闲擦。對(duì)于數(shù)據(jù)庫中未收錄信息的物種慢味,可以使用BLAST軟件,將目的基因與數(shù)據(jù)庫中的蛋白質(zhì)進(jìn)行序列比對(duì)墅冷,尋找同源蛋白纯路,根據(jù)同源蛋白的互作關(guān)系對(duì)構(gòu)建互作網(wǎng)絡(luò)。構(gòu)建完成的蛋白質(zhì)互作網(wǎng)絡(luò)大家也可嘗試導(dǎo)入Cytoscape軟件進(jìn)行可視化寞忿。
2? 創(chuàng)建STRINGdb對(duì)象
library(tidyverse)
library(clusterProfiler)
library(org.Hs.eg.db) ?小鼠的話驰唬,把Hs改成Mm
library(STRINGdb)
library(igraph)
library(ggraph)
# 創(chuàng)建STRINGdb對(duì)象
string_db <- STRINGdb$new( version="11", species=9606,
? ? ? ? ? ? ? ? ? ? ? ? ? score_threshold=400, input_directory="")
#score_threshold是蛋白互作的得分,此值會(huì)用于篩選互作結(jié)果,400是默認(rèn)分值叫编,如果要求嚴(yán)格可以調(diào)高此值辖佣。
3? 構(gòu)建基因列表
#clusterProfiler將Gene Symbol轉(zhuǎn)換為Entrez ID,構(gòu)建基因列表搓逾,可以自己定義值卷谈,也可以導(dǎo)入表格,需要表頭
gene <- gene %>% bitr(fromType = "SYMBOL",
? ? ? ? ? ? ? ? ? ? ? toType = "ENTREZID",
? ? ? ? ? ? ? ? ? ? ? OrgDb = "org.Hs.eg.db",
? ? ? ? ? ? ? ? ? ? ? drop = T)
4? 使用map函數(shù)將基因匹配到STRING數(shù)據(jù)庫的ID
data_mapped <- gene %>% string_db$map(my_data_frame_id_col_names = "ENTREZID",
? ? ? ? ? ? ? ?removeUnmappedRows = TRUE)
string_db$plot_network( data_mapped$STRING_id )
5? get_interactions獲取蛋白互作信息霞篡,以用于后續(xù)可視化
hit<-data_mapped$STRING_id
info <- string_db$get_interactions(hit)
#info包含了蛋白互作的信息世蔗,比較重要的是前兩列和最后一列:from、to朗兵、combined_score污淋,前兩列指定了蛋白互作關(guān)系的基因?qū)Γ詈笠涣惺谴说鞍谆プ麝P(guān)系的得分余掖,info數(shù)據(jù)將用于后續(xù)分析寸爆。
6? igraph和ggraph可視化蛋白互作網(wǎng)絡(luò)圖
# 轉(zhuǎn)換stringID為Symbol,只取前兩列和最后一列
links <- info %>%
?mutate(from = data_mapped[match(from, data_mapped$STRING_id), "SYMBOL"]) %>%
?mutate(to = data_mapped[match(to, data_mapped$STRING_id), "SYMBOL"]) %>% ?
?dplyr::select(from, to , last_col()) %>%
?dplyr::rename(weight = combined_score)
# 節(jié)點(diǎn)數(shù)據(jù)
nodes <- links %>% { data.frame(gene = c(.$from, .$to)) } %>% distinct()
# 創(chuàng)建網(wǎng)絡(luò)圖
# 根據(jù)links和nodes創(chuàng)建
net <- igraph::graph_from_data_frame(d=links,vertices=nodes,directed = F)
# 添加一些參數(shù)信息用于后續(xù)繪圖
# V和E是igraph包的函數(shù)盐欺,分別用于修改網(wǎng)絡(luò)圖的節(jié)點(diǎn)(nodes)和連線(links)
igraph::V(net)$deg <- igraph::degree(net) # 每個(gè)節(jié)點(diǎn)連接的節(jié)點(diǎn)數(shù)
igraph::V(net)$size <- igraph::degree(net)/5 #
igraph::E(net)$width <- igraph::E(net)$weight/10
# 使用ggraph繪圖
# ggraph是基于ggplot2的包而昨,語法和常規(guī)ggplot2類似
ggraph(net,layout = "kk")+
?geom_edge_fan(aes(edge_width=width), color = "lightblue", show.legend = F)+
?geom_node_point(aes(size=size), color="orange", alpha=0.7)+
?geom_node_text(aes(filter=deg>5, label=name), size = 5, repel = T)+
?scale_edge_width(range = c(0.2,1))+
?scale_size_continuous(range = c(1,10) )+
?guides(size=F)+
?theme_graph()
?#stress布局作圖
?ggraph(net,layout = "stress")+ #不同的地方
?geom_edge_fan(aes(edge_width=width), color = "lightblue", show.legend = F)+
?geom_node_point(aes(size=size), color="orange", alpha=0.7)+
?geom_node_text(aes(filter=deg>5, label=name), size = 5, repel = T)+
?scale_edge_width(range = c(0.2,1))+
?scale_size_continuous(range = c(1,10) )+
?guides(size=F)+
?theme_graph() ?
?#環(huán)形布局 ? ?
?ggraph(net,layout = "linear", circular = TRUE)+
?geom_edge_fan(aes(edge_width=width), color = "lightblue", show.legend = F)+
?geom_node_point(aes(size=size), color="orange", alpha=0.7)+
?geom_node_text(aes(filter=deg>5, label=name), size = 5, repel = F)+
?scale_edge_width(range = c(0.2,1))+
?scale_size_continuous(range = c(1,10) )+
?guides(size=F)+
?theme_graph()
# 去除游離的互作關(guān)系:其和主網(wǎng)絡(luò)并不相連,像這種互作關(guān)系可以去掉找田,此時(shí)出來的圖就會(huì)更加美觀歌憨。
# 如果links數(shù)據(jù)框的一個(gè)link的from只出現(xiàn)過一次,同時(shí)to也只出現(xiàn)一次墩衙,則將其去除
links_2 <- links %>% mutate(from_c = count(., from)$n[match(from, count(., from)$from)]) %>%
?mutate(to_c = count(., to)$n[match(to, count(., to)$to)]) %>%
?filter(!(from_c == 1 & to_c == 1)) %>%
?dplyr::select(1,2,3)
# 新的節(jié)點(diǎn)數(shù)據(jù)
nodes_2 <- links_2 %>% { data.frame(gene = c(.$from, .$to)) } %>% distinct()
# 創(chuàng)建網(wǎng)絡(luò)圖
net_2 <- igraph::graph_from_data_frame(d=links_2,vertices=nodes_2,directed = F)
# 添加必要的參數(shù)
igraph::V(net_2)$deg <- igraph::degree(net_2)
igraph::V(net_2)$size <- igraph::degree(net_2)/5
igraph::E(net_2)$width <- igraph::E(net_2)$weight/10
#如果去除了游離的互作關(guān)系务嫡,那么可以使用一種中心布局的方式,它是根據(jù)一個(gè)節(jié)點(diǎn)的連接數(shù)而排列其位置漆改,連接數(shù)越大心铃,節(jié)點(diǎn)越傾向于在中間位置排列,會(huì)更容易看得出重要節(jié)點(diǎn)挫剑。另外環(huán)形布局的線使用弧形線(geom_edge_arc)會(huì)更美觀:
ggraph(net,layout = "linear", circular = TRUE)+
?geom_edge_arc(aes(edge_width=width), color = "lightblue", show.legend = F)+
?geom_node_point(aes(size=size), color="orange", alpha=0.7)+
?geom_node_text(aes(filter=deg>5, label=name), size = 5, repel = F)+
?scale_edge_width(range = c(0.2,1))+
?scale_size_continuous(range = c(1,10) )+
?guides(size=F)+
?theme_graph()
combined_score 互作得分去扣,<400?低可信,400~700?中可信樊破,>700?高可信愉棱。