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)

Arguments

sce

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.

imageData

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").

Value

A a SpatialExperiment-class object.

Details

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.

Author

Brenda Pardo, Leonardo Collado-Torres

Examples


if (enough_ram()) {
    ## Download the sce data
    sce <- fetch_data("sce")
    ## Transform it to a SpatialExperiment object
    spe <- sce_to_spe(sce)
}
#> snapshotDate(): 2022-10-31
#> 2023-03-17 21:37:48 loading file /github/home/.cache/R/BiocFileCache/73556cab927_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1