当前位置:网站首页>[advanced drawing of single cell] 07. Display of KEGG enrichment results
[advanced drawing of single cell] 07. Display of KEGG enrichment results
2022-07-25 20:34:00 【Huang Siyuan】
The pictures drawn in this section are relatively new , What I marked with red arrows in the picture is pathway Class A Annotation information (big annotation, What I think , It's not a proper noun ), The colorful marks on the vertical axis are pathway Of second level notes (small annotation).「 How to get comments 」 Calculate a difficult point , I Last time I've already said :KEGG The subordination of the path / How to get annotation information .
The whole picture reflects How many genes Fell into the corresponding classification .
「 Look at it dialectically 」, The whole picture is pathway notes , There is no specific pathway name , It is very similar to the usual enrichment analysis Dissimilarity . Replace the secondary notes in the figure with specific pathway Will be better . in addition , The abscissa in this figure is Gene number , But I don't think this value is important in enrichment analysis ( gene ratio More important than a single value ), We can change it to p value .
Before you start drawing , Need to sort out a form , The table contains at least :「pathway ID、pathway description、pathway notes /big annotation、 Several enrichment indicators 、 Enriched genes 」.
「 The first three messages 」, The forms of the previous lecture have been sorted out , It can be used ; 「 Several enrichment indicators 」 stay clusterprofilerThere are also ;「 Enriched genes 」 Looks like clusterprofiler do kegg Enrichment cannot directly show genes symbol, So the returned result needs to be processed a little .
The code name of the sorting table is run.R, As shown below :
library(Seurat)
library(tidyverse)
library(xlsx)
testseu=readRDS("testseu.rds")
Idents(testseu)="anno_new"
### Look for differential genes #########################################################################
marker_celltype=FindAllMarkers(testseu,logfc.threshold = 0.8,only.pos = T)
# Filter
marker_celltype=marker_celltype%>%filter(p_val_adj < 0.01)
marker_celltype$d=marker_celltype$pct.1-marker_celltype$pct.2
marker_celltype=marker_celltype%>%filter(d > 0.2)
marker_celltype=marker_celltype%>%arrange(cluster,desc(avg_log2FC))
marker_celltype=as.data.frame(marker_celltype)
write.xlsx(marker_celltype,file = "markers_log2fc0.8_padj0.01_pctd0.2.xlsx",row.names = F,col.names = T)
### Enrichment analysis ###########################################################################
library(clusterProfiler)
library(org.Hs.eg.db)
R.utils::setOption("clusterProfiler.download.method","auto") #https://github.com/YuLab-SMU/clusterProfiler/issues/256
source("syEnrich.R")
syEnrich(marker_celltype,outpath = "markers_log2fc0.8_padj0.01_pctd0.2")
### Select a type of cell as a demonstration #######################################################
kegg.res=read.xlsx("markers_log2fc0.8_padj0.01_pctd0.2.KEGG.xls",sheetIndex = 1,as.data.frame = T,header = T)
kegg.res=kegg.res%>%filter(p.adjust < 0.05)
kegg.res=kegg.res%>%filter(cluster == "Endothelial")
# Import the file mentioned above
kegg_info=read.xlsx("kegg_info.xlsx",sheetIndex = 1,startRow = 3)
kegg_info=kegg_info[,c("ID","Pathway","big.annotion")]
# Merge two tables
kegg.res$ID=str_replace(kegg.res$ID,"hsa","")
kegg.res=kegg.res%>%inner_join(kegg_info,by = "ID")
write.table(kegg.res,file = "kegg.res.txt",quote = F,sep = "\t",row.names = F,col.names = T)
I take Single cell analysis Medium kegg Enrichment analysis as a demonstration , Just take one of them cluster Draw a picture based on the enrichment results of .
The enrichment code used in the above code is called syEnrich.R, This file only needs to input single cells seurat Object running FindAllMarkers The resulting differential genes , I can go back GO/KEGG Enrichment results , At the same time, genes enriched into a certain pathway symbol Will also be listed .
function run.R after , The final table is shown in the figure below : 
Then start drawing , The code name is 3.plot.R, I'm not going to do that here , The final figure is as follows :

Get the code
Include all the code that will be used in this figure , Data sorting and drawing , Is it super sweet !
This series will take 「 Time limited disclosure 」 Share code in a way ,24 Hours The inside is free . How to get beyond this time , The background to reply 2022A You know ( You may need to use your little hand to forward ).
The network disk link of code and test data is as follows : link :https://pan.baidu.com/s/1hebbeQH4DgYA8JqFWXO4dg Extraction code :abo5
If you think the code is useful , You can give three / Two / One after another ( At the end of the article give the thumbs-up 、 Share 、 Click the small advertisement ) Help me :( A few times ago, there was a pitiful rise
边栏推荐
- Arrow parquet
- FormatDateTime说解[通俗易懂]
- [Infographics Show] 248 Public Domain Name
- 【高等数学】【8】微分方程
- Web crawler principle analysis "suggestions collection"
- 【高等数学】【3】微分中值定理与导数的应用
- Introduction to several scenarios involving programming operation of Excel in SAP implementation project
- 【高等数学】【1】函数、极限、连续
- Cloud native, Intel arch and cloud native secret computing three sig online sharing! See you today | issues 32-34
- QML combines qsqltablemodel to dynamically load data MVC "recommended collection"
猜你喜欢
![[advanced mathematics] [3] Application of differential mean value theorem and derivative](/img/a9/3b024dbbb201bee4eed6c9f6ce3001.png)
[advanced mathematics] [3] Application of differential mean value theorem and derivative

Docker 搭建 Redis Cluster集群

Cloud native guide: what is cloud native infrastructure

网络协议:TCP Part2

智能电子界桩自然保护区远程监控解决方案

Today's sleep quality record 75 points

数据库清空表数据并让主键从1开始

Increase swap space

Online random coin tossing positive and negative statistical tool
![[today in history] June 29: SGI and MIPS merged; Microsoft acquires PowerPoint developer; News corporation sells MySpace](/img/86/abeb82927803712a98d2018421c3a7.png)
[today in history] June 29: SGI and MIPS merged; Microsoft acquires PowerPoint developer; News corporation sells MySpace
随机推荐
Key network protocols in tcp/ip four layer model
Learn FPGA from the bottom structure (16) -- customization and testing of pll/mmcm IP
[today in history] July 17: Softbank acquired arm; The first email interruption; Wikimedia International Conference
结构体,枚举类型与联合体
Introduction to several scenarios involving programming operation of Excel in SAP implementation project
[today in history] July 8: PostgreSQL release; SUSE acquires the largest service provider of k8s; Activision Blizzard merger
Kubernetes进阶部分学习笔记
智能电子界桩自然保护区远程监控解决方案
Cloud native guide: what is cloud native infrastructure
飞行器pid控制(旋翼飞控)
MySQL date [plus sign / +] condition filtering problem
[advanced mathematics] [6] differential calculus of multivariate functions
[paper reading] unpaired image to image translation using cycle consistent advantageous networks
【高等数学】【8】微分方程
2022.7.24-----leetcode.1184
Dataframe first performs grouping operation and then combines output
Do you still have certificates to participate in the open source community?
Log in to Baidu online disk with cookies (websites use cookies)
[today in history] July 5: the mother of Google was born; Two Turing Award pioneers born on the same day
process.env