單細(xì)胞繪圖系列:
- Seurat繪圖函數(shù)總結(jié)
- 使用ggplot2優(yōu)化Seurat繪圖
- scRNAseq靈活的點(diǎn)圖繪制:FlexDotPlot
- 富集分析結(jié)果雷達(dá)圖
- DoHeatmap的優(yōu)化+ComplexHeatmap繪制帶特定基因的單細(xì)胞熱圖
- 不同單細(xì)胞群之間的相關(guān)性分析
在讀文獻(xiàn)Single-cell RNA sequencing reveals distinct tumor
microenvironmental patterns in lung adenocarcinoma的時(shí)候剥懒,看到這樣的熱圖
# 代碼:
DimHeatmap(epi_pca, dims = 1, cells = 1000, balanced = T, fast = F, nfeatures = 60) +
scale_fill_viridis()
這個(gè)熱圖的行是top 30 genes positively or negatively correlated with principal component 1黔夭,列是 top 500 cells with the highest or lowest PCA scores敌完。那行的這些基因和列的這些細(xì)胞是怎么得到的呢?
1. RunPCA()結(jié)果解讀
我們?cè)谧鰡渭?xì)胞數(shù)據(jù)分析,進(jìn)行RunPCA()的時(shí)候偏友,會(huì)返回如下消息:
pbmc <- RunPCA(pbmc, features = VariableFeatures(object = pbmc))
# PC_ 1
# Positive: CST3, TYROBP, LST1, AIF1, FTL, FTH1, LYZ, FCN1, S100A9, TYMP
# FCER1G, CFD, LGALS1, S100A8, CTSS, LGALS2, SERPINA1, IFITM3, SPI1, CFP
# PSAP, IFI30, SAT1, COTL1, S100A11, NPC2, GRN, LGALS3, GSTP1, PYCARD
# Negative: MALAT1, LTB, IL32, IL7R, CD2, B2M, ACAP1, CD27, STK17A, CTSW
# CD247, GIMAP5, AQP3, CCL5, SELL, TRAF3IP3, GZMA, MAL, CST7, ITM2A
# MYC, GIMAP7, HOPX, BEX2, LDLRAP1, GZMK, ETS1, ZAP70, TNFAIP8, RIC3
# PC_ 2
# Positive: CD79A, MS4A1, TCL1A, HLA-DQA1, HLA-DQB1, HLA-DRA, LINC00926, CD79B, HLA-DRB1, CD74
# HLA-DMA, HLA-DPB1, HLA-DQA2, CD37, HLA-DRB5, HLA-DMB, HLA-DPA1, FCRLA, HVCN1, LTB
# BLNK, P2RX5, IGLL5, IRF8, SWAP70, ARHGAP24, FCGR2B, SMIM14, PPP1R14A, C16orf74
# Negative: NKG7, PRF1, CST7, GZMB, GZMA, FGFBP2, CTSW, GNLY, B2M, SPON2
# CCL4, GZMH, FCGR3A, CCL5, CD247, XCL2, CLIC3, AKR1C3, SRGN, HOPX
# TTC38, APMAP, CTSC, S100A4, IGFBP7, ANXA1, ID2, IL32, XCL1, RHOC
# PC_ 3
# Positive: HLA-DQA1, CD79A, CD79B, HLA-DQB1, HLA-DPB1, HLA-DPA1, CD74, MS4A1, HLA-DRB1, HLA-DRA
# HLA-DRB5, HLA-DQA2, TCL1A, LINC00926, HLA-DMB, HLA-DMA, CD37, HVCN1, FCRLA, IRF8
# PLAC8, BLNK, MALAT1, SMIM14, PLD4, LAT2, IGLL5, P2RX5, SWAP70, FCGR2B
# Negative: PPBP, PF4, SDPR, SPARC, GNG11, NRGN, GP9, RGS18, TUBB1, CLU
# HIST1H2AC, AP001189.4, ITGA2B, CD9, TMEM40, PTCRA, CA2, ACRBP, MMD, TREML1
# NGFRAP1, F13A1, SEPT5, RUFY1, TSC22D1, MPP1, CMTM5, RP11-367G6.3, MYL9, GP1BA
# PC_ 4
# Positive: HLA-DQA1, CD79B, CD79A, MS4A1, HLA-DQB1, CD74, HLA-DPB1, HIST1H2AC, PF4, TCL1A
# SDPR, HLA-DPA1, HLA-DRB1, HLA-DQA2, HLA-DRA, PPBP, LINC00926, GNG11, HLA-DRB5, SPARC
# GP9, AP001189.4, CA2, PTCRA, CD9, NRGN, RGS18, GZMB, CLU, TUBB1
# Negative: VIM, IL7R, S100A6, IL32, S100A8, S100A4, GIMAP7, S100A10, S100A9, MAL
# AQP3, CD2, CD14, FYB, LGALS2, GIMAP4, ANXA1, CD27, FCN1, RBP7
# LYZ, S100A11, GIMAP5, MS4A6A, S100A12, FOLR3, TRABD2A, AIF1, IL8, IFI6
# PC_ 5
# Positive: GZMB, NKG7, S100A8, FGFBP2, GNLY, CCL4, CST7, PRF1, GZMA, SPON2
# GZMH, S100A9, LGALS2, CCL3, CTSW, XCL2, CD14, CLIC3, S100A12, CCL5
# RBP7, MS4A6A, GSTP1, FOLR3, IGFBP7, TYROBP, TTC38, AKR1C3, XCL1, HOPX
# Negative: LTB, IL7R, CKB, VIM, MS4A7, AQP3, CYTIP, RP11-290F20.3, SIGLEC10, HMOX1
# PTGES3, LILRB2, MAL, CD27, HN1, CD2, GDI2, ANXA5, CORO1B, TUBA1B
# FAM110A, ATP1A1, TRADD, PPA1, CCDC109B, ABRACL, CTD-2006K23.1, WARS, VMO1, FYB
Positive和Negative就是PC軸的正負(fù)映射關(guān)系抡四,正值為Positive,負(fù)值為Negative举反。返回的是正值和負(fù)值絕對(duì)值最大的top30懊直。可以理解為對(duì)所有細(xì)胞區(qū)分度最大的基因火鼻。
上面那張熱圖用的60個(gè)基因就是PC_ 1 Positive和Negative的30個(gè)基因室囊。
在運(yùn)行完RunPCA()之后,得到2個(gè)分解矩陣魁索。以2000個(gè)細(xì)胞*20000個(gè)基因的矩陣為例融撞,會(huì)得到一個(gè)2000 X 50 的權(quán)重矩陣
,另一個(gè)是50 X 20000 的系數(shù)矩陣
粗蔚。
剛剛返回的信息可以采用如下方法調(diào)瘸①恕:
View(pbmc@reductions[["pca"]]@feature.loadings)
這部分結(jié)果行是高變基因,列是50個(gè)PC鹏控,展示的是每個(gè)基因?qū)?yīng)在PC軸上的映射致扯。運(yùn)行RunPCA()時(shí)返回的基因就是每個(gè)PC(列)上數(shù)值最大(Positive)和最小(Negative)的top30基因。
值得注意的是当辐,每一個(gè)PC 軸所對(duì)應(yīng)的基因具有強(qiáng)相關(guān)性抖僵,代表了獨(dú)特的生物學(xué)功能,所以在很多研究中缘揪,將每個(gè)PC 軸對(duì)應(yīng)強(qiáng)相關(guān)的基因作為一個(gè)factor耍群,研究細(xì)胞在生物學(xué)功能上的動(dòng)態(tài)變化义桂。也就是開頭那張圖。
除了上面那個(gè)矩陣以外蹈垢,PCA的結(jié)果還包含如下矩陣
View(pbmc@reductions[["pca"]]@cell.embeddings)
這部分結(jié)果行是所有的細(xì)胞慷吊,列是50個(gè)PC。矩陣中的值是每個(gè)細(xì)胞在低維PCA軸上的映射坐標(biāo)曹抬。(也就是我們使用PC_1和PC_2畫PCA圖時(shí)候的細(xì)胞坐標(biāo))細(xì)胞在PC 軸上的分布代表主要的變化方向(所以有的軟件借助PCA 降維
來進(jìn)行軌跡推斷)溉瓶。
DimPlot(pbmc,reduction = 'pca')
上圖的列的1000個(gè)細(xì)胞,就是取了PC_1這個(gè)軸上沐祷,所有基因投射值最大的500個(gè)最小的500個(gè)細(xì)胞
這部分的結(jié)果是可以直接使用FeaturePlot()
進(jìn)行可視化的
p1=FeaturePlot(pbmc,features = "PC_1", order = T)
p2=FeaturePlot(pbmc,features = "PC_2", order = T)
p1|p2
結(jié)合每個(gè)PC 軸對(duì)應(yīng)的生物學(xué)功能嚷闭,還可以得到類似下面的圖譜
2. DimHeatmap的用法
最前面那張圖是使用DimHeatmap()
函數(shù)畫的字旭,使用pbmc數(shù)據(jù)集來畫一下掌敬。
library(Seurat)
library(viridis)
pbmc <- readRDS("pbmc.rds")
DimHeatmap(object = pbmc,dims = 1,cells = 1000,balanced = T, fast = F,nfeatures = 30)+scale_fill_viridis()