VisiumExperiment-class {SpatialExperiment} | R Documentation |
The VisiumExperiment class is designed to represent 10x Visium spatial Gene Expression data. It inherits from the SpatialExperiment class and is used in the same manner. In addition, the class supports the integration with 10x Visium spatial coordinates and its scale factors.
VisiumExperiment(..., scaleFactors = list(), imagePaths = list())
... |
arguments to be passed to the |
scaleFactors |
the 10x Visium image scale factors. |
imagePaths |
the list of the paths for the 10x Visium images. |
none
scaleFactors
list
imagePaths
list
Dario Righelli
barcodesFile <- system.file(file.path("extdata", "10x_visium", "barcodes.tsv"), package="SpatialExperiment") barcodesEx <- read.csv(barcodesFile, sep="\t", header=FALSE, col.names=c("Barcodes")) featuresFile <- system.file(file.path("extdata", "10x_visium", "features.tsv"), package="SpatialExperiment") featuresEx <- read.csv(featuresFile, sep="\t", header=FALSE, col.names=c("Barcodes", "Feature_name", "Feature_type")) countsFile <- system.file(file.path("extdata", "10x_visium", "matrix.mtx"), package="SpatialExperiment") countsEx <- Matrix::readMM(file=countsFile) posFile <- system.file(file.path("extdata", "10x_visium", "tissue_positions_list.tsv"), package="SpatialExperiment") tissPosEx <- read.csv(posFile, sep="\t", header=FALSE, col.names=c("Barcodes", "in_tissue", "array_row", "array_col", "pxl_col_in_fullres", "pxl_row_in_fullres")) scaleFile <- system.file(file.path("extdata", "10x_visium", "scalefactors_json.json"), package="SpatialExperiment") scalefactors <- rjson::fromJSON(file=scaleFile) imagePaths <- list.files(system.file(file.path("extdata", "10x_visium", "images"), package="SpatialExperiment"), full.names=TRUE) ve <- VisiumExperiment(rowData=featuresEx, colData=barcodesEx, assays=c(counts=countsEx), spatialCoords=tissPosEx, scaleFactors=scalefactors, imagePaths=imagePaths) ve