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)
}
#> 2024-04-19 19:44:31.358992 loading file /github/home/.cache/R/BiocFileCache/c9922e59250_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1