In the same way that read mapping tools have transformed genome sequence analysis, the ability to map new datasets to established references represents an exciting opportunity for the field of single-cell genomics. Along with others in the community, we have developed tools to map and interpret query datasets, and have also constructed a set of scRNA-seq datasets for diverse mammalian tissues.

A key challenge is to extend this reference mapping framework to technologies that do not measure gene expression, even if the underlying reference is based on scRNA-seq. In Hao et al, bioRxiv 2022, we introduce ‘bridge integration’, which enables the mapping of complementary technologies (like scATAC-seq, scDNAme, CyTOF), onto scRNA-seq references, using a ‘multi-omic’ dataset as a molecular bridge. In this vignette, we demonstrate how to map an scATAC-seq dataset of human PBMC, onto our previously constructed PBMC reference. We use a publicly available 10x multiome dataset, which simultaneously measures gene expression and chromatin accessibility in the same cell, as a bridge dataset.

In this vignette we demonstrate:

  • Loading in and pre-processing the scATAC-seq, multiome, and scRNA-seq reference datasets
  • Mapping the scATAC-seq dataset via bridge integration
  • Exploring and assessing the resulting annotations

First, we install the updated version of Seurat that supports this infrastructure, as well as other packages necessary for this vignette.

library(remotes)
remotes::install_github("satijalab/seurat", "feat/dictionary", quiet = TRUE)
library(Seurat)
library(SeuratDisk)
library(Signac)
library(EnsDb.Hsapiens.v86)
library(dplyr)
library(ggplot2)

Load the bridge, query, and reference datasets

We start by loading a 10x multiome dataset, consisting of ~12,000 PBMC from a healthy donor. The dataset measures RNA-seq and ATAC-seq in the same cell, and is available for download from 10x Genomics here. We follow the loading instructions from the Signac package vignettes. Note that when using Signac, please make sure you are using the latest version of Bioconductor, as users have reported errors when using older BioC versions.

Load and setup the 10x multiome object
# the 10x hdf5 file contains both data types. 
inputdata.10x <- Read10X_h5("/brahms/haoy/vignette_data/pbmc_granulocyte_sorted_10k_filtered_feature_bc_matrix.h5")
# extract RNA and ATAC data
rna_counts <- inputdata.10x$`Gene Expression`
atac_counts <- inputdata.10x$Peaks
# Create Seurat object
obj.multi <- CreateSeuratObject(counts = rna_counts)
# Get % of mitochondrial genes
obj.multi[["percent.mt"]] <- PercentageFeatureSet(obj.multi, pattern = "^MT-")

# add the ATAC-seq assay
grange.counts <- StringToGRanges(rownames(atac_counts), sep = c(":", "-"))
grange.use <- seqnames(grange.counts) %in% standardChromosomes(grange.counts)
atac_counts <- atac_counts[as.vector(grange.use), ]

# Get gene annotations
annotations <- GetGRangesFromEnsDb(ensdb = EnsDb.Hsapiens.v86)
# Change style to UCSC 
seqlevelsStyle(annotations) <- 'UCSC'
genome(annotations) <- "hg38"

# File with ATAC per fragment information file 
frag.file <- "/brahms/haoy/vignette_data/pbmc_granulocyte_sorted_10k_atac_fragments.tsv.gz"

# Add in ATAC-seq data as ChromatinAssay object
chrom_assay <- CreateChromatinAssay(
  counts = atac_counts,
  sep = c(":", "-"),
  genome = 'hg38',
  fragments = frag.file,
  min.cells = 10,
  annotation = annotations
)

# Add the ATAC assay to the multiome object 
obj.multi[["ATAC"]] <- chrom_assay

# Filter ATAC data based on QC metrics
obj.multi <- subset(
  x = obj.multi,
  subset = nCount_ATAC < 7e4 &
    nCount_ATAC > 5e3 &
    nCount_RNA < 25000 &
    nCount_RNA > 1000 &
    percent.mt < 20
)

The scATAC-seq query dataset represents ~10,000 PBMC from a healthy donor, and is available for download here. We load in the peak/cell matrix, store the path to the fragments file, and add gene annotations to the object, following the steps as with the ATAC data in the multiome experiment.

We note that it is important to quantify the same set of genomic features in the query dataset as are quantified in the multi-omic bridge. We therefore requantify the set of scATAC-seq peaks using the FeatureMatrix command. This is also described in the Signac vignettes and shown below.

Load and setup the 10x scATAC-seq query
# Load ATAC dataset
atac_pbmc_data <- Read10X_h5(filename = "/brahms/haoy/vignette_data/10k_PBMC_ATAC_nextgem_Chromium_X_filtered_peak_bc_matrix.h5") 
fragpath <- "/brahms/haoy/vignette_data/10k_PBMC_ATAC_nextgem_Chromium_X_fragments.tsv.gz"

# Get gene annotations
annotation <- GetGRangesFromEnsDb(ensdb = EnsDb.Hsapiens.v86)

# Change to UCSC style 
seqlevelsStyle(annotation) <- 'UCSC'

# Create ChromatinAssay for ATAC data
atac_pbmc_assay <- CreateChromatinAssay(
  counts = atac_pbmc_data,
  sep = c(":", "-"),
  fragments = fragpath,
  annotation = annotation
)

# Requantify query ATAC to have same features as multiome ATAC dataset
requant_multiome_ATAC <- FeatureMatrix(
  fragments = Fragments(atac_pbmc_assay),
  features = granges(obj.multi[['ATAC']]),
  cells = Cells(atac_pbmc_assay)
)

# Create assay with requantified ATAC data
ATAC_assay <- CreateChromatinAssay(
  counts = requant_multiome_ATAC,
  fragments = fragpath,
  annotation = annotation
)

# Create Seurat sbject
obj.atac  <- CreateSeuratObject(counts = ATAC_assay,assay = 'ATAC')
obj.atac[['peak.orig']] <- atac_pbmc_assay
obj.atac <- subset(obj.atac, subset = nCount_ATAC < 7e4 & nCount_ATAC > 2000)

We load the reference (download here) from our recent paper. This reference is stored as an h5Seurat file, a format that enables on-disk storage of multimodal Seurat objects (more details on h5Seurat and SeuratDisk can be found here).

obj.rna <- LoadH5Seurat("/brahms/haoy/seurat4_pbmc/pbmc_multimodal.h5seurat")
What if I want to use my own reference dataset?

As an alternative to using a pre-built reference, you can also use your own reference. To demonstrate, you can download a scRNA-seq dataset of 23,837 human PBMC here, which we have already annotated.

obj.rna = readRDS("/path/to/reference.rds")
obj.rna = SCTransform(object = obj.rna) %>% RunPCA() %>% RunUMAP(dims = 1:50, return.model = TRUE) 

When using your own reference, set reference.reduction = "pca" in the PrepareBridgeReference function.


Preprocessing/normalization for all datasets

Prior to performing bridge integration, we normalize and pre-process each of the datasets (note that the reference has already been normalized). We normalize gene expression data using sctransform, and ATAC data using TF-IDF.

# normalize multiome RNA
DefaultAssay(obj.multi) <- "RNA"
obj.multi <- SCTransform(obj.multi, verbose = FALSE) 

# normalize multiome ATAC
DefaultAssay(obj.multi) <- "ATAC"
obj.multi <- RunTFIDF(obj.multi)
obj.multi <- FindTopFeatures(obj.multi, min.cutoff = "q0")

# normalize query
obj.atac <- RunTFIDF(obj.atac)

Map scATAC-seq dataset using bridge integration

Now that we have the reference, query, and bridge datasets set up, we can begin integration. The bridge dataset enables translation between the scRNA-seq reference and the scATAC-seq query, effectively augmenting the reference so that it can map a new data type. We call this an extended reference, and first set it up. Note that you can save the results of this function and map multiple scATAC-seq datasets without having to rerun.

# Drop first dimension for ATAC reduction
dims.atac <- 2:50
dims.rna <- 1:50
DefaultAssay(obj.multi) <-  "RNA"
DefaultAssay(obj.rna) <- "SCT"
obj.rna.ext <- PrepareBridgeReference(reference = obj.rna,
                                      bridge = obj.multi, 
                                      reference.reduction = "spca",
                                      reference.dims = dims.rna,
                                      normalization.method = "SCT"
)

Now, we can directly find anchors between the extended reference and query objects. We use the FindBridgeTransferAnchors function, which translates the query dataset using the same dictionary as was used to translate the reference, and then identifies anchors in this space. The function is meant to mimic our FindTransferAnchors function, but to identify correspondences across modalities.

bridge.anchor <- FindBridgeTransferAnchors(extended.reference = obj.rna.ext, 
                                           query = obj.atac,
                                           reduction = "lsiproject",
                                           dims = dims.atac
)

Once we have identified anchors, we can map the query dataset onto the reference. The MapQuery function is the same as we have previously introduced for reference mapping . It transfers cell annotations from the reference dataset, and also visualizes the query dataset on a previously computed UMAP embedding. Since our reference dataset contains cell type annotations at three levels of resolution (l1 - l3), we can transfer each level to the query dataset.

obj.atac <- MapQuery(anchorset = bridge.anchor, 
                     reference = obj.rna, 
                     query = obj.atac, 
                     refdata = list(
                       l1 = "celltype.l1",
                       l2 = "celltype.l2",
                       l3 = "celltype.l3"),
                     reduction.model = "wnn.umap" 
)

Now we can visualize the results, plotting the scATAC-seq cells based on their predicted annotations, on the reference UMAP embedding. You can see that each scATAC-seq cell has been assigned a cell name based on the scRNA-seq defined cell ontology.

DimPlot(obj.atac, group.by = "predicted.l2", reduction = "ref.umap", label = TRUE) + ggtitle("ATAC") + NoLegend()

Assessing the mapping

To assess the mapping and cell type predictions, we will first see if the predicted cell type labels are concordant with an unsupervised analysis of the scATAC-seq dataset. We follow the standard unsupervised processing workflow for scATAC-seq data:

obj.atac <- FindTopFeatures(obj.atac, min.cutoff = "q0")
obj.atac <- RunSVD(obj.atac)
obj.atac <- RunUMAP(obj.atac, reduction = "lsi", dims = 2:50)

Now, we visualize the predicted cluster labels on the unsupervised UMAP emebdding. We can see that predicted cluster labels (from the scRNA-seq reference) are concordant with the structure of the scATAC-seq data. However, there are some cell types (i.e. Treg), that do not appear to separate in unsupervised analysis. These may be prediction errors, or cases where the reference mapping provides additional resolution.

DimPlot(obj.atac, group.by = "predicted.l2", reduction = "umap", label = FALSE) 

Lastly, we validate the predicted cell types for the scATAC-seq data by examining their chromatin accessibility profiles at canonical loci. We use the CoveragePlot function to visualize accessibility patterns at the CD8A, FOXP3, and RORC, after grouping cells by their predicted labels. We see expected patterns in each case. For example, the PAX5 locus exhibits peaks that are accessible exclusively in B cells, and the CD8A locus shows the same in CD8 T cell subsets. Similarly, the accessibility of FOXP3, a canonical marker of regulatory T cells (Tregs), in predicted Tregs provides strong support for the accuracy of our prediction.

CoveragePlot(obj.atac, region  = "PAX5", group.by = "predicted.l1", idents = c("B", "CD4 T", "Mono", "NK"), window = 200, extend.upstream = -150000)

CoveragePlot(obj.atac, region = "CD8A", group.by = "predicted.l2", idents = c("CD8 Naive", "CD4 Naive", "CD4 TCM", "CD8 TCM"), extend.downstream = 5000, extend.upstream = 5000)

CoveragePlot(obj.atac, region = "FOXP3", group.by = "predicted.l2", idents = c( "CD4 Naive", "CD4 TCM", "CD4 TEM", "Treg"), extend.downstream = 0, extend.upstream = 0)

CoveragePlot(obj.atac, region = "RORC", group.by = "predicted.l2", idents = c("CD8 Naive", "CD8 TEM", "CD8 TCM", "MAIT"), extend.downstream = 5000, extend.upstream = 5000)

Session Info
## R version 4.1.2 (2021-11-01)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.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       
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] ggplot2_3.3.5             dplyr_1.0.8              
##  [3] EnsDb.Hsapiens.v86_2.99.0 ensembldb_2.18.3         
##  [5] AnnotationFilter_1.18.0   GenomicFeatures_1.46.5   
##  [7] AnnotationDbi_1.56.2      Biobase_2.54.0           
##  [9] GenomicRanges_1.46.1      GenomeInfoDb_1.30.1      
## [11] IRanges_2.28.0            S4Vectors_0.32.3         
## [13] BiocGenerics_0.40.0       Signac_1.5.0             
## [15] SeuratDisk_0.0.0.9019     SeuratObject_4.0.4       
## [17] Seurat_4.1.0              remotes_2.4.2            
## 
## loaded via a namespace (and not attached):
##   [1] rappdirs_0.3.3              SnowballC_0.7.0            
##   [3] rtracklayer_1.54.0          scattermore_0.8            
##   [5] ragg_1.2.2                  tidyr_1.2.0                
##   [7] bit64_4.0.5                 knitr_1.37                 
##   [9] irlba_2.3.5                 DelayedArray_0.20.0        
##  [11] data.table_1.14.2           rpart_4.1.16               
##  [13] KEGGREST_1.34.0             RCurl_1.98-1.6             
##  [15] generics_0.1.2              callr_3.7.0                
##  [17] cowplot_1.1.1               RSQLite_2.2.10             
##  [19] RANN_2.6.1                  future_1.24.0              
##  [21] bit_4.0.4                   spatstat.data_2.1-2        
##  [23] xml2_1.3.3                  httpuv_1.6.5               
##  [25] SummarizedExperiment_1.24.0 assertthat_0.2.1           
##  [27] xfun_0.29                   hms_1.1.1                  
##  [29] jquerylib_0.1.4             evaluate_0.15              
##  [31] promises_1.2.0.1            fansi_1.0.2                
##  [33] restfulr_0.0.13             progress_1.2.2             
##  [35] dbplyr_2.1.1                igraph_1.2.11              
##  [37] DBI_1.1.2                   htmlwidgets_1.5.4          
##  [39] sparsesvd_0.2               spatstat.geom_2.3-2        
##  [41] purrr_0.3.4                 ellipsis_0.3.2             
##  [43] RSpectra_0.16-0             backports_1.4.1            
##  [45] biomaRt_2.50.3              deldir_1.0-6               
##  [47] MatrixGenerics_1.6.0        vctrs_0.3.8                
##  [49] ROCR_1.0-11                 abind_1.4-5                
##  [51] cachem_1.0.6                withr_2.4.3                
##  [53] ggforce_0.3.3               BSgenome_1.62.0            
##  [55] checkmate_2.0.0             sctransform_0.3.3          
##  [57] GenomicAlignments_1.30.0    prettyunits_1.1.1          
##  [59] goftest_1.2-3               cluster_2.1.2              
##  [61] lazyeval_0.2.2              crayon_1.5.0               
##  [63] hdf5r_1.3.5                 labeling_0.4.2             
##  [65] pkgconfig_2.0.3             slam_0.1-50                
##  [67] tweenr_1.0.2                nlme_3.1-155               
##  [69] ProtGenerics_1.26.0         nnet_7.3-17                
##  [71] rlang_1.0.1                 globals_0.14.0             
##  [73] lifecycle_1.0.1             miniUI_0.1.1.1             
##  [75] filelock_1.0.2              fastDummies_1.6.3          
##  [77] BiocFileCache_2.2.1         dichromat_2.0-0            
##  [79] rprojroot_2.0.2             polyclip_1.10-0            
##  [81] RcppHNSW_0.3.0              matrixStats_0.61.0         
##  [83] lmtest_0.9-39               Matrix_1.4-0               
##  [85] ggseqlogo_0.1               zoo_1.8-9                  
##  [87] base64enc_0.1-3             ggridges_0.5.3             
##  [89] processx_3.5.2              png_0.1-7                  
##  [91] viridisLite_0.4.0           rjson_0.2.21               
##  [93] bitops_1.0-7                KernSmooth_2.23-20         
##  [95] Biostrings_2.62.0           blob_1.2.2                 
##  [97] stringr_1.4.0               parallelly_1.30.0          
##  [99] spatstat.random_2.1-0       jpeg_0.1-9                 
## [101] scales_1.1.1                memoise_2.0.1              
## [103] magrittr_2.0.2              plyr_1.8.6                 
## [105] ica_1.0-2                   zlibbioc_1.40.0            
## [107] compiler_4.1.2              BiocIO_1.4.0               
## [109] RColorBrewer_1.1-2          fitdistrplus_1.1-6         
## [111] Rsamtools_2.10.0            cli_3.2.0                  
## [113] XVector_0.34.0              listenv_0.8.0              
## [115] patchwork_1.1.1             pbapply_1.5-0              
## [117] ps_1.6.0                    htmlTable_2.4.0            
## [119] Formula_1.2-4               MASS_7.3-55                
## [121] mgcv_1.8-39                 tidyselect_1.1.2           
## [123] stringi_1.7.6               textshaping_0.3.6          
## [125] highr_0.9                   yaml_2.3.5                 
## [127] latticeExtra_0.6-29         ggrepel_0.9.1              
## [129] grid_4.1.2                  VariantAnnotation_1.40.0   
## [131] sass_0.4.0                  fastmatch_1.1-3            
## [133] tools_4.1.2                 future.apply_1.8.1         
## [135] parallel_4.1.2              rstudioapi_0.13            
## [137] foreign_0.8-82              lsa_0.73.2                 
## [139] gridExtra_2.3               farver_2.1.0               
## [141] Rtsne_0.15                  digest_0.6.29              
## [143] shiny_1.7.1                 qlcMatrix_0.9.7            
## [145] Rcpp_1.0.8                  later_1.3.0                
## [147] RcppAnnoy_0.0.19            httr_1.4.2                 
## [149] biovizBase_1.42.0           colorspace_2.0-3           
## [151] XML_3.99-0.9                fs_1.5.2                   
## [153] tensor_1.5                  reticulate_1.24            
## [155] splines_4.1.2               uwot_0.1.11                
## [157] RcppRoll_0.3.0              spatstat.utils_2.3-0       
## [159] pkgdown_2.0.2               plotly_4.10.0              
## [161] systemfonts_1.0.4           xtable_1.8-4               
## [163] jsonlite_1.8.0              R6_2.5.1                   
## [165] Hmisc_4.6-0                 pillar_1.7.0               
## [167] htmltools_0.5.2             mime_0.12                  
## [169] glue_1.6.2                  fastmap_1.1.0              
## [171] BiocParallel_1.28.3         codetools_0.2-18           
## [173] pkgbuild_1.3.1              utf8_1.2.2                 
## [175] lattice_0.20-45             bslib_0.3.1                
## [177] spatstat.sparse_2.1-0       tibble_3.1.6               
## [179] curl_4.3.2                  leiden_0.3.9               
## [181] survival_3.3-0              rmarkdown_2.11             
## [183] docopt_0.7.1                desc_1.4.0                 
## [185] munsell_0.5.0               GenomeInfoDbData_1.2.7     
## [187] reshape2_1.4.4              gtable_0.3.0               
## [189] spatstat.core_2.4-0