1 Load libraries

library(MultiAssayExperiment)
library(SpatialExperiment)
library(SingleCellMultiModal)

2 seq-FISH dataset

The dataset consists of two data types, seq-FISH data was provided by Zhu et al. (2018), while scRNA-seq data was provided by Tasic et al. (2016).

Data have been retrievedas part of the Hackathon in the Mathematical Frameworks for Integrative Analysis of Emerging Biological DataTypes workshop.

2.1 Downloading datasets

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

SingleCellMultiModal::seqFISH(DataType="mouse_visual_cortex", 
                        modes="*", dry.run=TRUE, version="2.0.0")
## snapshotDate(): 2020-10-27
##    ah_id                mode file_size rdataclass rdatadateadded
## 1 EH3785        scRNA_Counts    0.2 Mb     matrix     2020-09-14
## 2 EH3786        scRNA_Labels      0 Mb data.frame     2020-09-14
## 3 EH3787 seqFISH_Coordinates      0 Mb data.frame     2020-09-14
## 4 EH3788      seqFISH_Counts    0.2 Mb     matrix     2020-09-14
## 5 EH3789      seqFISH_Labels      0 Mb data.frame     2020-09-14
##   rdatadateremoved
## 1             <NA>
## 2             <NA>
## 3             <NA>
## 4             <NA>
## 5             <NA>

Or simply by running:

mae <- SingleCellMultiModal::seqFISH(DataType="mouse_visual_cortex", 
                        modes="*", dry.run=FALSE, version="2.0.0")
## snapshotDate(): 2020-10-27
## Working on: scRNA_Counts
## Working on: scRNA_Labels
## Working on: seqFISH_Coordinates
## Working on: seqFISH_Counts
## Working on: seqFISH_Labels
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## ExperimentList contains data.frame or DataFrame,
##   potential for errors with mixed data types
mae
## A MultiAssayExperiment object of 2 listed
##  experiments with user-defined names and respective classes.
##  Containing an ExperimentList class object of length 2:
##  [1] seqFISH: SpatialExperiment with 113 rows and 1597 columns
##  [2] scRNAseq: SingleCellExperiment with 113 rows and 1723 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 all data to files

Example with actual data:

experiments(mae)
## ExperimentList class object of length 2:
##  [1] seqFISH: SpatialExperiment with 113 rows and 1597 columns
##  [2] scRNAseq: SingleCellExperiment with 113 rows and 1723 columns

2.2 Exploring the data structure

Check row annotations:

rownames(mae)
## CharacterList of length 2
## [["seqFISH"]] abca15 abca9 acta2 adcy4 aldh3b2 ... wrn zfp182 zfp715 zfp90
## [["scRNAseq"]] abca15 abca9 acta2 adcy4 aldh3b2 ... wrn zfp182 zfp715 zfp90

Take a peek at the sampleMap:

sampleMap(mae)
## DataFrame with 3320 rows and 3 columns
##         assay     primary     colname
##      <factor> <character> <character>
## 1     seqFISH          V2          V2
## 2     seqFISH          V3          V3
## 3     seqFISH          V4          V4
## 4     seqFISH          V5          V5
## 5     seqFISH          V6          V6
## ...       ...         ...         ...
## 3316 scRNAseq       V1719       V1719
## 3317 scRNAseq       V1720       V1720
## 3318 scRNAseq       V1721       V1721
## 3319 scRNAseq       V1722       V1722
## 3320 scRNAseq       V1723       V1723

2.3 scRNA-seq data

The scRNA-seq data are accessible with $scRNAseq, which returns a SingleCellExperiment class object, with all its associated methods.

experiments(mae)$scRNAseq
## class: SingleCellExperiment 
## dim: 113 1723 
## metadata(0):
## assays(1): counts
## rownames(113): abca15 abca9 ... zfp715 zfp90
## rowData names(1): X
## colnames(1723): V1 V2 ... V1722 V1723
## colData names(3): broad_type sample_name dissection
## reducedDimNames(0):
## altExpNames(0):

Otherwhise the assay function can be used to access the scRNAseq assay stored in the mae MultiAssayExperiment object.

head(assay(mae, "scRNAseq"))[,1:4]
##         V1 V2  V3 V4
## abca15  11 42  17 42
## abca9   22 46  22 46
## acta2   15 47  15 42
## adcy4   12 45  12 45
## aldh3b2 27 49  27 49
## amigo2  23 43 101 43

2.4 seq-FISH data

The seq-FISH data are accessible with $seqFISH, which returns a SpatialExperiment class object.

experiments(mae)$seqFISH
## class: SpatialExperiment 
## dim: 113 1597 
## metadata(0):
## assays(1): counts
## rownames(113): abca15 abca9 ... zfp715 zfp90
## rowData names(1): X
## colnames(1597): V2 V3 ... V1597 V1598
## colData names(6): Cell_ID cluster ... Irrelevant Prob
## reducedDimNames(0):
## altExpNames(0):
## spatialCoordinates(4): Cell_ID Irrelevant x y

Otherwhise the assay function can be used to access the seqFISH assay stored in the mae MultiAssayExperiment object.

head(assay(mae, "seqFISH"))[,1:4]
##          V2 V3 V4 V5
## abca15   68 49 50 39
## abca9    41 42 38 36
## acta2    25 23 16 21
## adcy4    39 54 37 18
## aldh3b2 101 47 41 52
## amigo2   93 64 93 93

Spatial coordinates can be retrieved with spatialCoords function on the SpatialExperiment object.

(sc <- spatialCoords(experiments(mae)$seqFISH))
## DataFrame with 1597 rows and 4 columns
##        Cell_ID Irrelevant         x         y
##      <integer>  <integer> <numeric> <numeric>
## 1            1        100    265.76   -231.14
## 2            2        100    290.48   -261.52
## 3            3        100    257.12   -133.35
## 4            4        100    753.46   -261.14
## 5            5        100    700.01   -169.05
## ...        ...        ...       ...       ...
## 1593      1593        100   1129.06  -1669.57
## 1594      1594        100   1044.02  -1872.66
## 1595      1595        100   1388.76  -1880.47
## 1596      1596        100   5172.85  -1340.96
## 1597      1597        100   5220.60  -1523.37

They can also be stored by using the <- operator.

fakeCoords <- cbind(sc[,c(1:3)], sc[,3])
colnames(fakeCoords)[4] <- "y"
spatialCoords(experiments(mae)$seqFISH) <- fakeCoords
spatialCoords(experiments(mae)$seqFISH)
## DataFrame with 1597 rows and 4 columns
##        Cell_ID Irrelevant         x         y
##      <integer>  <integer> <numeric> <numeric>
## 1            1        100    265.76    265.76
## 2            2        100    290.48    290.48
## 3            3        100    257.12    257.12
## 4            4        100    753.46    753.46
## 5            5        100    700.01    700.01
## ...        ...        ...       ...       ...
## 1593      1593        100   1129.06   1129.06
## 1594      1594        100   1044.02   1044.02
## 1595      1595        100   1388.76   1388.76
## 1596      1596        100   5172.85   5172.85
## 1597      1597        100   5220.60   5220.60

Direct access to the colnames of the spacial coordinates with spatialCoordsNames function.

spatialCoordsNames(experiments(mae)$seqFISH)
## [1] "Cell_ID"    "Irrelevant" "x"          "y"

2.5 Other data version

The provided seqFISH dataset comes out in two different versions:

  • V1.0.0 : provides the same seqFISH data as shown in the rest of this vignette, but it returns the full normalized scRNA-seq data matrix (with labels), as released from the original authors on the GEO database.
  • V2.0.0 : provides the same seqFISH data as shown in the rest of this vignette, but it returns a processed subset of the original scRNA-seq data, providing only the same genes present in the seqFISH data matrix.

2.5.1 V1.0.0 data

The full scRNA-seq data matrix is 24057 rows x 1809 columns.

To access the v1.0.0 simply run

mae <- SingleCellMultiModal::seqFISH(DataType="mouse_visual_cortex", 
                        modes="*", dry.run=FALSE, version="1.0.0")
## snapshotDate(): 2020-10-27
## Working on: scRNA_Full_Counts
## Working on: scRNA_Full_Labels
## Working on: seqFISH_Coordinates
## Working on: seqFISH_Counts
## Working on: seqFISH_Labels
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## see ?SingleCellMultiModal and browseVignettes('SingleCellMultiModal') for documentation
## loading from cache
## ExperimentList contains data.frame or DataFrame,
##   potential for errors with mixed data types
mae
## A MultiAssayExperiment object of 2 listed
##  experiments with user-defined names and respective classes.
##  Containing an ExperimentList class object of length 2:
##  [1] seqFISH: SpatialExperiment with 113 rows and 1597 columns
##  [2] scRNAseq: SingleCellExperiment with 24057 rows and 1809 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 all data to files

3 Session Info

sessionInfo()
## R version 4.0.3 (2020-10-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.5 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.12-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.12-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        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] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] SpatialExperiment_1.0.0     rhdf5_2.34.0               
##  [3] scater_1.18.3               ggplot2_3.3.3              
##  [5] scran_1.18.3                SingleCellExperiment_1.12.0
##  [7] SingleCellMultiModal_1.2.4  MultiAssayExperiment_1.16.0
##  [9] SummarizedExperiment_1.20.0 Biobase_2.50.0             
## [11] GenomicRanges_1.42.0        GenomeInfoDb_1.26.2        
## [13] IRanges_2.24.1              S4Vectors_0.28.1           
## [15] BiocGenerics_0.36.0         MatrixGenerics_1.2.0       
## [17] matrixStats_0.57.0          BiocStyle_2.18.1           
## 
## loaded via a namespace (and not attached):
##   [1] ggbeeswarm_0.6.0              colorspace_2.0-0             
##   [3] HCAMatrixBrowser_1.0.1        ellipsis_0.3.1               
##   [5] scuttle_1.0.4                 bluster_1.0.0                
##   [7] futile.logger_1.4.3           XVector_0.30.0               
##   [9] BiocNeighbors_1.8.2           farver_2.0.3                 
##  [11] bit64_4.0.5                   RSpectra_0.16-0              
##  [13] interactiveDisplayBase_1.28.0 AnnotationDbi_1.52.0         
##  [15] codetools_0.2-18              sparseMatrixStats_1.2.0      
##  [17] cachem_1.0.1                  knitr_1.31                   
##  [19] jsonlite_1.7.2                dbplyr_2.0.0                 
##  [21] uwot_0.1.10                   HDF5Array_1.18.0             
##  [23] shiny_1.6.0                   BiocManager_1.30.10          
##  [25] compiler_4.0.3                httr_1.4.2                   
##  [27] dqrng_0.2.1                   assertthat_0.2.1             
##  [29] Matrix_1.3-2                  fastmap_1.1.0                
##  [31] limma_3.46.0                  later_1.1.0.1                
##  [33] BiocSingular_1.6.0            formatR_1.7                  
##  [35] htmltools_0.5.1.1             tools_4.0.3                  
##  [37] rsvd_1.0.3                    igraph_1.2.6                 
##  [39] gtable_0.3.0                  glue_1.4.2                   
##  [41] GenomeInfoDbData_1.2.4        dplyr_1.0.3                  
##  [43] rappdirs_0.3.2                Rcpp_1.0.6                   
##  [45] rapiclient_0.1.3              rhdf5filters_1.2.0           
##  [47] vctrs_0.3.6                   ExperimentHub_1.16.0         
##  [49] DelayedMatrixStats_1.12.2     AnVIL_1.2.0                  
##  [51] xfun_0.20                     stringr_1.4.0                
##  [53] beachmat_2.6.4                mime_0.9                     
##  [55] lifecycle_0.2.0               irlba_2.3.3                  
##  [57] statmod_1.4.35                AnnotationHub_2.22.0         
##  [59] edgeR_3.32.1                  zlibbioc_1.36.0              
##  [61] scales_1.1.1                  promises_1.1.1               
##  [63] lambda.r_1.2.4                yaml_2.2.1                   
##  [65] curl_4.3                      memoise_2.0.0                
##  [67] gridExtra_2.3                 UpSetR_1.4.0                 
##  [69] stringi_1.5.3                 RSQLite_2.2.3                
##  [71] highr_0.8                     BiocVersion_3.12.0           
##  [73] BiocParallel_1.24.1           rlang_0.4.10                 
##  [75] pkgconfig_2.0.3               bitops_1.0-6                 
##  [77] evaluate_0.14                 lattice_0.20-41              
##  [79] Rhdf5lib_1.12.1               purrr_0.3.4                  
##  [81] labeling_0.4.2                cowplot_1.1.1                
##  [83] bit_4.0.4                     tidyselect_1.1.0             
##  [85] RcppAnnoy_0.0.18              plyr_1.8.6                   
##  [87] magrittr_2.0.1                bookdown_0.21                
##  [89] R6_2.5.0                      magick_2.6.0                 
##  [91] generics_0.1.0                DelayedArray_0.16.1          
##  [93] DBI_1.1.1                     pillar_1.4.7                 
##  [95] withr_2.4.1                   RCurl_1.98-1.2               
##  [97] tibble_3.0.5                  crayon_1.3.4                 
##  [99] futile.options_1.0.1          BiocFileCache_1.14.0         
## [101] rmarkdown_2.6                 viridis_0.5.1                
## [103] locfit_1.5-9.4                grid_4.0.3                   
## [105] blob_1.2.1                    digest_0.6.27                
## [107] xtable_1.8-4                  httpuv_1.5.5                 
## [109] munsell_0.5.0                 beeswarm_0.2.3               
## [111] viridisLite_0.3.0             vipor_0.4.5

Tasic, Bosiljka, Vilas Menon, Thuc Nghi Nguyen, Tae Kyung Kim, Tim Jarsky, Zizhen Yao, Boaz Levi, et al. 2016. “Adult Mouse Cortical Cell Taxonomy Revealed by Single Cell Transcriptomics.” Nature Neuroscience 19 (2): 335.

Zhu, Qian, Sheel Shah, Ruben Dries, Long Cai, and Guo-Cheng Yuan. 2018. “Identification of Spatially Associated Subpopulations by Combining scRNAseq and Sequential Fluorescence in Situ Hybridization Data.” Nature Biotechnology 36 (12): 1183.