library(scater) #feature plots # the devel version for repel.
library(here) # reproducible paths
library(patchwork) # agregate plots
library(scran) # for findmarkers
library(pals) # for palettes with large n #kelly()22, #polychrome()#36, unname(alphabet())
project <- "fire-mice"
cols25 <- unname(cols25())
# remove the black and white from the pallete, and the similars to cols25
# assessed with pal.bands and pal.cube
kelly_col <- unname(kelly()[-c(1,2,5,6)])
# remove the colours that are similar to the 
cols25 <- 
cols <- c(kelly_col, cols25)
if (!file.exists(here("processed", project, "sce_anno_01.RDS"))) {
  sce <- readRDS(here("processed", project, "sce_clusters_01.RDS"))
}else{
  sce <- readRDS(here("processed", project, "sce_anno_01.RDS"))
}

Annotation

We make a first rough annotation using known markers for different celltypes.

plotTSNE(sce, colour_by = "originalexp_snn_res.0.6", text_by = "originalexp_snn_res.0.6", force = 0) + scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Click to expand the Neurons marker plots
#Neurons:
list_plots <- lapply(c("Snap25", "Stmn2", "Rbfox3", "Gabrb2"),
                     function(x)plotTSNE(sce, colour_by = x ))

wrap_plots(list_plots) +  plot_annotation(title = "Neurons")

plotExpression(sce, features=c("Snap25", "Stmn2", "Rbfox3", "Gabrb2") ,
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

#Inhibitory neurons

list_plots <- lapply(c("Gad1", "Gad2", "Slc32a1", "Pvalb"),
                     function(x)plotTSNE(sce, colour_by = x ))
wrap_plots(list_plots) +  plot_annotation(title =  "Inhibitory Neurons")

plotExpression(sce, features=c("Gad1", "Gad2", "Slc32a1", "Pvalb"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

# Excitatory neurons

list_plots <- lapply(c("Satb2", "Slc12a6", "Slc17a7"),
                     function(x)plotTSNE(sce, colour_by = x )) 
wrap_plots(list_plots) +  plot_annotation(title =  "Exitatory Neurons")

plotExpression(sce, features=c("Satb2", "Slc12a6", "Slc17a7"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

# RBFOX3 (and other Granulate cell markers)
list_plots <- lapply(c("Cdh15", "Calb2", "Rbfox3", "Reln"),
function(x)plotTSNE(sce, colour_by = x )) 
wrap_plots(list_plots) +  plot_annotation(title =  "RBFO3+ Neurons")

plotExpression(sce, features=c("Cdh15", "Calb2", "Rbfox3", "Reln"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Click to expand the Stromal marker plots
#Stromal

list_plots <- lapply(c( "Lamb1" , 
                                     "Hspg2", 
                                     "Col4a1", 
                                     "Fn1", 
                                     "Lama2"),
            function(x) plotTSNE(sce, colour_by = x ))

wrap_plots(list_plots) +  plot_annotation(title =  "Stromal")

plotExpression(sce, features=c( "Lamb1" , 
                                     "Hspg2", 
                                     "Col4a1", 
                                     "Fn1", 
                                     "Lama2"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

# Endothelial cells and pericytes

list_plots <- lapply(c( "Cldn5",   
                                     "Icam2",
                                     "Pdgfrb", 
                                     "Notch3", 
                                     "Vwf",
                                     "Flt1",
                                     "Mecom"),
                     function(x)plotTSNE(sce, colour_by = x ))
wrap_plots(list_plots) +  plot_annotation(title =  " Endothelial cells and pericytes")

plotExpression(sce, features=c( "Cldn5",   
                                     "Icam2",
                                     "Pdgfrb", 
                                     "Notch3", 
                                     "Vwf",
                                     "Flt1",
                                     "Mecom"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Click to expand the Epithelial cells
list_plots <- lapply(c("Ttr", "Kcnj13", "Krt18"),
                     function(x)plotTSNE(sce, colour_by = x ))
wrap_plots(list_plots) +  plot_annotation(title =  "Choroid plexus epithelial cells")

plotExpression(sce, features=c("Ttr", "Kcnj13", "Krt18"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Click to expand the Astrocytes marker plots
# Astrocytes

list_plots <- lapply(c("Gja1",
                                    "Aqp4", 
                                    "Glul", 
                                    "Sox9", 
                                    "Ndrg2", 
                                    "Gfap", 
                                    "Aldh1a1", 
                                    "Aldh1l1", 
                                    "Vim", 
                                    "Apoe", 
                                    "Fgfr3"),
                     function(x)plotTSNE(sce, colour_by = x ))
wrap_plots(list_plots) +  plot_annotation(title = "Astrocyte")

plotExpression(sce, features=c("Gja1",
                                    "Aqp4", 
                                    "Glul", 
                                    "Sox9", 
                                    "Ndrg2", 
                                    "Gfap", 
                                    "Aldh1a1", 
                                    "Aldh1l1", 
                                    "Vim", 
                                    "Apoe", 
                                    "Fgfr3"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

#Astrocyte markers as described in Zeisel et al. 2018 in the mouse for telencephalon and non-telencephalon astrocytes

list_plots <- lapply(c( "Agt", 
                                     "Mfge8",  
                                     "Slc6a11",
                                     "Slc6a9", 
                                     "Gdf10",
                                     "Islr",
                                     "Gfap",
                                     "Aqp4")  ,
                     function(x)plotTSNE(sce, colour_by = x ))
wrap_plots(list_plots) +  plot_annotation(title = "Astrocyte mouse telecephalon")

Click to expand the Immune cells plots
#Microglia and macrophages

list_plots <- lapply(c( "Cd74", 
                                     "Spi1", 
                                     "Mrc1", 
                                     "Tmem119", 
                                     "Cx3cr1", 
                                     "Aif1",
                                     "P2ry12",
                                     "C1qc",
                                     "C1qa"),
            function(x)plotTSNE(sce, colour_by = x )) 
wrap_plots(list_plots) +  plot_annotation(title = "Microglia and macrophages")

plotExpression(sce, features=c( "Cd74", 
                                     "Spi1", 
                                     "Mrc1", 
                                     "Tmem119", 
                                     "Cx3cr1", 
                                     "Aif1",
                                     "P2ry12",
                                     "C1qc",
                                     "C1qa"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

# Border associated mcrophages
list_plots <- lapply(c( "Mrc1", "Ms4a7", "Apoe"),
            function(x)plotTSNE(sce, colour_by = x )) 
wrap_plots(list_plots) +  plot_annotation(title = "Border associated macrophages")

plotExpression(sce, features=c( "Mrc1", "Ms4a7", "Apoe"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

# Immune cells 
list_plots <- lapply(c( 
  # Tcells
  "Cd3e", 
  # Bcells
  "Cd19", 
  # Natural killer
  "Klrb1c", "Cd209a", 
  # all immune cells (CD45)
  "Ptprc"),
            function(x)plotTSNE(sce, 
                                colour_by = x ,
                                point_alpha=0.3,
                                point_size = 0.5)) 
wrap_plots(list_plots) +  plot_annotation(title = "Immune cells")

plotExpression(sce, features=c( 
  # Tcells
  "Cd3e", 
  # Bcells
  "Cd19", 
  # Natural killer
  "Klrb1c", "Cd209a", 
  # all immune cells (CD45)
  "Ptprc"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

#monocybes/neutrophils
list_plots <- lapply(c( 
  # monocytes
  "S100a9",
  #neutrophils
  "Ly6g", "Camp"),
            function(x)plotTSNE(sce, 
                                colour_by = x ,
                                point_alpha=0.3,
                                point_size = 0.5)) 
wrap_plots(list_plots) +  plot_annotation(title = "Monocytes and Neutorphils cells")

plotExpression(sce, features=c( 
   # monocytes
  "S100a9",
  #neutrophils
  "Ly6g", "Camp"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Click to expand the Oligodendroglia marker plots
#OPCs

list_plots <- lapply(c("Pdgfra", 
                                    "Cspg4", 
                                    "Gpr17", 
                                    "Ptprz1",
                                    "Olig1", 
                                    "Olig2", 
                                    "Pcdh15", 
                                    "Ptgds",
                                    "Bcan"),
            function(x)plotTSNE(sce, colour_by = x )) 
wrap_plots(list_plots) +  plot_annotation(title = "OPCS")

plotExpression(sce, features=c("Pdgfra", 
                                    "Cspg4", 
                                    "Gpr17", 
                                    "Ptprz1",
                                    "Olig1", 
                                    "Olig2", 
                                    "Pcdh15", 
                                    "Ptgds",
                                    "Bcan"),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

#Oligodendrocytes

list_plots <- lapply(c("Plp1", 
                                    "Cnp", 
                                    "Mag", 
                                    "Mog", 
                                    "Mobp", 
                                    "Mbp", 
                                    "Sox10" ), 
            function(x)plotTSNE(sce, colour_by = x ))
wrap_plots(list_plots) +  plot_annotation(title =  "Oligodendrocytes")

plotExpression(sce, features=c("Plp1", 
                                    "Cnp", 
                                    "Mag", 
                                    "Mog", 
                                    "Mobp", 
                                    "Mbp", 
                                    "Sox10" ),
    x="originalexp_snn_res.0.6", colour_by = "originalexp_snn_res.0.6", ncol=1) +  scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Click to expand the ependymal marker plots
list_plots <- lapply(c("Vit", "Sox9", "Dynlrb2", "Ccdc153", "Rsph1", "Tm4sf1", "Pcp4l1", "Pcp4", "Hspa2", "Cd24a", "Mt2", "Chchd10"), 
           function(x)plotTSNE(sce, colour_by = x )) 
wrap_plots(list_plots) +  plot_annotation(title =  "Ependymal")

â™ 

Rename the Clusters with assigned Cell Types

With the help of the known markers plotted above the celltype identity of every cluster has benn identified.

Renaming the clusters accordingly:

plotTSNE(sce, colour_by = "originalexp_snn_res.0.6", text_by = "originalexp_snn_res.0.6", force = 0) + scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

if (!file.exists(here("processed", project, "sce_anno_01.RDS"))) {
annotation <- read.csv(here("data","young_data_cluster_names_anno_01.csv"))
celltype <- annotation$Celltype
sce$celltype <- as.factor(sce$originalexp_snn_res.0.6)
# add the celltypes as described above in the correct order to replace the levels.
levels(sce$celltype) <- celltype

# same with the cluster_names
cluster_names <- annotation$ClusterName
sce$cluster_names <- as.factor(sce$originalexp_snn_res.0.6)
levels(sce$cluster_names) <- cluster_names

 saveRDS(sce, here("processed", project, "sce_anno_01.RDS"))
}
plotTSNE(sce, colour_by = "celltype", text_by = "celltype", text_size = 3, force = 1) + scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

plotTSNE(sce, colour_by = "cluster_names", text_by = "cluster_names", text_size = 3, force = 1) + scale_color_manual(values = cols)
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Session Info

Click to expand
sessionInfo()
## R version 4.1.1 (2021-08-10)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19043)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=English_United Kingdom.1252 
## [2] LC_CTYPE=English_United Kingdom.1252   
## [3] LC_MONETARY=English_United Kingdom.1252
## [4] LC_NUMERIC=C                           
## [5] LC_TIME=English_United Kingdom.1252    
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] pals_1.7                    scran_1.22.1               
##  [3] patchwork_1.1.1             here_1.0.1                 
##  [5] scater_1.23.5               ggplot2_3.3.5              
##  [7] scuttle_1.4.0               SingleCellExperiment_1.16.0
##  [9] SummarizedExperiment_1.24.0 Biobase_2.54.0             
## [11] GenomicRanges_1.46.1        GenomeInfoDb_1.30.1        
## [13] IRanges_2.28.0              S4Vectors_0.32.3           
## [15] BiocGenerics_0.40.0         MatrixGenerics_1.6.0       
## [17] matrixStats_0.61.0         
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-7              rprojroot_2.0.2          
##  [3] tools_4.1.1               bslib_0.3.1              
##  [5] utf8_1.2.2                R6_2.5.1                 
##  [7] irlba_2.3.5               vipor_0.4.5              
##  [9] DBI_1.1.2                 colorspace_2.0-2         
## [11] withr_2.4.3               tidyselect_1.1.1         
## [13] gridExtra_2.3             compiler_4.1.1           
## [15] cli_3.2.0                 BiocNeighbors_1.12.0     
## [17] DelayedArray_0.20.0       labeling_0.4.2           
## [19] sass_0.4.0                scales_1.1.1             
## [21] stringr_1.4.0             digest_0.6.29            
## [23] rmarkdown_2.11            XVector_0.34.0           
## [25] dichromat_2.0-0           pkgconfig_2.0.3          
## [27] htmltools_0.5.2           sparseMatrixStats_1.6.0  
## [29] highr_0.9                 maps_3.4.0               
## [31] fastmap_1.1.0             limma_3.50.0             
## [33] rlang_1.0.1               rstudioapi_0.13          
## [35] DelayedMatrixStats_1.16.0 farver_2.1.0             
## [37] jquerylib_0.1.4           generics_0.1.2           
## [39] jsonlite_1.7.3            BiocParallel_1.28.3      
## [41] dplyr_1.0.8               RCurl_1.98-1.6           
## [43] magrittr_2.0.2            BiocSingular_1.10.0      
## [45] GenomeInfoDbData_1.2.7    Matrix_1.4-0             
## [47] Rcpp_1.0.8                ggbeeswarm_0.6.0         
## [49] munsell_0.5.0             fansi_1.0.2              
## [51] viridis_0.6.2             lifecycle_1.0.1          
## [53] stringi_1.7.6             yaml_2.2.2               
## [55] edgeR_3.36.0              zlibbioc_1.40.0          
## [57] grid_4.1.1                parallel_4.1.1           
## [59] ggrepel_0.9.1             dqrng_0.3.0              
## [61] crayon_1.5.0              lattice_0.20-45          
## [63] cowplot_1.1.1             beachmat_2.10.0          
## [65] mapproj_1.2.8             locfit_1.5-9.4           
## [67] metapod_1.2.0             knitr_1.37               
## [69] pillar_1.7.0              igraph_1.2.11            
## [71] codetools_0.2-18          ScaledMatrix_1.2.0       
## [73] glue_1.6.1                evaluate_0.14            
## [75] vctrs_0.3.8               gtable_0.3.0             
## [77] purrr_0.3.4               assertthat_0.2.1         
## [79] xfun_0.29                 rsvd_1.0.5               
## [81] viridisLite_0.4.0         tibble_3.1.6             
## [83] beeswarm_0.4.0            cluster_2.1.2            
## [85] statmod_1.4.36            bluster_1.4.0            
## [87] ellipsis_0.3.2