Marker Plot

用经典 marker 核对各大类在图上的位置。点大、颜色深表示该基因更常见、表达更高。

pacman::p_load(Seurat, tidyverse, qs2, cowplot)
knitr::opts_knit$set(root.dir = "/home/han/Desktop/guoqiang/stroke_bm/stroke_bm_Rproj")
setwd("/home/han/Desktop/guoqiang/stroke_bm/stroke_bm_Rproj")
source("codes/functions.R")
res_path <- "results/marker_umap"
if (!dir.exists(res_path)) {
  dir.create(res_path, recursive = TRUE)
}
alpha <- .03
pt_size <- .03
raster <- FALSE
raster_dpi <- c(3000, 3000)
min_cutoff <- "q10"
max_cutoff <- "q90"

1. Marker Plot

每个基因一张图。应对得上教科书位置,例如 CD3D 在 T、MS4A1 在 B、FCGR3B 或 S100A8 在中性粒。

seurat_object <-
  qs_read(
    "data/rdata/dim_reduction/seurat_object_clustered.qs2",
    nthreads = 10
  )
DefaultAssay(seurat_object)
[1] "RNA"
Layers(seurat_object)
[1] "counts"     "data"       "scale.data"

HSC

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CD34", "PROM1", "SPINK2", "AVP", "CRHBP", "HLF"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("HSC", ".pdf")),
  width = 18, height = 10
)

CMP

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("PRSS57", "FLT3", "RNASE2",
               "CD34", "IL3RA", "KIT",
               "SPI1", "MYB", "GATA1"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("CMP", ".pdf")),
  width = 18, height = 15
)

MDP

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CSF1R", "KLF4", "SAMHD1", "LGALS1", "LSP1", "FLT3"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("MDP", ".pdf")),
  width = 18, height = 10
)

MP

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CEBPD", "VCAN", "CD36", "FCGR1A", "CSF1R", "CD14"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("MP", ".pdf")),
  width = 18, height = 10
)

CLP

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("IL7R", "FLT3", "DNTT", "MME", "SPINK2"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("CLP", ".pdf")),
  width = 18, height = 10
)

Pro-B

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CD34", "VPREB1", "IGLL1", "EBF1", "PAX5", "DNTT"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("ProB", ".pdf")),
  width = 18, height = 10
)

Large Pre-B

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("VPREB1", "IGLL1", "CD19", "MKI67", "TOP2A", "PCNA"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Large_PreB", ".pdf")),
  width = 18, height = 10
)

Small Pre-B

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 2,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("RAG1", "RAG2", "CD19", "CD38"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Small_PreB", ".pdf")),
  width = 12, height = 10
)

GMP

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("AZU1", "MPO", "ELANE", "CTSG", "PRTN3", "CSF3R"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("GMP", ".pdf")),
  width = 18, height = 10
)

Promyelocyte

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("DEFA1", "DEFA3", "DEFA4",
               "AZU1", "MPO", "ELANE", "CTSG", "PRTN3"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Promyelocyte", ".pdf")),
  width = 18, height = 15
)

NP

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("LTF", "LCN2", "CAMP", "MNDA", "RETN", "FCGR3B"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("NP", ".pdf")),
  width = 18, height = 10
)

Neutrophil

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 2,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("NAMPT", "CSF3R", "S100A8", "S100A9"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Neutrophil", ".pdf")),
  width = 12, height = 10
)

Monocyte

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CD14", "CD68", "VCAN", "LYZ", "FCGR3A"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Monocyte", ".pdf")),
  width = 18, height = 10
)

Macrophage

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 2,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CD68", "C1QA", "C1QB", "C1QC"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Macrophage", ".pdf")),
  width = 12, height = 10
)

DC

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CLEC9A", "XCR1", "BATF3", # cDC1
               "CD1C", "FCER1A", "CLEC10A", # cDC2
               "CCR7", "LAMP3", "CCL19"), # migDC
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("DC", ".pdf")),
  width = 18, height = 15
)

pDC

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 2,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CLEC4C", "IL3RA", "LILRA4", "GZMB"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("pDC", ".pdf")),
  width = 12, height = 10
)

T cell

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CD3D", "CD3E", "CD3G", "CD4", "CD8A", "CD8B"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("T_cell", ".pdf")),
  width = 18, height = 10
)

B cell

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 2,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CD79A", "CD79B", "CD19", "MS4A1"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("B_cell", ".pdf")),
  width = 12, height = 10
)

Plasma cell

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 2,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("MZB1", "SDC1", "JCHAIN", "IGHG1"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Plasma_cell", ".pdf")),
  width = 12, height = 10
)

NK cell

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 3,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("KLRD1", "NCAM1", "XCL1", "CCL5", "NKG7", "GNLY"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("NK_cell", ".pdf")),
  width = 18, height = 10
)

Erythrocyte

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 4,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("CD36", "GYPA", "AHSP", "CA1",
               "HBB", "HBA1", "HBA2", "ALAS2",
               "SLC4A1", "TFRC", "KLF1", "GATA1"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Erythrocyte", ".pdf")),
  width = 24, height = 15
)

Megakaryocyte

FeaturePlot(
  seurat_object, reduction = "umap_harmony", ncol = 2,
  min.cutoff = min_cutoff, max.cutoff = max_cutoff,
  features = c("GP9", "PPBP", "PF4", "PECAM1"),
  pt.size = pt_size, alpha = alpha, raster = raster, raster.dpi = raster_dpi
)

ggsave(
  file.path(res_path, paste0("Megakaryocyte", ".pdf")),
  width = 12, height = 10
)
sessionInfo()
R version 4.4.3 (2025-02-28)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Asia/Shanghai
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] cowplot_1.1.3      qs2_0.1.7          lubridate_1.9.3    forcats_1.0.0     
 [5] stringr_1.5.1      dplyr_1.1.4        purrr_1.0.2        readr_2.1.5       
 [9] tidyr_1.3.1        tibble_3.2.1       ggplot2_3.5.1      tidyverse_2.0.0   
[13] Seurat_5.2.1       SeuratObject_5.0.2 sp_2.1-4          

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3     jsonlite_1.8.9         magrittr_2.0.3        
  [4] spatstat.utils_3.1-1   farver_2.1.2           rmarkdown_2.29        
  [7] ragg_1.3.3             vctrs_0.6.5            ROCR_1.0-11           
 [10] spatstat.explore_3.3-3 htmltools_0.5.8.1      sctransform_0.4.1     
 [13] parallelly_1.39.0      KernSmooth_2.23-26     htmlwidgets_1.6.4     
 [16] ica_1.0-3              plyr_1.8.9             plotly_4.10.4         
 [19] zoo_1.8-12             igraph_2.1.2           mime_0.12             
 [22] lifecycle_1.0.4        pkgconfig_2.0.3        Matrix_1.7-3          
 [25] R6_2.5.1               fastmap_1.2.0          fitdistrplus_1.2-1    
 [28] future_1.34.0          shiny_1.9.1            digest_0.6.37         
 [31] colorspace_2.1-1       patchwork_1.3.0        tensor_1.5            
 [34] RSpectra_0.16-2        irlba_2.3.5.1          textshaping_0.4.0     
 [37] labeling_0.4.3         progressr_0.15.1       fansi_1.0.6           
 [40] spatstat.sparse_3.1-0  timechange_0.3.0       httr_1.4.7            
 [43] polyclip_1.10-7        abind_1.4-8            compiler_4.4.3        
 [46] withr_3.0.2            fastDummies_1.7.4      MASS_7.3-65           
 [49] tools_4.4.3            lmtest_0.9-40          httpuv_1.6.15         
 [52] future.apply_1.11.3    goftest_1.2-3          glue_1.8.0            
 [55] nlme_3.1-166           promises_1.3.2         grid_4.4.3            
 [58] Rtsne_0.17             cluster_2.1.8.1        reshape2_1.4.4        
 [61] generics_0.1.3         gtable_0.3.6           spatstat.data_3.1-4   
 [64] tzdb_0.4.0             data.table_1.16.2      hms_1.1.3             
 [67] stringfish_0.18.0      utf8_1.2.4             spatstat.geom_3.3-4   
 [70] RcppAnnoy_0.0.22       ggrepel_0.9.6          RANN_2.6.2            
 [73] pillar_1.9.0           spam_2.11-0            RcppHNSW_0.6.0        
 [76] later_1.4.1            splines_4.4.3          lattice_0.22-6        
 [79] survival_3.8-3         deldir_2.0-4           tidyselect_1.2.1      
 [82] miniUI_0.1.1.1         pbapply_1.7-2          knitr_1.49            
 [85] gridExtra_2.3          scattermore_1.2        xfun_0.49             
 [88] matrixStats_1.4.1      stringi_1.8.4          lazyeval_0.2.2        
 [91] yaml_2.3.10            pacman_0.5.1           evaluate_1.0.1        
 [94] codetools_0.2-20       cli_3.6.3              uwot_0.2.2            
 [97] RcppParallel_5.1.9     systemfonts_1.1.0      xtable_1.8-4          
[100] reticulate_1.42.0      munsell_0.5.1          Rcpp_1.0.13-1         
[103] globals_0.16.3         spatstat.random_3.3-2  png_0.1-8             
[106] spatstat.univar_3.1-1  parallel_4.4.3         dotCall64_1.2         
[109] listenv_0.9.1          viridisLite_0.4.2      scales_1.3.0          
[112] ggridges_0.5.6         rlang_1.1.4