生信益站,一点就有益
!祝友友们天天开心,月月发 CNS~
❝通路富集分析结果的解释常常因显著受影响的通路的压倒性和冗余列表而变得复杂。在这里,研究人员提出了一个 R 包aPEAR(高级通路富集分析表示),它利用通路基因集之间的相似性,并将它们表示为互连簇的网络。每个簇都被分配了一个有意义的名称,突出了实验中的主要生物学主题。他们的方法可以自动、客观地概述数据,而无需手动且耗时的参数调整。
安装最新稳定版本:
library(devtools)
install_github('ievaKer/aPEAR')
安装最新的测试版:
library(devtools)
install_github('ievaKer/aPEAR@development')
让我们首先用clusterProfiler
执行简单的基因集富集分析:
# Load all the packages:
library(data.table)
library(ggplot2)
library(dplyr)
library(stringr)
library(clusterProfiler)
library(DOSE)
library(org.Hs.eg.db)
library(aPEAR)
data(geneList)
# Perform enrichment using clusterProfiler
set.seed(42)
enrich <- gseGO(geneList, OrgDb = org.Hs.eg.db, ont = 'CC')
enrichmentNetwork
是 aPEAR 导出的最重要的函数。它检测相似通路的簇并生成ggplot2
可视化结果。它唯一要求您提供的是您的浓缩结果:
set.seed(654824)
enrichmentNetwork(enrich@result)
在内部,enrichmentNetwork
调用两个函数 findPathClusters
和 plotPathClusters
,这将在下面更详细地描述。
aPEAR 目前识别来自 clusterProfiler
和gProfileR
的输入。但是,如果您有自定义丰富输入,请不要担心!
aPEAR 接受任何类型的富集输入,只要格式正确即可,唯一的要求是每个通路的基因列表已知。您应该格式化数据,以便:
例如,您可以将数据格式化为如下形式:
enrichmentData[ 1:5 ]
#> Description pathwayGenes NES Size
#> 1: chromosome, centromeric region 55143/1062/10403/... 2.646268 188
#> 2: kinetochore 1062/10403/55355/... 2.630240 130
#> 3: condensed chromosome, centromeric region 1062/10403/55355/... 2.625070 138
#> 4: nuclear chromosome 8318/55388/7153/2... 2.582163 175
#> 5: chromosomal region 55143/1062/10403/... 2.544742 305
然后,告诉enrichmentNetwork
要做什么:
p <- enrichmentNetwork(enrichmentData, colorBy = 'NES', nodeSize = 'Size', verbose = TRUE)
#> Validating parameters...
#> Validating enrichment data...
#> Detected enrichment type custom
#> Calculating pathway similarity using method jaccard
#> Using Markov Cluster Algorithm to detect pathway clusters...
#> Clustering done
#> Using Pagerank algorithm to assign cluster titles...
#> Pagerank scores calculated
#> Creating the enrichment network visualization...
#> Validating theme parameters...
#> Preparing enrichment data for plotting...
#> Detected enrichment type custom
#> Creating the enrichment graph...
好消息:您可以使用 p 值给节点着色!只需指定colorBy
列和colorType = 'pval'
:
set.seed(348934)
enrichmentNetwork(enrich@result, colorBy = 'pvalue', colorType = 'pval', pCutoff = -5)
如果您的目标只是获得冗余通路的簇,那么函数findPathClusters
就是正确的选择。它接受data.frame
富集结果并返回通路簇和相似性矩阵的列表:
clusters <- findPathClusters(enrich@result, cluster = 'hier', minClusterSize = 6)
clusters$clusters[ 1:5 ]
#> Pathway Cluster
#> 1: mitotic spindle microtubule
#> 2: spindle microtubule
#> 3: midbody microtubule
#> 4: centrosome microtubule
#> 5: microtubule microtubule
pathways <- clusters$clusters[ 1:5, Pathway ]
clusters$similarity[ pathways, pathways ]
#> mitotic spindle spindle midbody centrosome microtubule
#> mitotic spindle 1.0000000 0.4090909 0.3142857 0.1940299 0.2857143
#> spindle 0.4090909 1.0000000 0.2686567 0.2659574 0.3793103
#> midbody 0.3142857 0.2686567 1.0000000 0.1428571 0.2586207
#> centrosome 0.1940299 0.2659574 0.1428571 1.0000000 0.1630435
#> microtubule 0.2857143 0.3793103 0.2586207 0.1630435 1.0000000
有关可用相似性度量、聚类方法、聚类命名约定和其他可用参数的更多信息,请参阅 ?aPEAR.theme
。
要可视化使用findPathClusters
获得的聚类结果,请使用以下函数 plotPathClusters
:
set.seed(238923)
plotPathClusters(
enrichment = enrich@result,
sim = clusters$similarity,
clusters = clusters$clusters,
fontSize = 4,
outerCutoff = 0.01, # Decrease cutoff between clusters and show some connections
drawEllipses = TRUE
)
更多参数选项,请参见?aPEAR.theme
。
aPEAR包是用 R 实现的,在 MIT 开源许可证下发布。源代码、文档和使用说明可在https://gitlab.com/vugene/aPEAR以及 CRAN ( https://CRAN.R-project.org/package=aPEAR ) 上获取。
OK,今天的分享到此为止。咱们明天见~
❝对
本篇文章有疑问
,或者有科研服务需求
的友友可以在益站发消息留言
,也欢迎各位童鞋扫下面的二维码
加入我们的
微信扫一扫
关注该公众号