当前位置:网站首页>[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
边栏推荐
- 微服务架构 Sentinel 的服务限流及熔断
- Chapter 2-14 sum integer segments
- Blog Building 9: add search function to Hugo
- Detailed explanation of switch link aggregation [Huawei ENSP]
- Bluetooth technology | it is reported that apple, meta and other manufacturers will promote new wearable devices, and Bluetooth will help the development of intelligent wearable devices
- [cloud computing] several mistakes that enterprises need to avoid after going to the cloud
- Chapter 2-2 calculation of piecewise function [1]
- KEGG通路的从属/注释信息如何获取
- Why is the text box of Google material design not used?
- Deployment of kubernetes
猜你喜欢

Alibaba internal interview materials

Distributed system architecture theory and components

说透缓存一致性与内存屏障

Data fabric, next air outlet?

看得清比走得快更重要,因为走得对才能走得远

阿里技术四面+交叉面+HR面,成功拿到offer,双非本科进不了大厂?

Div tags and span Tags

Completion report of communication software development and Application

Gbase 8A MPP and Galaxy Kirin (x86 version) complete deep adaptation

Hcip day 8
随机推荐
Analysis of model predictive control (MPC) (IX): numerical solution of quadratic programming (II)
Wechat applet - wechat applet browsing PDF files
Hcip day 9_ BGP experiment
Review the past and know the new MySQL isolation level
Redis 基本知识,快来回顾一下
思迈特软件Smartbi完成C轮融资,推动国产BI加速进入智能化时代
Kubernetes technology and Architecture (VII)
When I use MySQL CDC, there are 100 million pieces of data in the source table. In the full volume phase, when I synchronize 10 million, I stop, and then pass
为什么 ThreadLocal 可以做到线程隔离?
[cloud computing] several mistakes that enterprises need to avoid after going to the cloud
Larkapi access credentials overview
KEGG通路的从属/注释信息如何获取
第2章-2 计算分段函数[1]
DIY system home page, your personalized needs PRO system to meet!
1w5 words to introduce those technical solutions of distributed system in detail
Marketing play is changeable, and understanding the rules is the key!
Service current limiting and fusing of micro service architecture Sentinel
Image batch processing | necessary skills
There is a bug in installing CONDA environment
谷歌 Material Design 的文本框为什么没人用?