jamesbang

V1

2023/03/02阅读：12主题：雁栖湖

# 🤒 simplifyEnrichment | 让我来做你的富集结果的瘦身教练吧！~

## 2用到的包

``library(tidyverse)library(simplifyEnrichment)``

## 3示例数据

``set.seed(111)go_id <-  random_GO(500)head(go_id)``

## 4给GO瘦个身

``mat <-  GO_similarity(go_id,                       ont =  c("BP", "CC", "MF"),                      db = 'org.Hs.eg.db',                      measure = "Rel",                      remove_orphan_terms = F)``

## 5计算相似性并可视化

``df <-  simplifyGO(mat)``

``head(df)sort(table(df\$cluster))``

`split`函数，分开查看。🤓

``split(df, df\$cluster)``

## 6单纯聚类

``binary_cut(mat)``

``cluster_terms(mat, method = "binary_cut")``

## 7给其他聚类结果瘦身

• `term_similarity_from_enrichResult()`;
• `term_similarity_from_KEGG()`;
• `term_similarity_from_Reactome()`;
• `term_similarity_from_MSigDB()`;
• `term_similarity_from_gmt()`;

## 8多列表GO-ID的应用

### 8.1 创建模拟数据

``library(cola)data(golub_cola) res <-  golub_cola["ATC:skmeans"]library(hu6800.db)x <- hu6800ENTREZIDmapped_probes = mappedkeys(x)id_mapping = unlist(as.list(x[mapped_probes]))lt <- functional_enrichment(res, k = 3, id_mapping = id_mapping)``

### 8.2 查看list名

``names(lt)``

### 8.3 查看数据

``head(lt[[1]][, 1:7])``

### 8.4 比较一下并可视化

``simplifyGOFromMultipleLists(lt, padj_cutoff = 0.001)``

### 8.5 其他格式

1️⃣

``lt2 <- lapply(lt, function(x) structure(x\$p.adjust, names = x\$ID))simplifyGOFromMultipleLists(lt2, padj_cutoff = 0.001)``

2️⃣ `simplifyGOFromMultipleLists`的输入数据一般有`3`种类型：🤒

• `adjusted p-values`的向量列表，以`GO-ID`为名；
• `data frame`，包含`go_id_column``padj_column`列，
• `GO-ID`的字符向量列表，每个字符向量将被改变为一个数字向量，所有的值都为`1`，原来的`GO- IDs`被用作向量的名称。

``lt3 <- lapply(lt, function(x) x\$ID[x\$p.adjust < 0.001])simplifyGOFromMultipleLists(lt3)``

## 9如何引用

📍
```Gu Z, Hübschmann D. Simplify enrichment: A bioconductor package for clustering and visualizing functional enrichment results [published online ahead of print, 2022 Jun 6]. Genomics Proteomics Bioinformatics. 2022;S1672-0229(22)00073-0. doi:10.1016/j.gpb.2022.04.008 IF: 6.409 Q1 B2```

📍 往期精彩

##### jamesbang
V1

wx🔍: Grassssss 卷起来了