admin管理员组文章数量:1037775
展示你的特征基因:带"辣椒粉"的markers基因umap图
今天来看看如何展示你的特征基因,这个需求在单细胞分析中非常常见。图来自文献《The aged tumor microenvironment limits T cell control of cancer》,于2024年6月25日发表在Nat Immunol杂志上(IF27.8)。如下:
图注:
Fig. 4. Cell-extrinsic signals from the aged TME drive the TTAD subset state, which is distinct from CD8+ T cell exhaustion. j, scRNA-seq UMAP projection of 7,242 tumor-infiltrating CD8+ T cells from human pan-cancer aggregated tumor biopsies (n = 57) colored by cluster.
文章中还有很多其他的这种UMAP展示,换一个色系的:
示例数据
使用的数据还是自 GSE128531 数据注释后的seurat对象,你自己用的时候可以使用任何一个经过了注释后的seurat对象。或者在这里下载链接: 提取码: 2jdp
:
###
### Create: Jianming Zeng
### Date: 2023-12-31
### Email: jmzeng1314@163
### Blog: /
### Forum: .html
### CAFS/SUSTC/Eli Lilly/University of Macau
### Update Log: 2023-12-31 First version
### Update Log: 2024-12-09 by juan zhang (492482942@qq)
###
rm(list=ls())
library(COSG)
library(harmony)
library(ggsci)
library(dplyr)
library(future)
library(Seurat)
library(clustree)
library(cowplot)
library(data.table)
library(dplyr)
library(ggplot2)
library(patchwork)
library(stringr)
library(qs)
# 导入数据
sce.all.int <- readRDS('2-harmony/sce.all_int.rds')
head(sce.all.int@meta.data)
load("phe.Rdata")
head(phe)
sce.all.int <- AddMetaData(sce.all.int, metadata = phe)
Idents(sce.all.int) <- "celltype"
确定展示的特征基因
我这里挑了12个基因,为每种细胞的已知marker基因,如下:
- macrophages: AIF1
- keratinocytes: KRT1
- T lymphocytes: CD3D
- fibroblasts: COL1A1
- endothelial cells: VWF
- mast cells: TPSAB1
- secretory (glandular) cells: SCGB1B2P
- pericytes: RGS5
- melanocytes: PMEL
- B cells: MS4A1
- smooth muscle cells: DES
- dendritic cells: CD1C
先绘制一个基因看看
使用 scCustomize
这个包:
################## umap4:scCustomize
library(viridis)
library(Seurat)
library(scCustomize)
# 绘图
p <- FeaturePlot_scCustom(seurat_object = sce.all.int, features = "CD3E", order = T,pt.size = 0.4) +
scale_color_gradient(low = "grey", high = "#f32a1f") + # 更改填充颜色
theme_void() + # 使用空白主题
theme( plot.title = element_text(hjust = 0.5, size = 16, face = "italic"), # 标题居中
legend.position = "none", # 去除图例
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
plot.background = element_blank())
p
结果如下:
多个基因绘制在一个面板
接下来将多个基因绘制在一个图中,这里总共有12个基因,可以选择4X3的排列方式,比较美观,拼图使用patchwork包:
代码语言:javascript代码运行次数:0运行复制# 确定特征基因
selected_genes <- list("macrophages"="AIF1",
"keratinocytes"="KRT1",
"T lymphocytes"="CD3D",
"fibroblasts"="COL1A1",
"endothelial cells"="VWF",
"mast cells"="TPSAB1",
"secretory (glandular) cells"="SCGB1B2P",
"pericytes"="RGS5",
"melanocytes"="PMEL",
"B cells"="MS4A1",
"smooth muscle cells"="DES",
"dendritic cells"="CD1C")
g <- unlist(selected_genes)
g
# 生成一个存储多个ggplot对象的list
p_merge <- list()
for(i in 1:length(g)) {
# 打印动态
print(g[i])
# 绘图
p_merge[[i]] <- FeaturePlot_scCustom(seurat_object = sce.all.int, features = g[i], order = T,pt.size = 0.6) +
scale_color_gradient(low = "grey", high = "#f32a1f") + # 更改填充颜色
theme_void() + # 使用空白主题
theme( plot.title = element_text(hjust = 0.5, size = 16, face = "bold"), # 标题居中
legend.position = "none", # 去除图例
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
plot.background = element_blank())
}
# 拼图
library(patchwork)
# 有多少个基因,3行4咧
length(g)
# 使用 patchwork 的 wrap_plots() 函数组合图表
combined_plot <- wrap_plots(p_merge, ncol = 4)
combined_plot
# 保存
ggsave(filename = "Salt_UMAP.pdf", width = 11.5, height = 8, plot = combined_plot)
ggsave(filename = "Salt_UMAP.png", width = 11.5, height = 8, plot = combined_plot)
结果如下:
完美~
换一个色系
改一下:scale_color_gradient(low = "grey", high = "#f32a1f")
代码语言:javascript代码运行次数:0运行复制# 生成一个存储多个ggplot对象的list
p_merge <- list()
for(i in 1:length(g)) {
# 打印动态
print(g[i])
# 绘图
p_merge[[i]] <- FeaturePlot_scCustom(seurat_object = sce.all.int, features = g[i], order = T,pt.size = 0.6) +
scale_color_gradient(low = "grey", high = "#44579a") + # 更改填充颜色
theme_void() + # 使用空白主题
theme( plot.title = element_text(hjust = 0.5, size = 16, face = "bold"), # 标题居中
legend.position = "none", # 去除图例
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
plot.background = element_blank())
}
# 拼图
library(patchwork)
# 有多少个基因,3行4咧
length(g)
# 使用 patchwork 的 wrap_plots() 函数组合图表
combined_plot <- wrap_plots(p_merge, ncol = 4)
combined_plot
# 保存
ggsave(filename = "Salt_UMAP.pdf", width = 11.5, height = 8, plot = combined_plot)
ggsave(filename = "Salt_UMAP.png", width = 11.5, height = 8, plot = combined_plot)
展示你的特征基因:带"辣椒粉"的markers基因umap图
今天来看看如何展示你的特征基因,这个需求在单细胞分析中非常常见。图来自文献《The aged tumor microenvironment limits T cell control of cancer》,于2024年6月25日发表在Nat Immunol杂志上(IF27.8)。如下:
图注:
Fig. 4. Cell-extrinsic signals from the aged TME drive the TTAD subset state, which is distinct from CD8+ T cell exhaustion. j, scRNA-seq UMAP projection of 7,242 tumor-infiltrating CD8+ T cells from human pan-cancer aggregated tumor biopsies (n = 57) colored by cluster.
文章中还有很多其他的这种UMAP展示,换一个色系的:
示例数据
使用的数据还是自 GSE128531 数据注释后的seurat对象,你自己用的时候可以使用任何一个经过了注释后的seurat对象。或者在这里下载链接: 提取码: 2jdp
:
###
### Create: Jianming Zeng
### Date: 2023-12-31
### Email: jmzeng1314@163
### Blog: /
### Forum: .html
### CAFS/SUSTC/Eli Lilly/University of Macau
### Update Log: 2023-12-31 First version
### Update Log: 2024-12-09 by juan zhang (492482942@qq)
###
rm(list=ls())
library(COSG)
library(harmony)
library(ggsci)
library(dplyr)
library(future)
library(Seurat)
library(clustree)
library(cowplot)
library(data.table)
library(dplyr)
library(ggplot2)
library(patchwork)
library(stringr)
library(qs)
# 导入数据
sce.all.int <- readRDS('2-harmony/sce.all_int.rds')
head(sce.all.int@meta.data)
load("phe.Rdata")
head(phe)
sce.all.int <- AddMetaData(sce.all.int, metadata = phe)
Idents(sce.all.int) <- "celltype"
确定展示的特征基因
我这里挑了12个基因,为每种细胞的已知marker基因,如下:
- macrophages: AIF1
- keratinocytes: KRT1
- T lymphocytes: CD3D
- fibroblasts: COL1A1
- endothelial cells: VWF
- mast cells: TPSAB1
- secretory (glandular) cells: SCGB1B2P
- pericytes: RGS5
- melanocytes: PMEL
- B cells: MS4A1
- smooth muscle cells: DES
- dendritic cells: CD1C
先绘制一个基因看看
使用 scCustomize
这个包:
################## umap4:scCustomize
library(viridis)
library(Seurat)
library(scCustomize)
# 绘图
p <- FeaturePlot_scCustom(seurat_object = sce.all.int, features = "CD3E", order = T,pt.size = 0.4) +
scale_color_gradient(low = "grey", high = "#f32a1f") + # 更改填充颜色
theme_void() + # 使用空白主题
theme( plot.title = element_text(hjust = 0.5, size = 16, face = "italic"), # 标题居中
legend.position = "none", # 去除图例
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
plot.background = element_blank())
p
结果如下:
多个基因绘制在一个面板
接下来将多个基因绘制在一个图中,这里总共有12个基因,可以选择4X3的排列方式,比较美观,拼图使用patchwork包:
代码语言:javascript代码运行次数:0运行复制# 确定特征基因
selected_genes <- list("macrophages"="AIF1",
"keratinocytes"="KRT1",
"T lymphocytes"="CD3D",
"fibroblasts"="COL1A1",
"endothelial cells"="VWF",
"mast cells"="TPSAB1",
"secretory (glandular) cells"="SCGB1B2P",
"pericytes"="RGS5",
"melanocytes"="PMEL",
"B cells"="MS4A1",
"smooth muscle cells"="DES",
"dendritic cells"="CD1C")
g <- unlist(selected_genes)
g
# 生成一个存储多个ggplot对象的list
p_merge <- list()
for(i in 1:length(g)) {
# 打印动态
print(g[i])
# 绘图
p_merge[[i]] <- FeaturePlot_scCustom(seurat_object = sce.all.int, features = g[i], order = T,pt.size = 0.6) +
scale_color_gradient(low = "grey", high = "#f32a1f") + # 更改填充颜色
theme_void() + # 使用空白主题
theme( plot.title = element_text(hjust = 0.5, size = 16, face = "bold"), # 标题居中
legend.position = "none", # 去除图例
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
plot.background = element_blank())
}
# 拼图
library(patchwork)
# 有多少个基因,3行4咧
length(g)
# 使用 patchwork 的 wrap_plots() 函数组合图表
combined_plot <- wrap_plots(p_merge, ncol = 4)
combined_plot
# 保存
ggsave(filename = "Salt_UMAP.pdf", width = 11.5, height = 8, plot = combined_plot)
ggsave(filename = "Salt_UMAP.png", width = 11.5, height = 8, plot = combined_plot)
结果如下:
完美~
换一个色系
改一下:scale_color_gradient(low = "grey", high = "#f32a1f")
代码语言:javascript代码运行次数:0运行复制# 生成一个存储多个ggplot对象的list
p_merge <- list()
for(i in 1:length(g)) {
# 打印动态
print(g[i])
# 绘图
p_merge[[i]] <- FeaturePlot_scCustom(seurat_object = sce.all.int, features = g[i], order = T,pt.size = 0.6) +
scale_color_gradient(low = "grey", high = "#44579a") + # 更改填充颜色
theme_void() + # 使用空白主题
theme( plot.title = element_text(hjust = 0.5, size = 16, face = "bold"), # 标题居中
legend.position = "none", # 去除图例
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
plot.background = element_blank())
}
# 拼图
library(patchwork)
# 有多少个基因,3行4咧
length(g)
# 使用 patchwork 的 wrap_plots() 函数组合图表
combined_plot <- wrap_plots(p_merge, ncol = 4)
combined_plot
# 保存
ggsave(filename = "Salt_UMAP.pdf", width = 11.5, height = 8, plot = combined_plot)
ggsave(filename = "Salt_UMAP.png", width = 11.5, height = 8, plot = combined_plot)
本文标签: 展示你的特征基因带quot辣椒粉quot的markers基因umap图
版权声明:本文标题:展示你的特征基因:带"辣椒粉"的markers基因umap图 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1748345616a2288515.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论