当前位置:网站首页>[advanced drawing of single cell] 07. Display of KEGG enrichment results
[advanced drawing of single cell] 07. Display of KEGG enrichment results
2022-07-28 08:59:00 【Top bioinformation】
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
边栏推荐
- Oracle SQL problems
- Go panic and recover
- Uniapp ---- detailed steps to obtain the longitude and latitude of the current position and other information (including applet)
- Alibaba technology has four sides + intersection +hr, and successfully got the offer. Can't double non undergraduate students enter the big factory?
- Post it notes -- 45 {packaging of the uniapp component picker, for data transmission and processing -- Based on the from custom packaging that will be released later}
- Redis basic knowledge, let's review it
- Blog building 7: Hugo
- 我来教你如何组装一个注册中心?
- TXT文本文件存储
- 'global event bus' &' message subscription and Publishing '
猜你喜欢

Go interface Foundation

1w5 words to introduce those technical solutions of distributed system in detail

分布式系统架构理论与组件

Distributed system architecture theory and components

Bash shell interaction free

Recruiting talents, gbase high-end talent recruitment in progress

解决:IndexError: index 13 is out of bounds for dimension 0 with size 13

Do you know the five minute rule and the ten byte rule?

Marketing play is changeable, and understanding the rules is the key!

思迈特软件完成C轮融资,让BI真正实现“普惠化”
随机推荐
Go interface Foundation
No one wants to tell the truth about kubernetes secret
Gbase 8A MPP and Galaxy Kirin (x86 version) complete deep adaptation
Top all major platforms, 22 versions of interview core knowledge analysis notes, strong on the list
SQL server time field sorting
How to execute the SQL assembled in ODPs SQL function and get the return value?
Opengauss synchronization status query
Why setting application.targetframerate doesn't work
说透缓存一致性与内存屏障
There is a bug in installing CONDA environment
SQL injection - pre Foundation
思迈特软件Smartbi完成C轮融资,推动国产BI加速进入智能化时代
Bash shell interaction free
微服务架构 Sentinel 的服务限流及熔断
Gb/t 41479-2022 information security technology network data processing security requirements map overview
NDK series (6): let's talk about the way and time to register JNI functions
看完这12个面试问题,新媒体运营岗位就是你的了
Post it notes -- 45 {packaging of the uniapp component picker, for data transmission and processing -- Based on the from custom packaging that will be released later}
Business digitalization is running rapidly, and management digitalization urgently needs to start
Go channel