VisiumExperiment: The VisiumExperiment class

Description Usage Arguments Value Slots Author(s) Examples

View source: R/AllClasses.R

Description

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.

Usage

1

Arguments

...

arguments to be passed to the SpatialExperiment constructor to fill the slots of the base class.

scaleFactors

the 10x Visium image scale factors.

imagePaths

the list of the paths for the 10x Visium images.

Value

none

Slots

scaleFactors

list

imagePaths

list

Author(s)

Dario Righelli

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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

SpatialExperiment documentation built on Nov. 8, 2020, 7:35 p.m.