【R>>DOSE】疾病本体语义相似性及富集分析

2021-07-06  本文已影响0人  高大石头

Disease ontology (DO)疾病本体论是从疾病的角度对基因进行注释。DO对于从高通量测序结果到临床的对应关系的转换非常重要。DOSE包提供DO terms和基因的语义相似性分析,这些为生物学家探索疾病和基因功能的相似性提供了更大的可能。富集分析包括超几何分布和GSEA分析。

下面就来大致学习下DOSE包

DOSE提供5种基因语义相似性评价方法,两种富集分析方法:超几何分布和GSEA,以及疾病和基因集之间的比较方法。

1.语义相似性检测

1.1 doSim()

在DOSE中,用doSim来计算两个DO terms和两个 set of DO terms的语义相似性

rm(list = ls())
library(DOSE)
library(clusterProfiler)
a <- c("DOID:14095", "DOID:5844", "DOID:2044", "DOID:8432", "DOID:9146",
       "DOID:10588", "DOID:3209", "DOID:848", "DOID:3341", "DOID:252")
b <- c("DOID:9409", "DOID:2491", "DOID:4467", "DOID:3498", "DOID:11256")
doSim(a[1],b[1],measure = "Wang")
## [1] 0.07142995

doSim() measure共有5种方法,“Wang”, “Resnik”, “Rel”, “Jiang”, and “Lin”.

s <- doSim(a,b,measure = "Wang")
s
##             DOID:9409  DOID:2491  DOID:4467  DOID:3498 DOID:11256
## DOID:14095 0.07142995 0.05714393 0.03676194 0.03676194 0.52749870
## DOID:5844  0.14897652 0.11564838 0.02801328 0.02801328 0.06134327
## DOID:2044  0.14897652 0.11564838 0.02801328 0.02801328 0.06134327
## DOID:8432  0.17347273 0.13877811 0.03676194 0.03676194 0.07142995
## DOID:9146  0.07142995 0.05714393 0.03676194 0.03676194 0.17347273
## DOID:10588 0.13240905 0.18401515 0.02208240 0.02208240 0.05452137
## DOID:3209  0.14897652 0.11564838 0.02801328 0.02801328 0.06134327
## DOID:848   0.14897652 0.11564838 0.02801328 0.02801328 0.06134327
## DOID:3341  0.13240905 0.09998997 0.02208240 0.02208240 0.05452137
## DOID:252   0.06134327 0.04761992 0.02801328 0.02801328 0.06134327
# 语义相似性结果可视化
simplot(s,
        color.low = "white",color.high = "red",
        labs = TRUE,digits = 2,labs.size = 5,
        font.size = 14,xlab = "",ylab = "")

1.2 geneSim()

DOSE还可以计算基因之间的相似性,有max, avg, rcmaxBMA多种合并方法。

g1 <- c("84842", "2524", "10590", "3070", "91746")
g2 <- c("84289", "6045", "56999", "9869")
gs <- geneSim(g1,g2,measure = "Wang",combine = "BMA")

simplot(gs,
        color.low = "white",color.high = "red",
        labs = TRUE,digits = 2,labs.size = 5,
        font.size = 14,xlab = "",ylab = "")

1.3 clusterSim()

clusterSim()比较两个基因集间的语义相似性,mclusterSim()比较多个基因集间的语义相似性。

clusterSim(g1,g2,measure = "Wang",combine = "BMA")
## [1] 0.549
g3 <- c("57491", "6296", "51438", "5504", "27319", "1643")
clusters <- list(a=g1,b=g2,c=g3)
mclusterSim(clusters,measure = "Wang",combine = "BMA")
##       a     b     c
## a 1.000 0.549 0.425
## b 0.549 1.000 0.645
## c 0.425 0.645 1.000

2.疾病-基因相关性网络

data(geneList,package = "DOSE")
gene <- names(geneList)[abs(geneList)>1]
x <- enrichDO(gene,ont="DO",
              pvalueCutoff = 0.05,
              pAdjustMethod = "BH",
              universe = names(geneList),
              minGSSize = 5,
              readable = T)
cnetplot(x,categorySize="pvalue",foldChange = geneList)
barplot(x,showCategory = 10)

以上是超几何分布检验分析的结果,下面进行GSEA富集分析

y <- gseDO(geneList,
           minGSSize= 120,
           pvalueCutoff=0.2,
           pAdjustMethod = "BH",
           verbose = F)
library(enrichplot)
gseaplot2(y,1:4,pvalue_table = T)

3.彩蛋

Y叔在DOSE里自定义了theme_dose()主题,还是比较符合论文发表需求的,与ggsci的配色交叉使用会有不一样的感觉吆。

library(ggsci)
ggplot(x,aes(Count/810,fct_reorder(Description,Count)))+
  geom_segment(aes(xend=0,yend=Description))+
  geom_point(aes(size=Count,color=-log10(p.adjust)))+
  scale_color_gsea()+
  theme_dose(12)+
  labs(x="",y="")

参考链接:

1.DOSE: Disease Ontology Semantic and Enrichment analysis

2.Biomedical Knowledge Mining using GOSemSim and clusterProfiler

上一篇下一篇

猜你喜欢

热点阅读