Closed ixxmu closed 1 year ago
分享是一种态度
scCustomize包由来自波士顿儿童医院/哈佛医学院的博士后Samuel E. Marsh编写。该包基于Seurat,提供了若干便捷、高效的可视化方法。根据官方教程学习其中感兴趣的用法。
https://github.com/samuel-marsh/scCustomize/ https://samuel-marsh.github.io/scCustomize/index.html
sce <- pbmc3k.SeuratData::pbmc3k.final
sce$sample_id <- sample(c("sample1", "sample2", "sample3"), size = ncol(sce),
replace = TRUE)
sce$treatment <- sample(c("before", "after"), size = ncol(sce),
replace = TRUE)
sce = sce %>%
NormalizeData() %>%
FindVariableFeatures() %>%
ScaleData()
sce = sce %>%
RunPCA() %>%
RunUMAP(dims = 1:30) %>% #RunTSNE
FindNeighbors(dims = 1:30) %>%
FindClusters(resolution = c(0.01, 0.05, 0.1, 0.2, 0.3, 0.5,0.8,1))
VariableFeaturePlot_scCustom(seurat_object = sce, num_features = 5,
label = TRUE, repel = TRUE)
Idents(sce) = "RNA_snn_res.0.01"
gene_list_plot <- VariableFeatures(sce)[1:5]
p1 = Stacked_VlnPlot(seurat_object = sce, features = gene_list_plot, x_lab_rotate = TRUE)
p2 = Stacked_VlnPlot(seurat_object = sce, features = gene_list_plot, plot_spacing = 0.3)
p3 = Stacked_VlnPlot(seurat_object = sce, features = gene_list_plot, split.by = "sample_id")
p4 = Stacked_VlnPlot(seurat_object = sce, features = gene_list_plot, split.by = "treatment", split.plot=TRUE)
(p1 | p2) / (p3 | p4)
Idents(sce) = "RNA_snn_res.0.2"
all_markers <- FindAllMarkers(object = sce)
top5_markers <- Extract_Top_Markers(marker_dataframe = all_markers, num_genes = 5, named_vector = FALSE,
make_unique = TRUE)
Clustered_DotPlot(seurat_object = sce, features = top5_markers) # 左
Clustered_DotPlot(seurat_object = sce, features = top5_markers, k = 6) # 右
FeaturePlot_scCustom(seurat_object = sce, features = "PTPRC", na_cutoff=2)
DimPlot_scCustom(seurat_object = sce, figure_plot = TRUE)
Idents(sce) = "RNA_snn_res.0.1"
p1 = Cluster_Highlight_Plot(seurat_object = sce, cluster_name = "0", highlight_color = "red",
background_color = "lightgray")
p2 = Cluster_Highlight_Plot(seurat_object = sce, cluster_name = c(2,3), highlight_color = c("red","blue"),
background_color = "lightgray")
p1 | p2
viridis_plasma_dark_high
,其它可选包括viridis_plasma_light_high
viridis_magma_dark_high
viridis_magma_light_high
viridis_inferno_dark_high
viridis_inferno_light_high
viridis_dark_high
viridis_light_high
PalettePlot(pal = viridis_plasma_dark_high)
# FeaturePlot_scCustom(seurat_object = sce, colors_use = viridis_magma_dark_high, features = "CD3E")
PalettePlot(pal = DiscretePalette_scCustomize(num_colors = 10, palette = "polychrome"))
PalettePlot(pal = DiscretePalette_scCustomize(num_colors = 10, palette = "ditto_seq", shuffle_pal = TRUE))
如果你对单细胞转录组研究感兴趣,但又不知道如何入门,也许你可以关注一下下面的课程
看完记得顺手点个“在看”哦!
长按扫码可关注
https://mp.weixin.qq.com/s/Y8sPLN05SKXHtjFQtFTBrA