在STRING数据库中提交基因,获取PPI网络是比力通例的操纵,包罗卑鄙利用cytoscape举行美化和hub网络的提取,但过程照旧比力贫苦,本期先容通过R语言来发掘STRING数据库
1. 效果展示
通过利用差异分析效果,利用STRINGdb包发掘卵白交互关系,利用visNetwork构建互作网络,并利用RPubs将网络上传至服务器,实现卵白互作网络的交互式可视化
2. 前期预备
2.1 R包
library(STRINGdb)library(visNetwork)2.2 差异分析效果
> head(diff_exp_example1) genes logFC logCPM PValue FDR1 CYP1A1 -9.900908 6.373327 6.248616e-10 8.596222e-062 CSF3 -10.224338 10.540303 4.759447e-09 3.273786e-053 IL1B -6.791297 7.881774 2.937997e-08 1.347267e-044 TNFSF13B 3.304202 5.305227 8.005570e-08 2.280509e-045 FOSB -5.449454 7.196261 8.288541e-08 2.280509e-046 PTGDS 3.771284 11.508825 2.298475e-07 5.270021e-042.3 备注
本期内容主要鉴戒了部分STRINGcb的教程:STRINGdb.pdf,内里也有很多其他功能,并未纳入进来,感爱好的朋侪可以看一下原文档~
3. 代码
将diffSig.xls放入file文件夹中,肯定包管列名序次划一
library(STRINGdb)library(visNetwork)string_db <- STRINGdb$new( version="11",# STRING版本 species=9606, # 物种 score_threshold=700, # 交互强度阈值,假如低于此阈值的关系将不被纳入 input_directory="./file") #可以设置,将数据库设置文件生存到本地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_mappednodes$type <- ifelse(nodes$logFC>0,"up","down")nodes$label <- nodes$genecolnames(nodes)[c(1,4,2,6,7,8)]<-c("gene", #genesymbol列 "pvalue", # P值列 "logFC", "id", # ENSP列 "group", # 上下调列 "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. 将交互网络上传至公共服务器
首先点击这个像眼睛一样的图标
我这里利用的是RPubs
然后跟着流程注册账号,设置网页名称即可~
原始project背景接洽获取
感谢观看,假如有效还请多多点赞,关注,在看,转发! |