- A SingleCellExperiment with a spatial graph, in one object
- Direct ggplot2 plotting of genes, cell data and graph attributes
- Built from GraphSpace, SingleCellExperiment or SpatialExperiment objects
- Cells and graph nodes kept aligned through subsetting and cropping
RGraphSpaceExperiment brings the spatial graphs of RGraphSpace to
Bioconductor single-cell data. Its main class, GraphSpaceExperiment,
is a SingleCellExperiment (Amezquita et al. 2020)
whose cells are the nodes of a graph, placed in a coordinate space and,
optionally, over an image. The same object works with Bioconductor
methods (assays, colData(), subsetting) and with RGraphSpace
functions (normalization, cropping, physical units, scale bars). It also
links Bioconductor data to ggplot2 (Wickham 2016):
ggplot() takes the object itself, and any layer can use genes from an
assay, cell data from colData() and graph attributes by name, with no
data frame to build first.
A GraphSpaceExperiment can be created from:
-
A
GraphSpace: node coordinates, graph and image come from the RGraphSpace object, and its feature data become an assay. -
A
SingleCellExperiment: node coordinates are read from a reduced dimension, and edges, optionally, from a cell-cell graph stored incolPairs(). -
A
SpatialExperiment(Righelli et al. 2022): node coordinates are read fromspatialCoords(), and the tissue image is imported when present.
RGraphSpaceExperiment is not yet on Bioconductor or CRAN. Install the
development version from GitHub; BiocManager also installs its
Bioconductor dependencies.
# Dependencies to install and build the vignettes
install.packages(c("BiocManager", "remotes", "knitr", "rmarkdown"))
# RGraphSpace (>= 1.5.8), development version
remotes::install_github("sysbiolab/RGraphSpace", build_vignettes = TRUE)
# Package source
BiocManager::install("sysbiolab/RGraphSpaceExperiment", build_vignettes = TRUE)If you use RGraphSpaceExperiment, please cite:
Carazza-Kessler et al. RGraphSpace: Rendering graphs as coherent spatial objects in ggplot2. Journal of Open Source Software 11(126):11209, 2026. doi: 10.21105/joss.11209
The RGraphSpaceExperiment package is distributed under Artistic-2.0
-
Where do I report bugs? Simply open an issue on GitHub.
-
How do I contribute to the package? If you have an idea (but no code yet), open an issue on GitHub. If you want to contribute with a specific feature and have the code ready, fork the repository, add your code, and create a pull request.
-
Do you need support? The easiest way is to open an issue. This also makes your question and its answer available to others who may encounter similar problems.
-
Please note that the RGraphSpaceExperiment project follows the Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
- Amezquita RA, Lun ATL, Becht E, et al.: Orchestrating single-cell analysis with Bioconductor. Nature Methods 17:137–145. 2020. doi:10.1038/s41592-019-0654-x
- Righelli D, Weber LM, Crowell HL, et al.: SpatialExperiment: infrastructure for spatially-resolved transcriptomics data in R using Bioconductor. Bioinformatics 38(11):3128–3131. 2022. doi:10.1093/bioinformatics/btac299
- Wickham H: ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016. https://ggplot2.tidyverse.org