read10xVisiumSFE | R Documentation |
Read Space Ranger output as a SpatialFeatureExperiment object, where spots
are represented with polygons in the colGeometry called "spotPoly". Other
geometries can be added later after the dataset is read. If data =
"filtered"
, then spatial neighborhood graphs of the spots are also computed
and stored in the colGraph called "visium" in all samples for downstream
spatial analyses.
read10xVisiumSFE(
samples = "",
dirs = file.path(samples, "outs"),
sample_id = paste0("sample", sprintf("%02d", seq_along(samples))),
type = c("HDF5", "sparse"),
data = c("filtered", "raw"),
images = c("lowres", "hires"),
unit = c("full_res_image_pixel", "micron"),
style = "W",
zero.policy = NULL,
load = FALSE
)
samples |
a character vector specifying one or more directories, each corresponding to a 10x Genomics Visium sample (see Details); if provided, names will be used as sample identifiers |
dirs |
Directory for each sample that contains the |
sample_id |
character string specifying unique sample identifiers,
one for each directory specified via |
type |
Either "HDF5", and the matrix will be represented as
|
data |
character string specifying whether to read in filtered (spots mapped to tissue) or raw data (all spots). |
images |
character vector specifying which images to include.
Valid values are |
unit |
Whether to use pixels in full resolution image or microns as the unit. If using microns, then spacing between spots in pixels will be used to convert the coordinates into microns, as the spacing is known to be 100 microns. This is used to plot scale bar. |
style |
|
zero.policy |
default NULL, use global option value; if FALSE stop with error for any empty neighbour sets, if TRUE permit the weights list to be formed with zero-length weights vectors |
load |
Not used, kept for backward compatibility. |
A SpatialFeatureExperiment object. The images might need to be manually transposed and/or mirrored to match the spots in this version of this package.
The as(<dgTMatrix>, "dgCMatrix") is deprecated
warning comes
from the DropletUtils
package which is used by
SpatialExperiment
to read 10X outputs. This will be fixed when
SpatialExperiment
switches to TENxIO.
It is assumed that the images have not been cropped. Otherwise the images might not align with the spots.
dir <- system.file("extdata", package = "SpatialFeatureExperiment")
sample_ids <- c("sample01", "sample02")
samples <- file.path(dir, sample_ids)
list.files(samples[1])
list.files(file.path(samples[1], "spatial"))
(sfe <- read10xVisiumSFE(samples, sample_id = sample_ids,
type = "sparse", data = "filtered",
load = FALSE
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.