Chapter 22 Interoperability
The Bioconductor single-cell ecosystem is but one of many popular frameworks for scRNA-seq data analysis. Seurat is very widely used for analysis of droplet-based datasets while scanpy provides an option for users who prefer working in Python. In many scenarios, these frameworks provide useful functionality that we might want to use from a Bioconductor-centric analysis (or vice versa). For example, Python has well-established machine learning libraries while R has a large catalogue of statistical tools, and it would be much better to use this functionality directly than to attempt to transplant it into a new framework. However, effective re-use requires some consideration towards interoperability during development of the relevant software tools.
In an ideal world, everyone would agree on a common data structure that could be seamlessly and faithfully exchanged between frameworks. In the real world, though, each framework uses a different structure for various pragmatic or historical reasons. (This obligatory xkcd sums up the situation.) Most single cell-related Bioconductor packages use the
SingleCellExperiment class, as previously discussed; Seurat defines its own
SeuratObject class; and scanpy has its
AnnData class. This inevitably introduces some friction if we are forced to convert from one structure to another in order to use another framework’s methods.
In the absence of coordination of data structures, the next best solution is for each framework to provide methods that can operate on its most basic data object. Depending on the method, this might be the count matrix, the normalized expression matrix, a matrix of PCs or a graph object. If such methods are available, we can simply extract the relevant component from our
SingleCellExperiment and call an external method directly without having to assemble that framework’s structure. Indeed, it is for this purpose that almost all scran functions and many scater functions are capable of accepting matrix objects or equivalents (e.g., sparse matrices) in addition to
In this chapter, we will provide some examples of using functionality from frameworks outside of the
SingleCellExperiment ecosystem in a single-cell analysis. We will focus on Seurat and scanpy as these are the two of the most popular analysis frameworks in the field. However, the principles of interoperability are generally applicable and are worth keeping in mind when developing or evaluating any type of analysis software.
22.2 Interchanging with Seurat
22.3 Interchanging with scanpy
R version 4.0.0 Patched (2020-05-01 r78341) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.4 LTS Matrix products: default BLAS: /home/luna/Software/R/R-4-0-branch/lib/libRblas.so LAPACK: /home/luna/Software/R/R-4-0-branch/lib/libRlapack.so locale:  LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C  LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8  LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8  LC_PAPER=en_US.UTF-8 LC_NAME=C  LC_ADDRESS=C LC_TELEPHONE=C  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages:  stats graphics grDevices utils datasets methods base other attached packages:  OSCAUtils_0.0.2 BiocStyle_2.16.0 loaded via a namespace (and not attached):  Rcpp_22.214.171.124 bookdown_0.19 codetools_0.2-16  ps_1.3.3 digest_0.6.25 magrittr_1.5  evaluate_0.14 highr_0.8 rlang_0.4.6  stringi_1.4.6 callr_3.4.3 rmarkdown_2.1  tools_4.0.0 stringr_1.4.0 processx_3.4.2  xfun_0.13 yaml_2.2.1 compiler_4.0.0  BiocManager_1.30.10 htmltools_0.4.0 knitr_1.28