This function converts a spot-level SingleCellExperiment-class (SCE) object as generated by fetch_data() to a SpatialExperiment-class (SPE) object.

sce_to_spe(sce = fetch_data("sce"), imageData = NULL)



Defaults to the output of fetch_data(type = 'sce'). This is a SingleCellExperiment object with the spot-level Visium data and information required for visualizing the histology. See fetch_data() for more details.


A DataFrame() with image data. Will be used with SpatialExperiment::imgData. If NULL, then this will be constructed for you assuming that you are working with the original data from spatialLIBD::fetch_data("sce").


A a SpatialExperiment-class object.


Note that the resulting object is a bit more complex than a regular SPE because it contains the data from the spatialLIBD project which you might otherwise have to generate for your own data.


Brenda Pardo, Leonardo Collado-Torres


if (enough_ram()) {
    ## Download the sce data
    sce <- fetch_data("sce")
    ## Transform it to a SpatialExperiment object
    spe <- sce_to_spe(sce)
#> 2023-09-05 20:34:17.054761 loading file /github/home/.cache/R/BiocFileCache/152d33414640_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1