这个小插图演示了如何从数据库构建蛋白质-蛋白质相互作用(PPI)图stringDB.
其他网络也可以使用netSmooth.我们主要依赖stringDB中的网络。StringDB有多个可用的物种,如人,老鼠,斑马鱼,C.elengas而且D.melanogaster.也可以以不同的方式修剪网络。出于我们的目的,我们使用具有最高置信度分数的边。下面,我们将展示如何从stringDB中获取和删除human network。具体来说,我们使用下面的工作流程。
require(STRINGdb) require(igraph) require(biomaRt) # 1。human_graph <- string_db$ new(species=9606) human_graph <- string_db$get_graph() # 2获得边缘与高信心得分边缘。scores <- E(human_graph)$combined_score 90。百分位数<-分位数(edge。Scores, 0.9) thresh <- data.frame(name='90th percentile', val= 90s .percentile) human_graph <- subgraph. subgraph。边(human_graph, E(human_graph)[combined_score > 90 .percentile]) # 3。创建邻接矩阵adj_matrix <- as_adjacency_matrix(human_graph) # 4。将基因id映射到蛋白质id ###获取基因/蛋白质id通过Biomart mart=useMart(host =' grch37.ensembl.org', Biomart ='ENSEMBL_MART_ENSEMBL', dataset='hsapiens_gene_ensembl') ###从人类网络中提取蛋白质id protein_ids <- sapply(strsplit(rownames(adj_matrix), '\\.'), function(x) x[2]) ###获取蛋白质到基因id映射mart_results <- getBM(attributes = c("ensembl_gene_id", "ensembl_peptide_id"), filters = "ensembl_peptide_id", values = protein_ids,mart = mart) ###用基因id替换蛋白质id ix <- match(protein_ids, mart_results$ensembl_peptide_id) ix <- ix[!is.na(ix)] newnames <- protein_ids newnames[match(mart_results[ix,'ensembl_peptide_id'], newnames)] <- mart_results[ix,' ensembl_gene_id'] rownames(adj_matrix) <- newnames colnames(adj_matrix) <- newnames ppi <- adj_matrix[!duplicate (newnames), !duplicate (newnames)] nullrows <- Matrix:: rowsum (ppi)==0 ppi <- ppi[!nullrows,!## ppi是带有基因id的网络
sessionInfo ()
## R版本4.2.0 RC (2022-04-19 r82224) ##平台:x86_64-pc-linux-gnu(64位)##运行在Ubuntu 20.04.4 LTS ## ##矩阵产品:默认## BLAS: /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas。/home/biocbuild/bbs-3.15-bioc/R/lib/libRlapack。所以## ## locale: ## [1] LC_CTYPE=en_US。UTF-8 LC_NUMERIC= c# # [3] LC_TIME=en_GB LC_COLLATE= c# # [5] LC_MONETARY=en_US。utf - 8 LC_MESSAGES = en_US。UTF-8 ## [7] LC_PAPER=en_US。UTF-8 LC_NAME= c# # [9] LC_ADDRESS=C lc_phone = c# # [11] LC_MEASUREMENT=en_US。UTF-8 LC_IDENTIFICATION=C ## ##附加的基本包:## [1]stats graphics grDevices utils datasets methods基础## ##其他附加包:## [1]BiocStyle_2.24.0 ## ##通过命名空间加载(且未附加):## [1] bookdown_0.26 digest_0.6.29 knitr_1.38 ## [4] jsonlite_1.8.0 magrittr_2.0.3 evaluate_0.15 ## [7] stringi_1.7.6 rlang_1.0.2 cli_3.3.0 ## [7] jquerylib_0.1.4 bslib_0.3.1 rmarkdown_2.14 ## [13] tools_4.2.0 string_1 .4.0 xfun_0.30 ## [19] yaml_2.3.5 fastmap_1.1.0 compiler_4.2.0 ## [19] BiocManager_1.30.17 htmltools_0.5.2 knitr_1.38 ## [22] sass_0.4.1