這篇文章給大家分享的是有關怎么用R包STRINGdb來進行蛋白互作網絡分析的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
采用R包STRINGdb 來進行蛋白互作網絡分析
差異分析完成之后,可以做一個蛋白互作網絡分析,看看差異蛋白只能有那些基因間存在相互作用。
實現這樣的目標,方法有多種。一般比較常見的是采用STRING 這個網站,在網站上分析。其實采用R包STRINGdb也可以實現。代碼參考如下:
############################################################ # 安裝STRINGdb 軟件包 # source("https://bioconductor.org/biocLite.R") # biocLite("STRINGdb") ############################################################ library(STRINGdb) # 設置程序參數 work_dir <- "/Users/zhangqiuxue/Documents/Train/TCGA/lab/PPI" deg_file <- "/Users/zhangqiuxue/Documents/Train/TCGA/lab/DEG/DE_genes.txt" setwd(work_dir) # 獲取物種的分類編號 # get_STRING_species(version="10", species_name=NULL) # 9606 代表人類 string_db <- STRINGdb$new(version="10", species=9606, score_threshold=700, input_directory= work_dir) # 讀取差異表達的文件,獲得差異表達基因列表 degs = read.table(deg_file,header=T,comment.char = "",check.names=F) degs$gene <- rownames(degs) head(degs) # 查看有多少差異表達的基因需要分析 cat("Total deg genes:", dim(degs)[1]) # 將基因的ID map 到string 數據庫中, 不一定每個基因都能map上 deg_mapped <- string_db$map( degs, "gene", removeUnmappedRows = TRUE ) # 查看有多少ID map 上了 cat("Total String id mapped :", dim(deg_mapped)[1]) # 設置繪圖相關的參數 options(SweaveHooks=list(fig=function() par(mar=c(2.1, 0.1, 4.1, 2.1)))) # 篩選出一部分結果,進行繪圖 hits <- deg_mapped$STRING_id[1000] # 繪圖 string_db$plot_network( hits,required_score =700) # 將所有的結果輸出到文件,后面采用cytoscape 進行網絡分析 info <- string_db$get_interactions(deg_mapped$STRING_id) write.table(info, file = "STRING_info.txt",sep="\t", row.names =F, quote = F) # 采用igraph 進行聚類分析 clustersList <- string_db$get_clusters(deg_mapped$STRING_id) # 設置繪圖參數 options(SweaveHooks=list(fig=function() par(mar=c(2.1, 0.1, 4.1, 2.1)))) # 繪制前4個聚類圖 par(mfrow=c(2,2)) for(i in seq(1:4)){ string_db$plot_network(clustersList[[i]]) }
感謝各位的閱讀!關于“怎么用R包STRINGdb來進行蛋白互作網絡分析”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。