当前位置:网站首页>[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
边栏推荐
- Aircraft PID control (rotor flight control)
- Card link
- 火山引擎项亮:机器学习与智能推荐平台多云部署解决方案正式发布
- 【高等数学】【3】微分中值定理与导数的应用
- "Chain" connects infinite possibilities: digital asset chain, wonderful coming soon!
- [advanced mathematics] [4] indefinite integral
- Chinese son-in-law OTA Ono became the first Asian president of the University of Michigan, with an annual salary of more than 6.5 million!
- TGA file format (waveform sound file format)
- CarSim simulation quick start (XIV) - CarSim Simulink joint simulation
- qml 结合 QSqlTableModel 动态加载数据 MVC「建议收藏」
猜你喜欢

Fanoutexchange switch code tutorial

Working principle of radar water level gauge and precautions for installation and maintenance

参与开源社区还有证书拿?
![[paper reading] unpaired image to image translation using cycle consistent advantageous networks](/img/73/69651dd8ecfdddd1cae13a1d223d51.png)
[paper reading] unpaired image to image translation using cycle consistent advantageous networks

Volcanic engine Xiang Liang: machine learning and intelligent recommendation platform multi cloud deployment solution officially released

Kubernetes进阶部分学习笔记

Increase swap space

During the interview, I was asked how to remove the weight of MySQL, and who else wouldn't?

ROS_ Rqt toolbox

Card link
随机推荐
During the interview, I was asked how to remove the weight of MySQL, and who else wouldn't?
Docker builds redis cluster
Fanoutexchange switch code tutorial
【高等数学】【8】微分方程
"Chain" connects infinite possibilities: digital asset chain, wonderful coming soon!
Three skills of interface request merging, and the performance is directly exploded!
Chinese son-in-law OTA Ono became the first Asian president of the University of Michigan, with an annual salary of more than 6.5 million!
Embedded development: embedded foundation -- threads and tasks
Introduction and construction of consul Registration Center
Follow up of Arlo's thinking
"Share" devaxpress asp Net v22.1 latest version system environment configuration requirements
从底层结构开始学习FPGA(16)----PLL/MMCM IP的定制与测试
Kubernetes进阶部分学习笔记
Question and answer 47: geeks have an appointment - the current monitoring system construction of CSC
雷达水位计的工作原理及安装维护注意事项
什么是聚类分析?聚类分析方法的类别[通俗易懂]
[today in history] June 30: von Neumann published the first draft; The semiconductor war in the late 1990s; CBS acquires CNET
Chapter VI modified specification (SPEC) class
[today in history] July 8: PostgreSQL release; SUSE acquires the largest service provider of k8s; Activision Blizzard merger
[tensorrt] dynamic batch reasoning