Getting Started with scGenePanel

Source: vignettes/scGenePanel.Rmd

Introduction

scGenePanel is an R package designed to visualize single-cell RNA-seq gene expression data. Specifically, it provides a multi-panel plot that allows users to visualize gene expression counts across different cell identities and types. This package is particularly useful for researchers interested in exploring gene expression patterns in single-cell datasets.

Why scGenePanel in Bioconductor?

Single-cell workflows commonly use either Seurat objects or Bioconductor’s SingleCellExperiment class. scGenePanel accepts both, allowing the same gene-centred visualization workflow to be used alongside established Bioconductor infrastructure and across analysis pipelines. Rather than replacing general-purpose analysis or plotting tools, it assembles a recurring exploratory task into one coordinated output: group-stratified embeddings, expression distributions, and cell-frequency/expression summaries for a chosen gene and cell population. This makes the visualization specification easier to reuse in scripts while retaining an interactive Shiny interface for exploration.

Features of scGenePanel visual

  • A multi-panel plot that contains:
    • UMAP : Visualize cluster of cells, split by cell identity of interest and highlight cell type of interest
    • Violin plot : Visualize gene expression counts, colored by cell identity of interest, split by cell type of interest and significance test computed on cell identity of interest
    • Tabular plot : Quantify cell counts, cell counts >0.25, % expressed and quantiles of gene expression counts per cell identity of interest
  • Accepts two commonly used input data object (Seurat, SingleCellExperiment)
  • “Tableau” or “RColorBrewer” discrete qualitative color palettes options available
  • Order of cell identity of interest can be changed via group_order parameter
  • Shiny version to explore gene expression data interactively

Installation

From Github repository

library(devtools)
install_github("vandydata/scGenePanel")

From local source (Git clone)

install.packages("/path/to/scGenePanel", repos = NULL, type = "source")
#with dependencies
install.packages("scGenePanel", repos = NULL, type = "source", dependencies = TRUE)

Data included in this package

The package comes with two test datasets: Seurat and SingleCellExperiment objects. For this vignette, a Seurat dataset - human_panc_islets.Rds - is included in this package. This Seurat object contains single cell RNAseq data of human pancreatic islets from five healthy donors published in Shrestha et al., JCI Insight (2021) that has been downsampled to 500 cells. The complete dataset is available in zenodo. Also included in this package is a SCE dataset - sce_object.Rds.

Key annotations included in the metadata are:

  • CellTypes - cell types annotations
  • Age - donor age

Load data

scGenePanel works with Seurat and SingleCellExperiment objects as the main input data. To load test data:

seurat_object <- readRDS(system.file("extdata", "human_panc_islets.Rds", package="scGenePanel"))
sce_object <- readRDS(system.file("extdata", "sce_object.Rds", package="scGenePanel"))

Alternatively, you can use your own Seurat or SingleCellExperiment object.

Create a multi-panel plot

library(Seurat)

# Load the Seurat object
data <- readRDS(system.file("extdata", "human_panc_islets.Rds", package="scGenePanel"))

# Set the cell identity metadata
Idents(data) <- "CellTypes"

# Filter the dataset to include only specific cell identities and age of interest
data <- subset(x = data, idents = c("Alpha", "Beta", "Delta"))
data <- subset(x = data, subset = Age %in% c("14y", "39y", "66y"))

# Cell type distribution
table(data$CellTypes)
## 
##       Alpha        Beta       Delta       Gamma     Epsilon      Acinar 
##         177          57           3           0           0           0 
##      Ductal Endothelial    Stellate      Immune 
##           0           0           0           0
# Age distribution
table(data$Age)
## 
## 14y 39y 50y 59y 66y 
##  57 135   0   0  45

scGenePanel() loads the multi-panel visual for the gene of interest among the cell identity of interest entered by parameter meta_group and cell type of interest entered by parameter cell_type_name.

library(scGenePanel)

scGenePanel(
    object = data,
    gene = "INS",
    meta_group = "Age",
    cell_type_name = "Beta",
    cell_type_colname = "CellTypes",
    col_palette = "Tableau",
    group_order = NULL,
    output_dir = tempdir()
  )
Figure 1. Example output from scGenePanel
Figure 1. Example output from scGenePanel

scGenePanelShiny() launches a Shiny app, allowing for interactive exploration of the gene expression data. In this case, you only need to provide the data object, the parameters will be set interactively in the app.

  • scGenePanel pre-fills your available cell type and group information, just pick the ones you want to visualize
  • Several color palettes previews are available
  • You can render the multi-plot or individual plots
  • You can save both PNG and PDF versions of the plots
library(scGenePanel)

if (interactive()) {
  scGenePanelShiny(object = data)
}
Figure 2. Shiny app
Figure 2. Shiny app

Session information

sessionInfo()
## R version 4.6.1 (2026-06-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 26.04.1 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so;  LAPACK version 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: Etc/UTC
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] scGenePanel_0.99.0 Seurat_5.6.0       SeuratObject_5.4.0 sp_2.2-3          
## [5] BiocStyle_2.41.0  
## 
## loaded via a namespace (and not attached):
##   [1] RcppAnnoy_0.0.23            splines_4.6.1              
##   [3] later_1.4.8                 tibble_3.3.1               
##   [5] polyclip_1.10-7             janitor_2.2.1              
##   [7] fastDummies_1.7.6           lifecycle_1.0.5            
##   [9] rstatix_1.1.0               globals_0.19.1             
##  [11] lattice_0.23-1              MASS_7.3-66                
##  [13] backports_1.5.1             magrittr_2.0.5             
##  [15] plotly_4.12.1               sass_0.4.10                
##  [17] rmarkdown_2.32              jquerylib_0.1.4            
##  [19] yaml_2.3.12                 httpuv_1.6.17              
##  [21] otel_0.2.0                  sctransform_0.4.3          
##  [23] spam_2.11-4                 zip_3.0.2                  
##  [25] askpass_1.2.1               spatstat.sparse_3.2-0      
##  [27] reticulate_1.47.0           cowplot_1.2.0              
##  [29] pbapply_1.7-5               buildtools_1.0.0           
##  [31] RColorBrewer_1.1-3          lubridate_1.9.5            
##  [33] abind_1.4-8                 Rtsne_0.17                 
##  [35] GenomicRanges_1.65.4        purrr_1.2.2                
##  [37] BiocGenerics_0.59.12        tweenr_2.0.3               
##  [39] circlize_0.4.18             gdtools_0.5.1              
##  [41] IRanges_2.47.5              S4Vectors_0.51.10          
##  [43] ggrepel_0.9.8               irlba_2.4.1                
##  [45] listenv_1.1.0               spatstat.utils_3.2-5       
##  [47] maketools_1.3.2             goftest_1.2-3              
##  [49] RSpectra_0.16-2             spatstat.random_3.5-2      
##  [51] fitdistrplus_1.2-6          parallelly_1.48.0          
##  [53] scCustomize_3.3.0           codetools_0.2-20           
##  [55] DelayedArray_0.39.8         ggforce_0.5.0              
##  [57] xml2_1.6.0                  shape_1.4.6.1              
##  [59] tidyselect_1.2.1            farver_2.1.2               
##  [61] shinyWidgets_0.9.1          matrixStats_1.5.0          
##  [63] stats4_4.6.1                spatstat.explore_3.8-3     
##  [65] Seqinfo_1.3.2               jsonlite_2.0.0             
##  [67] progressr_1.0.0             Formula_1.2-6              
##  [69] ggridges_0.5.7              survival_3.8-12            
##  [71] systemfonts_1.3.2           tools_4.6.1                
##  [73] ragg_1.5.2                  ica_1.0-3                  
##  [75] Rcpp_1.1.2                  glue_1.8.1                 
##  [77] gridExtra_2.3.1             SparseArray_1.13.4         
##  [79] xfun_0.61                   MatrixGenerics_1.25.0      
##  [81] ggthemes_7.0.0              dplyr_1.2.1                
##  [83] withr_3.0.3                 shinydashboard_0.7.3       
##  [85] BiocManager_1.30.27         fastmap_1.2.0              
##  [87] mcprogress_0.1.1            shinyjs_2.1.1              
##  [89] openssl_2.4.2               digest_0.6.39              
##  [91] timechange_0.4.0            R6_2.6.1                   
##  [93] mime_0.13                   ggprism_1.0.7              
##  [95] colorspace_2.1-3            textshaping_1.0.5          
##  [97] scattermore_1.2             tensor_1.5.1               
##  [99] spatstat.data_3.1-9         ggsci_5.2.0                
## [101] tidyr_1.3.2                 generics_0.1.4             
## [103] fontLiberation_0.1.0        data.table_1.18.6.1        
## [105] httr_1.4.9                  htmlwidgets_1.6.4          
## [107] S4Arrays_1.13.2             uwot_0.2.5                 
## [109] pkgconfig_2.0.3             gtable_0.3.6               
## [111] lmtest_0.9-40               S7_0.2.2                   
## [113] XVector_0.53.0              sys_3.4.3                  
## [115] htmltools_0.5.9             fontBitstreamVera_0.1.1    
## [117] carData_3.0-6               dotCall64_1.2              
## [119] scales_1.4.0                Biobase_2.73.2             
## [121] png_0.1-9                   snakecase_0.11.1           
## [123] spatstat.univar_3.2-0       knitr_1.52                 
## [125] reshape2_1.4.5              uuid_1.2-2                 
## [127] nlme_3.1-171                GlobalOptions_0.1.4        
## [129] cachem_1.1.0                zoo_1.9-1                  
## [131] flextable_0.10.1            stringr_1.6.0              
## [133] KernSmooth_2.23-27          vipor_0.4.7                
## [135] parallel_4.6.1              miniUI_0.1.2               
## [137] ggrastr_1.0.2               pillar_1.11.1              
## [139] grid_4.6.1                  vctrs_0.7.3                
## [141] RANN_2.6.3                  promises_1.5.0             
## [143] ggpubr_1.0.0                car_3.1-5                  
## [145] xtable_1.8-8                cluster_2.1.8.3            
## [147] paletteer_1.7.0             beeswarm_0.4.0             
## [149] evaluate_1.0.5              cli_3.6.6                  
## [151] compiler_4.6.1              rlang_1.3.0                
## [153] future.apply_1.20.2         ggsignif_0.6.4             
## [155] labeling_0.4.3              rematch2_2.1.2             
## [157] forcats_1.0.1               ggbeeswarm_0.7.3           
## [159] plyr_1.8.9                  stringi_1.8.9              
## [161] viridisLite_0.4.3           deldir_2.0-4               
## [163] spatstat.geom_3.8-3         fontquiver_0.2.1           
## [165] Matrix_1.7-6                RcppHNSW_0.7.0             
## [167] patchwork_1.3.2             future_1.76.0              
## [169] ggplot2_4.0.3               shiny_1.14.0               
## [171] SummarizedExperiment_1.43.0 ROCR_1.0-12                
## [173] igraph_2.3.4                broom_1.0.13               
## [175] bslib_0.12.0                officer_0.7.6