scRNAtoolVis適用于各種單細(xì)胞RNA-seq數(shù)據(jù)分析場(chǎng)景,包括但不限于:
單細(xì)胞Marker基因表達(dá)熱圖:通過熱圖展示不同細(xì)胞亞群中Marker基因的表達(dá)水平。
單細(xì)胞火山圖:快速識(shí)別差異表達(dá)基因。
單細(xì)胞散點(diǎn)圖:直觀展示細(xì)胞間的差異和相似性。
1.
數(shù)據(jù)
scRNAtoolVis 本身可與 Seurat 對(duì)象配合使用,只需加載數(shù)據(jù)即可
# 安裝并加載所需的R包
# install.packages("devtools")
# devtools::install_github("junjunlab/scRNAtoolVis")
library(scRNAtoolVis)
load('scRNA_harmony.Rdata')
head('scRNA_harmony.Rdata')
orig.ident nCount_RNA nFeature_RNA Condition Sample RNA_snn_res.0.8 seurat_clusters celltype celltype_anno GEO_accession
GSE200997_T_cac1_AAACCTGAGAATAGGG T 922 504 Tumor T_cac1 5 5 Epithelial_cells Epithelial tumor cells GSE200997
GSE200997_T_cac1_AAACCTGAGCAGCGTA T 11519 3177 Tumor T_cac1 11 11 Fibroblasts CAFs GSE200997
GSE200997_T_cac1_AAACCTGCAATCTGCA T 831 465 Tumor T_cac1 5 5 Epithelial_cells Epithelial tumor cells GSE200997
GSE200997_T_cac1_AAACCTGGTCTTGCGG T 527 329 Tumor T_cac1 5 5 Epithelial_cells Epithelial tumor cells GSE200997
GSE200997_T_cac1_AAACCTGGTGTGCCTG T 8388 2887 Tumor T_cac1. 10 10 Embryonic_stem_cells Epithelial tumor cells GSE200997
GSE200997_T_cac1_AAACGGGTCGTTACAG T 8485 2293 Tumor T_cac1 4 4 Epithelial_cells Epithelial tumor cells GSE200997
GSE200997_T_cac1_AAACGGGTCTCAACTT T 653 473 Tumor T_cac1 1 1 T_cells CD8 T cell GSE200997
GSE200997_T_cac1_AAACGGGTCTTGCCGT T 4978 1728 Tumor T_cac1 4 4 Epithelial_cells Epithelial tumor cells GSE200997
GSE200997_T_cac1_AAAGATGCAAGACACG T 9214 2258 Tumor T_cac1 4 4 Epithelial_cells Epithelial tumor cells GSE200997
GSE200997_T_cac1_AAAGATGCACAACTGT T 5978 2081 Tumor T_cac1 10 10 Embryonic_stem_cells Epithelial tumor cells GSE200997
2. UMAP/tSNE圖(clusterCornerAxes / featureCornerAxes)
clusterCornerAxes(object = scRNA_harmony,reduction = 'umap',
clusterCol = "celltype_anno", # 分組依據(jù)的集群名稱,默認(rèn) "seurat_clusters"
pSize = 0.1,
arrowType = 'open', # 箭頭的類型,默認(rèn) "closed"
lineTextcol = 'grey50', # 角線和標(biāo)簽顏色, 默認(rèn) "black"
cornerTextSize = 3.5,
# keySize = 2, # 圖注的大小
show.legend = F, # 不顯示圖注
cellLabel = T, cellLabelSize = 5, # 細(xì)胞標(biāo)簽及字體大小
noSplit = T,
# themebg = 'bwCorner', # 主題
addCircle = TRUE, # 添加圓圈
cicAlpha = 0.1, cicDelta = 0.5
nbin = 200)

scRNAtoolVis-1
featureCornerAxes(object = scRNA_harmony, reduction = 'umap',
groupFacet = 'celltype',
# groupFacet = NULL,
relLength = 0.5,
relDist = 0.2,
features = c("CD37","FCMR","TNFRSF13C"),
show.legend = F # 去除圖例
)

scRNAtoolVis-2
3. Marker基因表達(dá)熱圖(averageHeatmap)
markers <- FindAllMarkers(object = scRNA_harmony, test.use="wilcox" ,
only.pos = TRUE,
logfc.threshold = 0.25)
top5_gene = markers %>% group_by(cluster) %>% top_n(n = 5, wt=avg_log2FC)
averageHeatmap(object = scRNA_harmony,
markerGene = top5_gene$gene,
# group.by = 'celltype_anno',
# htCol = c("#339933", "#FFCC00", "#FF0033"), # 修改熱圖的顏色
gene.order = top5_gene$gene,
# width = 12, height = 16,
myanCol = celltype_colors, # 自定義注釋集群顏色
column_split = 1:14, # 分割列
row_split = rep(1:14, each = 5), # 分割行
border = T)

scRNAtoolVis-3
4. 火山圖(averageHeatmap)
# 獲取所有簇的標(biāo)簽
clusters <- levels(scRNA_harmony@active.ident)
# 創(chuàng)建一個(gè)列表來存儲(chǔ)每個(gè)簇中健康和重度分組的差異表達(dá)基因
markers_list <- list()
# 對(duì)每個(gè)簇中的健康和重度分組分別運(yùn)行 FindMarkers
for (cluster in clusters) {
# 提取當(dāng)前簇中的細(xì)胞
cells_in_cluster <- WhichCells(scRNA_harmony, idents = cluster)
# 提取健康和重度分組的細(xì)胞
cells_TLS_High <- cells_in_cluster[scRNA_harmony$TLS[cells_in_cluster] == "TLS_High"]
cells_TLS_Low <- cells_in_cluster[scRNA_harmony$TLS[cells_in_cluster] == "TLS_Low"]
if (length(cells_TLS_High) > 0 && length(cells_TLS_Low) > 0) {
# 運(yùn)行 FindMarkers
markers <- FindMarkers(scRNA_harmony, ident.1 = cells_TLS_Low, ident.2 = cells_TLS_High)
# 將結(jié)果存儲(chǔ)在列表中
comparison_name <- paste0("TLS_", cluster, "_Low_vs_High")
markers_list[[comparison_name]] <- markers
}
}
# 添加cluster列
markers_list[["TLS_CD4 memory T cells_Low_vs_High"]]$cluster = 'CD4 memory T cells'
markers_list[["TLS_CD8 T cell_Low_vs_High"]]$cluster = 'CD8 T cell'
markers_list[["TLS_Plasma_Low_vs_High"]]$cluster = 'Plasma'
markers_list[["TLS_Tregs_Low_vs_High"]]$cluster = 'Tregs'
markers_list[["TLS_Epithelial tumor cells_Low_vs_High"]]$cluster = 'Epithelial tumor cells'
markers_list[["TLS_B activated_Low_vs_High"]]$cluster = 'B activated'
markers_list[["TLS_Macro_Mono_Low_vs_High"]]$cluster = 'Macro_Mono'
markers_list[["TLS_Endothelial Cell_Low_vs_High"]]$cluster = 'Endothelial Cell'
markers_list[["TLS_CAFs_Low_vs_High"]]$cluster = 'CAFs'
markers_list[["TLS_T cell_Low_vs_High"]]$cluster = 'T cell'
markers_list[["TLS_B cells_Low_vs_High"]]$cluster = 'B cells'
markers_list[["TLS_MEP_Low_vs_High"]]$cluster = 'MEP'
markers_list[["TLS_Memory B cells_Low_vs_High"]]$cluster = 'Memory B cells'
markers_list[["TLS_DC cell_Low_vs_High"]]$cluster = 'DC cell'
markers_list[["TLS_CD4 memory T cells_Low_vs_High"]]$gene = row.names(markers_list[["TLS_CD4 memory T cells_Low_vs_High"]])
markers_list[["TLS_CD8 T cell_Low_vs_High"]]$gene = row.names(markers_list[["TLS_CD8 T cell_Low_vs_High"]])
markers_list[["TLS_Plasma_Low_vs_High"]]$gene = row.names(markers_list[["TLS_Plasma_Low_vs_High"]])
markers_list[["TLS_Tregs_Low_vs_High"]]$gene = row.names(markers_list[["TLS_Tregs_Low_vs_High"]])
markers_list[["TLS_Epithelial tumor cells_Low_vs_High"]]$gene = row.names(markers_list[["TLS_Epithelial tumor cells_Low_vs_High"]])
markers_list[["TLS_B activated_Low_vs_High"]]$gene = row.names(markers_list[["TLS_B activated_Low_vs_High"]])
markers_list[["TLS_Macro_Mono_Low_vs_High"]]$gene = row.names(markers_list[["TLS_Macro_Mono_Low_vs_High"]])
markers_list[["TLS_Endothelial Cell_Low_vs_High"]]$gene = row.names(markers_list[["TLS_Endothelial Cell_Low_vs_High"]])
markers_list[["TLS_CAFs_Low_vs_High"]]$gene = row.names(markers_list[["TLS_CAFs_Low_vs_High"]])
markers_list[["TLS_T cell_Low_vs_High"]]$gene = row.names(markers_list[["TLS_T cell_Low_vs_High"]])
markers_list[["TLS_B cells_Low_vs_High"]]$gene = row.names(markers_list[["TLS_B cells_Low_vs_High"]])
markers_list[["TLS_MEP_Low_vs_High"]]$gene = row.names(markers_list[["TLS_MEP_Low_vs_High"]])
markers_list[["TLS_Memory B cells_Low_vs_High"]]$gene = row.names(markers_list[["TLS_Memory B cells_Low_vs_High"]])
markers_list[["TLS_DC cell_Low_vs_High"]]$gene = row.names(markers_list[["TLS_DC cell_Low_vs_High"]])
# 使用bind_rows合并數(shù)據(jù)框
merged_markers <- bind_rows(markers_list)
merged_markers$cluster = factor(merged_markers$cluster, levels = c("Epithelial_cells","Fibroblasts","Embryonic_stem_cells","T_cells","B_cell",
"Monocyte","Endothelial_cells","Macrophage","Gametocytes","Tissue_stem_cells","MEP" ))
markerVolcano(markers = merged_markers,
topn = 5,
labelCol = c('#C6DADF','#E26EB8','#918FBE','#A2C5A6','#EED784','#B088BB','#DEDCED','#6E8BD5','#D4B796',
'#F5BDC8','#DAB6F7','#EFE2E6','#F0BDD8','#77A1EC','#F8D39C','#F17591','#50C2FB','#EEB96A'
,'#81C28F','#E3ECC1','#F9E3DC','#A133CC','#DFB9D5','#EFC1ED','#FAE3DC'))

scRNAtoolVis-4
5. 散點(diǎn)圖(jjDotPlot)
jjDotPlot(object = scRNA_harmony,
gene = top5_gene$gene,
id = 'celltype_anno',
xtree = T,
point.shape = 22,
dot.col = c('blue','white','red'),
rescale.min = -2,
rescale.max = 2,
midpoint = 0,
anno = T
)

scRNAtoolVis-5