1 Installation

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("SingleCellMultiModal")

1.1 Load

library(SingleCellMultiModal)
library(MultiAssayExperiment)
library(scran)
library(scater)

2 Description

This data set consists of about 10K Peripheral Blood Mononuclear Cells (PBMCs) derived from a single healthy donor. It is available from the 10x Genomics website.

Provided are the RNA expression counts quantified at the gene level and the chromatin accessibility levels quantified at the peak level. Here we provide the default peaks called by the CellRanger software. If you want to explore other peak definitions or chromatin accessibility quantifications (at the promoter level, etc.), you have download the fragments.tsv.gz file from the 10x Genomics website.

3 Downloading datasets

The user can see the available dataset by using the default options

mae <- scMultiome("pbmc_10x", mode = "*", dry.run = FALSE, format = "MTX")
## snapshotDate(): 2022-04-19
## Working on: pbmc_atac_se.rds
## Working on: pbmc_atac.mtx.gz
## Working on: pbmc_rna_se.rds
## Working on: pbmc_rna.mtx.gz
## Working on: pbmc_atac,
##  pbmc_rna
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## Working on: pbmc_atac,
##  pbmc_rna
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## Working on: pbmc_colData
## Working on: pbmc_sampleMap
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache

4 Exploring the data structure

There are two assays: rna and atac, stored as SingleCellExperiment objects

mae
## A MultiAssayExperiment object of 2 listed
##  experiments with user-defined names and respective classes.
##  Containing an ExperimentList class object of length 2:
##  [1] atac: SingleCellExperiment with 108344 rows and 10032 columns
##  [2] rna: SingleCellExperiment with 36549 rows and 10032 columns
## Functionality:
##  experiments() - obtain the ExperimentList instance
##  colData() - the primary/phenotype DataFrame
##  sampleMap() - the sample coordination DataFrame
##  `$`, `[`, `[[` - extract colData columns, subset, or experiment
##  *Format() - convert into a long or wide DataFrame
##  assays() - convert ExperimentList to a SimpleList of matrices
##  exportClass() - save data to flat files

where the cells are the same in both assays:

upsetSamples(mae)

4.1 Cell metadata

Columns:

  • nCount_RNA: number of read counts
  • nFeature_RNA: number of genes with at least one read count
  • nCount_ATAC: number of ATAC read counts
  • nFeature_ATAC: number of ATAC peaks with at least one read count
  • celltype: The cell types have been annotated by the 10x Genomics R&D team using gene markers. They provide a rough characterisation of the cell type diversity, but keep in mind that they are not ground truth labels.
  • broad_celltype: Lymphoid or Myeloid origin

The cells have not been QC-ed, choosing a minimum number of genes/peaks per cell depends is left to you! In addition, there are further quality control criteria that you may want to apply, including mitochondrial coverage, fraction of reads overlapping ENCODE Blacklisted regions, Transcription start site enrichment, etc. See suggestions below for software that can perform a semi-automated quality control pipeline

head(colData(mae))
## DataFrame with 6 rows and 6 columns
##                  nCount_RNA nFeature_RNA nCount_ATAC nFeature_ATAC
##                   <integer>    <integer>   <integer>     <integer>
## AAACAGCCAAGGAATC       8380         3308       55582         13878
## AAACAGCCAATCCCTT       3771         1896       20495          7253
## AAACAGCCAATGCGCT       6876         2904       16674          6528
## AAACAGCCAGTAGGTG       7614         3061       39454         11633
## AAACAGCCAGTTTACG       3633         1691       20523          7245
## AAACAGCCATCCAGGT       7782         3028       22412          8602
##                                celltype broad_celltype
##                             <character>    <character>
## AAACAGCCAAGGAATC      naive CD4 T cells       Lymphoid
## AAACAGCCAATCCCTT     memory CD4 T cells       Lymphoid
## AAACAGCCAATGCGCT      naive CD4 T cells       Lymphoid
## AAACAGCCAGTAGGTG      naive CD4 T cells       Lymphoid
## AAACAGCCAGTTTACG     memory CD4 T cells       Lymphoid
## AAACAGCCATCCAGGT non-classical monocy..        Myeloid

4.2 RNA expression

The RNA expression consists of 36,549 genes and 10,032 cells, stored using the dgCMatrix sparse matrix format

dim(experiments(mae)[["rna"]])
## [1] 36549 10032
names(experiments(mae))
## [1] "atac" "rna"

Let’s do some standard dimensionality reduction plot:

sce.rna <- experiments(mae)[["rna"]]

# Normalisation
sce.rna <- logNormCounts(sce.rna)

# Feature selection
decomp <- modelGeneVar(sce.rna)
hvgs <- rownames(decomp)[decomp$mean>0.01 & decomp$p.value <= 0.05]
sce.rna <- sce.rna[hvgs,]

# PCA
sce.rna <- runPCA(sce.rna, ncomponents = 25)

# UMAP
set.seed(42)
sce.rna <- runUMAP(sce.rna, dimred="PCA", n_neighbors = 25, min_dist = 0.3)
plotUMAP(sce.rna, colour_by="celltype", point_size=0.5, point_alpha=1)

4.3 Chromatin Accessibility

The ATAC expression consists of 108,344 peaks and 10,032 cells:

dim(experiments(mae)[["atac"]])
## [1] 108344  10032

Let’s do some standard dimensionality reduction plot. Note that scATAC-seq data is sparser than scRNA-seq, almost binary. The log normalisation + PCA approach that scater implements for scRNA-seq is not a good strategy for scATAC-seq data. Topic modelling or TFIDF+SVD are a better strategy. Please see the package recommendations below.

sce.atac <- experiments(mae)[["atac"]]

# Normalisation
sce.atac <- logNormCounts(sce.atac)

# Feature selection
decomp <- modelGeneVar(sce.atac)
hvgs <- rownames(decomp)[decomp$mean>0.25]
sce.atac <- sce.atac[hvgs,]

# PCA
sce.atac <- runPCA(sce.atac, ncomponents = 25)

# UMAP
set.seed(42)
sce.atac <- runUMAP(sce.atac, dimred="PCA", n_neighbors = 25, min_dist = 0.3)
plotUMAP(sce.atac, colour_by="celltype", point_size=0.5, point_alpha=1)

5 Suggested software for the downstream analysis

These are my personal recommendations of R-based analysis software:

6 sessionInfo

sessionInfo()
## R version 4.2.0 RC (2022-04-19 r82224)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.15-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [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       
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] scater_1.24.0               ggplot2_3.3.5              
##  [3] scran_1.24.0                scuttle_1.6.0              
##  [5] rhdf5_2.40.0                SingleCellExperiment_1.18.0
##  [7] RaggedExperiment_1.20.0     SingleCellMultiModal_1.8.0 
##  [9] MultiAssayExperiment_1.22.0 SummarizedExperiment_1.26.0
## [11] Biobase_2.56.0              GenomicRanges_1.48.0       
## [13] GenomeInfoDb_1.32.0         IRanges_2.30.0             
## [15] S4Vectors_0.34.0            BiocGenerics_0.42.0        
## [17] MatrixGenerics_1.8.0        matrixStats_0.62.0         
## [19] BiocStyle_2.24.0           
## 
## loaded via a namespace (and not attached):
##   [1] AnnotationHub_3.4.0           BiocFileCache_2.4.0          
##   [3] plyr_1.8.7                    igraph_1.3.1                 
##   [5] BiocParallel_1.30.0           digest_0.6.29                
##   [7] htmltools_0.5.2               viridis_0.6.2                
##   [9] magick_2.7.3                  fansi_1.0.3                  
##  [11] magrittr_2.0.3                memoise_2.0.1                
##  [13] ScaledMatrix_1.4.0            SpatialExperiment_1.6.0      
##  [15] cluster_2.1.3                 limma_3.52.0                 
##  [17] Biostrings_2.64.0             R.utils_2.11.0               
##  [19] colorspace_2.0-3              blob_1.2.3                   
##  [21] rappdirs_0.3.3                ggrepel_0.9.1                
##  [23] xfun_0.30                     dplyr_1.0.8                  
##  [25] crayon_1.5.1                  RCurl_1.98-1.6               
##  [27] jsonlite_1.8.0                glue_1.6.2                   
##  [29] gtable_0.3.0                  zlibbioc_1.42.0              
##  [31] XVector_0.36.0                UpSetR_1.4.0                 
##  [33] DelayedArray_0.22.0           BiocSingular_1.12.0          
##  [35] DropletUtils_1.16.0           Rhdf5lib_1.18.0              
##  [37] HDF5Array_1.24.0              scales_1.2.0                 
##  [39] DBI_1.1.2                     edgeR_3.38.0                 
##  [41] Rcpp_1.0.8.3                  viridisLite_0.4.0            
##  [43] xtable_1.8-4                  dqrng_0.3.0                  
##  [45] bit_4.0.4                     rsvd_1.0.5                   
##  [47] metapod_1.4.0                 httr_1.4.2                   
##  [49] ellipsis_0.3.2                farver_2.1.0                 
##  [51] pkgconfig_2.0.3               R.methodsS3_1.8.1            
##  [53] uwot_0.1.11                   sass_0.4.1                   
##  [55] dbplyr_2.1.1                  locfit_1.5-9.5               
##  [57] utf8_1.2.2                    labeling_0.4.2               
##  [59] tidyselect_1.1.2              rlang_1.0.2                  
##  [61] later_1.3.0                   AnnotationDbi_1.58.0         
##  [63] munsell_0.5.0                 BiocVersion_3.15.2           
##  [65] tools_4.2.0                   cachem_1.0.6                 
##  [67] cli_3.3.0                     generics_0.1.2               
##  [69] RSQLite_2.2.12                ExperimentHub_2.4.0          
##  [71] evaluate_0.15                 stringr_1.4.0                
##  [73] fastmap_1.1.0                 yaml_2.3.5                   
##  [75] knitr_1.39                    bit64_4.0.5                  
##  [77] purrr_0.3.4                   KEGGREST_1.36.0              
##  [79] sparseMatrixStats_1.8.0       mime_0.12                    
##  [81] formatR_1.12                  R.oo_1.24.0                  
##  [83] compiler_4.2.0                beeswarm_0.4.0               
##  [85] filelock_1.0.2                curl_4.3.2                   
##  [87] png_0.1-7                     interactiveDisplayBase_1.34.0
##  [89] tibble_3.1.6                  statmod_1.4.36               
##  [91] bslib_0.3.1                   stringi_1.7.6                
##  [93] highr_0.9                     RSpectra_0.16-1              
##  [95] lattice_0.20-45               bluster_1.6.0                
##  [97] Matrix_1.4-1                  vctrs_0.4.1                  
##  [99] pillar_1.7.0                  lifecycle_1.0.1              
## [101] rhdf5filters_1.8.0            BiocManager_1.30.17          
## [103] jquerylib_0.1.4               RcppAnnoy_0.0.19             
## [105] BiocNeighbors_1.14.0          cowplot_1.1.1                
## [107] bitops_1.0-7                  irlba_2.3.5                  
## [109] httpuv_1.6.5                  R6_2.5.1                     
## [111] bookdown_0.26                 promises_1.2.0.1             
## [113] gridExtra_2.3                 vipor_0.4.5                  
## [115] codetools_0.2-18              assertthat_0.2.1             
## [117] rjson_0.2.21                  withr_2.5.0                  
## [119] GenomeInfoDbData_1.2.8        parallel_4.2.0               
## [121] grid_4.2.0                    beachmat_2.12.0              
## [123] rmarkdown_2.14                DelayedMatrixStats_1.18.0    
## [125] shiny_1.7.1                   ggbeeswarm_0.6.0