SpatialExperiment-class {SpatialExperiment} | R Documentation

## The SpatialExperiment class

### Description

The SpatialExperiment class is designed to represent 10x Visium spatial Gene Expression data. It inherits from the SingleCellExperiment class and is used in the same manner. In addition, the class supports the integration with 10x Visium spatial coordinates and its scale factors.

### Usage

    SpatialExperiment(..., spatialCoords = data.frame())

### Arguments

`...` | arguments to be passed to the `SingleCellExperiment` constructor to fill the slots of the base class.
`spatialCoords` | the spatial coordinates

### Value

none

### Author(s)

Dario Righelli

### Examples

    ## building random seqFISH data coordinates
    fishCoordinates <- data.frame(Cell_ID=paste0("cell",c(1:30)),
                    Irrelevant=100,
                    x=sample(c(-4000:4000), size=30, replace=TRUE),
                    y=sample(c(-4000:4000), size=30, replace=TRUE))
    ## building random seqFISH cell labels
    fishCellLabels <- data.frame(Cell_ID=paste0("cell",c(1:30)),
                                 class="neuron",
                                 classID=sample(c(0:5), size=30, replace=TRUE))
    ## building random seqFISH count matrix
    fishCounts <- matrix(sample(0:100, size=(30*30), replace=TRUE),
                         nrow=30, ncol=30,
                         dimnames=list(paste0("gene",c(1:30)),
                                       paste0("cell",c(1:30))))
    ## creating SpatialExperiment object
    se <- SpatialExperiment(rowData=rownames(fishCounts),
                            colData=fishCellLabels,
                            assays=SimpleList(counts=as.matrix(fishCounts)),
                            spatialCoords=fishCoordinates)

[Package SpatialExperiment version 1.0.0 Index]