美文网首页GSEA
[富集分析] 5、Gene Ontology(GO)、Disea

[富集分析] 5、Gene Ontology(GO)、Disea

作者: 小贝学生信 | 来源:发表于2021-10-22 16:17 被阅读0次

参考自:https://yulab-smu.top/biomedical-knowledge-mining-book/semantic-similarity-overview.html

1、背景

(1)两大语义数据库

  • GO, Gene Ontology 基因本体库,分为MF、CC、BP三类。可使用GO.db包获取数据;
  • DO,Disease Ontology 疾病本体库;与GO一样也是directed acyclic graph结构。

(2)Term 两两相似度分析方法

  • Information content-based methods:Resnik method、Lin method、Rel method、Jiang method
  • Graph-based method:Wang method

(3)Terms集之间相似度整合思路

  • max
  • avg
  • rcmax
  • BMA

2、GO相似度分析

  • GOSemSim
    分析之前,首先确定待分析GO TERM属于MF、CC、BP中的哪一类
library(GOSemSim)
hsGO <- godata('org.Hs.eg.db', ont="MF")

2.1 计算GO terms间相关性

  • goSim() between two GO terms
goSim("GO:0004022", "GO:0005515", semData=hsGO, measure="Jiang")
## [1] 0.16

goSim("GO:0004022", "GO:0005515", semData=hsGO, measure="Wang")
## [1] 0.116
  • mgoSim() between two sets of GO terms.
# combine=NULL 表示计算pair-wise相关性
go1 = c("GO:0004022","GO:0004024","GO:0004174")
go2 = c("GO:0009055","GO:0005515")
mgoSim(go1, go2, semData=hsGO, measure="Wang", combine=NULL)
##            GO:0009055 GO:0005515
## GO:0004022      0.368      0.116
## GO:0004024      0.335      0.107
## GO:0004174      0.663      0.119

# combine为"max", "avg", "rcmax", "BMA"四者之一,表示计算两个Term Set间的整体相似度
mgoSim(go1, go2, semData=hsGO, measure="Wang", combine="BMA")
## [1] 0.43

2.2 基于关联GO term计算基因的相似性

  • 例如基因A关联GO BP term有3个,基因B关联GO BP term有2个。基因A与B的相似性也就转换为前3个term与后2个term的整体相似性
  • geneSim()函数:单个基因两两间相似性
# 基因ID需与semData参数提供的基因ID类型保持一致
# hsGO2 <- godata('org.Hs.eg.db', keytype = "SYMBOL", ont="MF", computeIC=FALSE) 

GOSemSim::geneSim("241", "251", semData=hsGO, measure="Wang", combine="BMA")
## $geneSim
## [1] 0.149
## 
## $GO1
## [1] "GO:0004364" "GO:0004464" "GO:0004602" "GO:0005515" "GO:0047485"
## [6] "GO:0050544"
## 
## $GO2
## [1] "GO:0004035"

mgeneSim(genes=c("835", "5261","241", "994"),
         semData=hsGO, measure="Wang",verbose=FALSE)
##        835  5261   241   994
## 835  1.000 0.478 0.451 0.578
## 5261 0.478 1.000 0.433 0.499
## 241  0.451 0.433 1.000 0.452
## 994  0.578 0.499 0.452 1.000
  • clusterSim()函数:基因cluster间相似性
gs1 <- c("835", "5261","241", "994", "514", "533")
gs2 <- c("578","582", "400", "409", "411")
clusterSim(gs1, gs2, semData=hsGO, measure="Wang", combine="BMA")
## [1] 0.613

library(org.Hs.eg.db)
x <- org.Hs.egGO
hsEG <- mappedkeys(x)
set.seed <- 123
clusters <- list(a=sample(hsEG, 20), b=sample(hsEG, 20), c=sample(hsEG, 20))
mclusterSim(clusters, semData=hsGO, measure="Wang", combine="BMA")
##       a     b     c
## a 1.000 0.718 0.697
## b 0.718 1.000 0.720
## c 0.697 0.720 1.000

3、DO相似度分析

  • 整体分析思路同上;
  • 主要区别在于分析包DOSE内置了DO的数据,不需要单独准备了

3.1 DO term相似性

library(DOSE)

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(a[1], b[1], measure="Resnik")
## [1] 0

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

3.2 基于关联DO term计算基因的相似性

g1 <- c("84842", "2524", "10590", "3070", "91746")
g2 <- c("84289", "6045", "56999", "9869")

DOSE::geneSim(g1[1], g2[1], measure="Wang", combine="BMA")
## [1] 0.051

gs <- DOSE::geneSim(g1, g2, measure="Wang", combine="BMA")
gs
##       84289  6045 56999  9869
## 84842 0.051 0.135 0.355 0.103
## 2524  0.284 0.172 0.517 0.517
## 10590 0.150 0.173 0.242 0.262
## 3070  0.573 0.517 1.000 1.000
## 91746 0.351 0.308 0.527 0.496

DOSE::clusterSim(g1, g2, measure="Wang", combine="BMA")

g3 <- c("57491", "6296", "51438", "5504", "27319", "1643")
clusters <- list(a=g1, b=g2, c=g3)
DOSE::mclusterSim(clusters, measure="Wang", combine="BMA")

相关文章

网友评论

    本文标题:[富集分析] 5、Gene Ontology(GO)、Disea

    本文链接:https://www.haomeiwen.com/subject/cqthaltx.html