| Title: | Import Visium data from the 10X Space Ranger pipeline |
|---|---|
| Description: | The package allows users to readily import spatial data obtained from either the 10X website or from the Space Ranger pipeline. Supported formats include tar.gz, h5, and mtx files. Multiple files can be imported at once with *List type of functions. The package represents data mainly as SpatialExperiment objects. |
| Authors: | Marcel Ramos [aut, cre] (ORCID: <https://orcid.org/0000-0002-3242-0582>), Estella YiXing Dong [aut, ctb], Dario Righelli [aut, ctb], Helena Crowell [aut, ctb], NCI [fnd] (GrantNo.: U24CA289073) |
| Maintainer: | Marcel Ramos <[email protected]> |
| License: | Artistic-2.0 |
| Version: | 1.9.2 |
| Built: | 2026-05-06 19:39:58 UTC |
| Source: | https://github.com/waldronlab/VisiumIO |
This function compares the barcodes between raw and filtered
data depending on the order of processing. Typically, the "raw"
barcodes are compared to the "filtered" ones. The presence of raw
barcodes in the filtered data are marked as TRUE in the resulting
data.frame.
compareBarcodes( from_resource, to_resource, spacerangerOut, format = c("mtx", "h5"), processing = c("raw", "filtered"), ... )compareBarcodes( from_resource, to_resource, spacerangerOut, format = c("mtx", "h5"), processing = c("raw", "filtered"), ... )
from_resource |
|
to_resource |
|
spacerangerOut |
|
format |
The format of the output. If missing and |
processing |
|
... |
Additional arguments passed to |
A data.frame with barcodes of the first element in the processing
data type as the first column and a logical vector indicating whether the
barcodes are found in the second element in processing. For example, if
processing is c("raw", "filtered"), then the first column will be the
barcodes in the raw data and the second column will be a logical vector
indicating whether the barcodes are found in the filtered data.
if (interactive()) { compareBarcodes( from_resource = "V1_Adult_Mouse_Brain_raw_feature_bc_matrix.tar.gz", to_resource = "V1_Adult_Mouse_Brain_filtered_feature_bc_matrix.tar.gz", ) compareBarcodes( from_resource = "V1_Adult_Mouse_Brain_raw_feature_bc_matrix.h5", to_resource = "V1_Adult_Mouse_Brain_filtered_feature_bc_matrix.h5" ) compareBarcodes(spacerangerOut = "~/data/outs", format = "h5") compareBarcodes( spacerangerOut = "~/data/feature_bc_matrix", format = "mtx" ) compareBarcodes( spacerangerOut = "~/data/folder_feature_bc_matrix", format = "mtx" ) }if (interactive()) { compareBarcodes( from_resource = "V1_Adult_Mouse_Brain_raw_feature_bc_matrix.tar.gz", to_resource = "V1_Adult_Mouse_Brain_filtered_feature_bc_matrix.tar.gz", ) compareBarcodes( from_resource = "V1_Adult_Mouse_Brain_raw_feature_bc_matrix.h5", to_resource = "V1_Adult_Mouse_Brain_filtered_feature_bc_matrix.h5" ) compareBarcodes(spacerangerOut = "~/data/outs", format = "h5") compareBarcodes( spacerangerOut = "~/data/feature_bc_matrix", format = "mtx" ) compareBarcodes( spacerangerOut = "~/data/folder_feature_bc_matrix", format = "mtx" ) }
This function flips the Y-axis of cell or nucleus segmentations
stored in an sf object to align with the H&E image. The Y-axis flipping
is necessary because the origin (0,0) in image coordinates is at the
top-left corner, while in Cartesian coordinates, the origin is at the
bottom-left corner. The function takes into account the image height and
scaling factor to accurately flip the Y-coordinates of the segmentations.
st_invert_y(sf, type = c("POINT", "POLYGON"), img_height, scalef)st_invert_y(sf, type = c("POINT", "POLYGON"), img_height, scalef)
sf |
|
type |
|
img_height |
|
scalef |
|
an sf object with Y-axis of the points or polygons flipped
Estella YiXing Dong
geojson_file <- system.file( file.path("extdata", "segmented_outputs", "cell_segmentations.geojson"), mustWork = TRUE, package = "VisiumIO" ) geo_data <- sf::st_read(geojson_file, quiet = TRUE) st_invert_y( sf = geo_data, type = "POLYGON", img_height = 3886, scalef = 0.079 )geojson_file <- system.file( file.path("extdata", "segmented_outputs", "cell_segmentations.geojson"), mustWork = TRUE, package = "VisiumIO" ) geo_data <- sf::st_read(geojson_file, quiet = TRUE) st_invert_y( sf = geo_data, type = "POLYGON", img_height = 3886, scalef = 0.079 )
TENxGeoJSON is a class to represent and import GeoJSON files
from 10X Genomics. It is a composed class of TENxIO::TENxFile.
TENxGeoJSON(resource) ## S4 method for signature 'TENxGeoJSON,ANY,ANY' import(con, format, text, ...)TENxGeoJSON(resource) ## S4 method for signature 'TENxGeoJSON,ANY,ANY' import(con, format, text, ...)
resource |
character(1) The path to the file |
con |
The connection from which data is loaded or to which data is
saved. If this is a |
format |
The format of the output. If missing and |
text |
If |
... |
Additional inputs to the low level class generator functions |
Typically, the user will not create an object of this class directly
but rather use the TENxVisium() constructor function to create an object
of this class in the background.
TENxGeoJSON(): An object of class TENxGeoJSON
import-method: An sf and data.frame with the GeoJSON data
https://www.10xgenomics.com/support/software/xenium-ranger/3.0/analysis/segmentation-inputs
segout_folder <- system.file( file.path("extdata", "segmented_outputs"), package = "VisiumIO" ) ## import cell boundaries cellsegs <- file.path(segout_folder, "cell_segmentations.geojson") TENxGeoJSON(cellsegs) TENxGeoJSON(cellsegs) |> import() ## import nucleus boundaries nucsegs <- file.path(segout_folder, "nucleus_segmentations.geojson") TENxGeoJSON(nucsegs) |> import()segout_folder <- system.file( file.path("extdata", "segmented_outputs"), package = "VisiumIO" ) ## import cell boundaries cellsegs <- file.path(segout_folder, "cell_segmentations.geojson") TENxGeoJSON(cellsegs) TENxGeoJSON(cellsegs) |> import() ## import nucleus boundaries nucsegs <- file.path(segout_folder, "nucleus_segmentations.geojson") TENxGeoJSON(nucsegs) |> import()
TENxParquet is a virtual class to represent and import Parquet
files from 10X Genomics. It is a composed class of TENxIO::TENxFile.
TENxSpatialParquet is a class to represent and import spatial
Parquet files from 10X Genomics. It is a composed class of
TENxIO::TENxFile.
TENxParquet(resource, type = c("spatial", "mapping")) TENxMappingParquet(resource, colnames = .MAPPING_POS_COLS) ## S4 method for signature 'TENxMappingParquet,ANY,ANY' import(con, format, text, ...)TENxParquet(resource, type = c("spatial", "mapping")) TENxMappingParquet(resource, colnames = .MAPPING_POS_COLS) ## S4 method for signature 'TENxMappingParquet,ANY,ANY' import(con, format, text, ...)
resource |
character(1) The path to the file |
type |
|
colnames |
|
con |
The connection from which data is loaded or to which data is
saved. If this is a |
format |
The format of the output. If missing and |
text |
If |
... |
Additional inputs to the low level class generator functions |
Typically, the user will not create an object of this class directly
but rather use the TENxParquet constructor function to create an object
of either TENxSpatialParquet or TENxMappingParquet class in the
background.
TENxParquet(): An object of class TENxSpatialParquet or
TENxMappingParquet
TENxMappingParquet(): An object of class TENxMappingParquet
sample_dir <- system.file( file.path("extdata", "binned_outputs", "square_002um", "spatial"), package = "VisiumIO" ) spatial_dir <- Filter( function(x) endsWith(x, "spatial"), list.dirs(sample_dir) ) parquetres <- file.path(spatial_dir, "tissue_positions.parquet") TENxParquet(parquetres) parq_file <- system.file( "extdata", "barcode_mappings.parquet", package = "VisiumIO", mustWork = TRUE ) TENxMappingParquet(parq_file)sample_dir <- system.file( file.path("extdata", "binned_outputs", "square_002um", "spatial"), package = "VisiumIO" ) spatial_dir <- Filter( function(x) endsWith(x, "spatial"), list.dirs(sample_dir) ) parquetres <- file.path(spatial_dir, "tissue_positions.parquet") TENxParquet(parquetres) parq_file <- system.file( "extdata", "barcode_mappings.parquet", package = "VisiumIO", mustWork = TRUE ) TENxMappingParquet(parq_file)
TENxSpatialCSV is a class to represent and import spatial CSV
files with specific column names. It is a composed class of
TENxIO::TENxFile and contains additional slots for the column names and
whether the CSV is a list-type of file.
TENxSpatialCSV(resource, colnames = .TISSUE_POS_COLS) ## S4 method for signature 'TENxSpatialCSV,ANY,ANY' import(con, format, text, ...)TENxSpatialCSV(resource, colnames = .TISSUE_POS_COLS) ## S4 method for signature 'TENxSpatialCSV,ANY,ANY' import(con, format, text, ...)
resource |
character(1) The path to the file |
colnames |
|
con |
The connection from which data is loaded or to which data is
saved. If this is a |
format |
The format of the output. If missing and |
text |
If |
... |
Additional inputs to the low level class generator functions |
Typically, the user will not create an object of this class directly
but rather use the TENxVisium() constructor function to create an object
of this class in the background. The column names are set to the default
values of c("barcode", "in_tissue", "array_row", "array_col", "pxl_row_in_fullres", "pxl_col_in_fullres"). The column names can be
changed by specifying the colnames argument in the constructor function.
Set the option "VisiumIO.csvreader" to either "data.table" or
"readr" to use the data.table::fread or readr::read_csv functions,
respectively. These options are useful when the CSV file is relatively
large and the user wants to use faster read-in options. Note that the
outputs will still be converted to DataFrame when incorporated to the
SpatialExperiment or SingleCellExperiment object.
TENxSpatialCSV: An object of class TENxSpatialCSV
import-method: A DataFrame object containing the data from the CSV
file
isListlogical(1) A scalar specifying whether the CSV is a list-type
of file
colnamescharacter() A vector specifying the column names of the CSV
variantcharacter(1) A scalar specifying the variant of the CSV file
"positions", "cell_boundaries", or "other". The variant is determined by
the name of the CSV file within the constructor function. Values include
"positions", "cell_boundaries", and "other".
compressedlogical(1) A scalar specifying whether the CSV is
compressed (mainly with a .gz file extension).
sample_dir <- system.file( file.path("extdata", "10xVisium", "section1"), package = "VisiumIO" ) spatial_dir <- Filter( function(x) endsWith(x, "spatial"), list.dirs(sample_dir) ) csvresource <- file.path(spatial_dir, "tissue_positions_list.csv") TENxSpatialCSV(csvresource) head(import(TENxSpatialCSV(csvresource)), 4) import(TENxSpatialCSV(csvresource)) |> attr("metadata") |> lapply(names)sample_dir <- system.file( file.path("extdata", "10xVisium", "section1"), package = "VisiumIO" ) spatial_dir <- Filter( function(x) endsWith(x, "spatial"), list.dirs(sample_dir) ) csvresource <- file.path(spatial_dir, "tissue_positions_list.csv") TENxSpatialCSV(csvresource) head(import(TENxSpatialCSV(csvresource)), 4) import(TENxSpatialCSV(csvresource)) |> attr("metadata") |> lapply(names)
This class is a composed class of TENxFileList, which can contain a list of TENxFile objects, and a TENxSpatialList object. It is meant to handle spatial Visium data from 10X Genomics.
TENxSpatialList( resources, sample_id = "sample01", images = c("lowres", "hires", "detected", "aligned", "aligned_fiducials", "cytassist"), jsonFile = .SCALE_JSON_FILE, tissuePattern = "tissue_positions.*", bin_size = character(0L), loadImage = FALSE, ... ) ## S4 method for signature 'TENxSpatialList,ANY,ANY' import(con, format, text, ...)TENxSpatialList( resources, sample_id = "sample01", images = c("lowres", "hires", "detected", "aligned", "aligned_fiducials", "cytassist"), jsonFile = .SCALE_JSON_FILE, tissuePattern = "tissue_positions.*", bin_size = character(0L), loadImage = FALSE, ... ) ## S4 method for signature 'TENxSpatialList,ANY,ANY' import(con, format, text, ...)
resources |
A TENxFileList object or a file path to the tarball containing the matrix / assay data resources. |
sample_id |
|
images |
|
jsonFile |
|
tissuePattern |
|
bin_size |
|
loadImage |
|
... |
Parameters to pass to the format-specific method. |
con |
The connection from which data is loaded or to which data is
saved. If this is a |
format |
The format of the output. If missing and |
text |
If |
Typically, the user will not create an object of this class directly
but rather use the TENxVisium() constructor function to create an object
of this class.
A SpatialExperiment object
import(con = TENxSpatialList, format = ANY, text = ANY): Import a TENxSpatialList object
imagescharacter() The image name(s) to use with grep and include
in the list of files. Can be one of "lowres", "hires", "lowres", "hires",
"detected", "aligned", "aligned_fiducials", or "cytassist".
scaleJSONcharacter(1) The file name of the scale factors JSON file,
defaults to 'scalefactors_json.json'.
tissuePoscharacter(1) The file name of the tissue positions file;
typically a .parquet or .csv file.
sampleIdcharacter(1) A scalar specifying the sample identifier.
binSizeThe bin size of the images to import. The default slot value is
character(). It typically corresponds to the directory name
square_000um where 000 is the bin value.
loadImagelogical(1) Whether to load the images into memory as
SpatialImage objects. If FALSE, the images are stored as file paths and
loaded as StoredSpatialImage objects when the TENxSpatialList object is
imported. The default is FALSE to avoid loading large images into memory.
This functionality requires the magick package.
spatial_dir <- system.file( file.path("extdata", "10xVisium", "section1", "outs", "spatial"), package = "VisiumIO" ) TENxSpatialList(resources = spatial_dir, images = "lowres") TENxSpatialList(resources = spatial_dir, images = "lowres") |> metadata() |> lapply(names)spatial_dir <- system.file( file.path("extdata", "10xVisium", "section1", "outs", "spatial"), package = "VisiumIO" ) TENxSpatialList(resources = spatial_dir, images = "lowres") TENxSpatialList(resources = spatial_dir, images = "lowres") |> metadata() |> lapply(names)
TENxSpatialParquet is a class to represent and import spatial
Parquet files with specific column names. It is a composed class of
TENxIO::TENxFile and contains additional slots for the column names and
whether the Parquet is a list-type of file.
TENxSpatialParquet(resource, colnames) ## S4 method for signature 'TENxSpatialParquet,ANY,ANY' import(con, format, text, ...)TENxSpatialParquet(resource, colnames) ## S4 method for signature 'TENxSpatialParquet,ANY,ANY' import(con, format, text, ...)
resource |
character(1) The path to the file |
colnames |
|
con |
The connection from which data is loaded or to which data is
saved. If this is a |
format |
The format of the output. If missing and |
text |
If |
... |
Additional inputs to the low level class generator functions |
Typically, the user will not create an object of this class directly
but rather use the TENxVisium() constructor function to create an object
of this class in the background. The column names are set to the default
values of c("barcode", "in_tissue", "array_row", "array_col", "pxl_row_in_fullres", "pxl_col_in_fullres"). The column names can be
changed by specifying the colnames argument in the constructor function.
TENxSpatialParquet(): An object of class TENxSpatialParquet
import-method: A tibble object containing the data from the
Parquet file
sample_dir <- system.file( file.path("extdata", "binned_outputs", "square_002um", "spatial"), package = "VisiumIO" ) spatial_dir <- Filter( function(x) endsWith(x, "spatial"), list.dirs(sample_dir) ) parquetres <- file.path(spatial_dir, "tissue_positions.parquet") TENxSpatialParquet(parquetres) TENxSpatialParquet(parquetres) |> import() ## metadata in attributes TENxSpatialParquet(parquetres) |> import() |> attr("metadata") |> lapply(names)sample_dir <- system.file( file.path("extdata", "binned_outputs", "square_002um", "spatial"), package = "VisiumIO" ) spatial_dir <- Filter( function(x) endsWith(x, "spatial"), list.dirs(sample_dir) ) parquetres <- file.path(spatial_dir, "tissue_positions.parquet") TENxSpatialParquet(parquetres) TENxSpatialParquet(parquetres) |> import() ## metadata in attributes TENxSpatialParquet(parquetres) |> import() |> attr("metadata") |> lapply(names)
This class is a composed class of TENxFileList which can contain a list of TENxFile objects and a TENxSpatialList object. It is meant to handle a single Visium sample from 10X Genomics.
TENxVisium( resources, spatialResource, spacerangerOut, sample_id = "sample01", processing = c("filtered", "raw"), format = c("mtx", "h5"), images = c("lowres", "hires", "detected", "aligned", "cytassist"), jsonFile = .SCALE_JSON_FILE, tissuePattern = "tissue_positions.*\\.csv", spatialCoordsNames = c("pxl_col_in_fullres", "pxl_row_in_fullres"), loadImage = FALSE, ... ) ## S4 method for signature 'TENxVisium,ANY,ANY' import(con, format, text, ...)TENxVisium( resources, spatialResource, spacerangerOut, sample_id = "sample01", processing = c("filtered", "raw"), format = c("mtx", "h5"), images = c("lowres", "hires", "detected", "aligned", "cytassist"), jsonFile = .SCALE_JSON_FILE, tissuePattern = "tissue_positions.*\\.csv", spatialCoordsNames = c("pxl_col_in_fullres", "pxl_row_in_fullres"), loadImage = FALSE, ... ) ## S4 method for signature 'TENxVisium,ANY,ANY' import(con, format, text, ...)
resources |
A TENxFileList object or a file path to the tarball containing the matrix / assay data resources. |
spatialResource |
A TENxSpatialList object or a file path to the tarball containing the spatial data. |
spacerangerOut |
|
sample_id |
|
processing |
|
format |
The format of the output. If missing and |
images |
|
jsonFile |
|
tissuePattern |
|
spatialCoordsNames |
|
loadImage |
|
... |
In the constructor, additional arguments passed to TENxFileList; otherwise, not used. |
con |
The connection from which data is loaded or to which data is
saved. If this is a |
text |
If |
Typically, the user will not create an object of this class directly
but rather use TENxVisiumList constructor function for multiple samples.
Note that the images, jsonFile, tissuePattern, and
spatialCoordsNames arguments are only considered when the
spacerangerOut argument or both the resources and spatialResource
arguments are paths to files.
A SpatialExperiment object
import(con = TENxVisium, format = ANY, text = ANY): Import Visium data
resourcesA TENxFileList or TENxH5 object containing the Visium data.
spatialListA TENxSpatialList object containing the spatial
coordNamescharacter() A vector specifying the names
of the columns in the spatial data containing the spatial coordinates.
sampleIdcharacter(1) A scalar specifying the sample identifier.
loadImagelogical(1) Whether to load the images into memory as
SpatialImage objects. If FALSE, the images are stored as file paths and
loaded as StoredSpatialImage objects when the TENxSpatialList object is
imported. The default is FALSE to avoid loading large images into memory.
This functionality requires the magick package.
https://support.10xgenomics.com/spatial-gene-expression/software/pipelines/latest/output/overview
outs_dir <- system.file( file.path("extdata", "10xVisium", "section1", "outs"), package = "VisiumIO" ) ## using spacerangerOut folder tv <- TENxVisium( spacerangerOut = outs_dir, processing = "raw", images = "lowres" ) import(tv) ## with TENxFileList spacerangerOut input tvfl <- TENxVisium( spacerangerOut = TENxFileList(outs_dir), format = "mtx", processing = "raw", images = "lowres" ) import(tvfl) ## check metadata of the object import(tvfl) |> metadata() |> lapply(names) ## importing h5 format tvfl <- TENxVisium( spacerangerOut = outs_dir, format = "h5", processing = "raw", images = "lowres" ) import(tvfl) rffolder <- file.path(outs_dir, "raw_feature_bc_matrix") ## using resources and spatialResource inputs tvfl <- TENxVisium( resources = rffolder, spatialResource = file.path(dirname(rffolder), "spatial"), format = "mtx", processing = "raw", images = "lowres" ) import(tvfl)outs_dir <- system.file( file.path("extdata", "10xVisium", "section1", "outs"), package = "VisiumIO" ) ## using spacerangerOut folder tv <- TENxVisium( spacerangerOut = outs_dir, processing = "raw", images = "lowres" ) import(tv) ## with TENxFileList spacerangerOut input tvfl <- TENxVisium( spacerangerOut = TENxFileList(outs_dir), format = "mtx", processing = "raw", images = "lowres" ) import(tvfl) ## check metadata of the object import(tvfl) |> metadata() |> lapply(names) ## importing h5 format tvfl <- TENxVisium( spacerangerOut = outs_dir, format = "h5", processing = "raw", images = "lowres" ) import(tvfl) rffolder <- file.path(outs_dir, "raw_feature_bc_matrix") ## using resources and spatialResource inputs tvfl <- TENxVisium( resources = rffolder, spatialResource = file.path(dirname(rffolder), "spatial"), format = "mtx", processing = "raw", images = "lowres" ) import(tvfl)
This class contains a SimpleList of TENxVisiumHD objects
each corresponding to one sample. The provided spacerangerOut folder
should contain a binned_outputs folder where multiple bin_size
subfolders are present, e.g., square_002um. Note that the sf package
is required to import cell segmentation and nucleus segmentation data. If
the sf package is not installed, the cell segmentation data will not be
imported and an error is issued.
TENxVisiumHD( resources, spatialResource, spacerangerOut, segmented_outputs, sample_id = "sample01", processing = c("filtered", "raw"), format = c("mtx", "h5"), images = c("lowres", "hires", "detected", "aligned_fiducials"), bin_size = c("008", "016", "002"), jsonFile = .SCALE_JSON_FILE, tissuePattern = "tissue_positions\\.parquet", spatialCoordsNames = c("pxl_col_in_fullres", "pxl_row_in_fullres"), mappingPattern = "barcode_mappings\\.parquet", boundary = c("cell_segmentations", "nucleus_segmentations", "both"), loadImage = FALSE, ... ) ## S4 method for signature 'TENxVisiumHD,ANY,ANY' import(con, format, text, ...)TENxVisiumHD( resources, spatialResource, spacerangerOut, segmented_outputs, sample_id = "sample01", processing = c("filtered", "raw"), format = c("mtx", "h5"), images = c("lowres", "hires", "detected", "aligned_fiducials"), bin_size = c("008", "016", "002"), jsonFile = .SCALE_JSON_FILE, tissuePattern = "tissue_positions\\.parquet", spatialCoordsNames = c("pxl_col_in_fullres", "pxl_row_in_fullres"), mappingPattern = "barcode_mappings\\.parquet", boundary = c("cell_segmentations", "nucleus_segmentations", "both"), loadImage = FALSE, ... ) ## S4 method for signature 'TENxVisiumHD,ANY,ANY' import(con, format, text, ...)
resources |
A TENxFileList object or a file path to the tarball containing the matrix / assay data resources. |
spatialResource |
A TENxSpatialList object or a file path to the tarball containing the spatial data. |
spacerangerOut |
|
segmented_outputs |
|
sample_id |
|
processing |
|
format |
The format of the output. If missing and |
images |
|
bin_size |
|
jsonFile |
|
tissuePattern |
|
spatialCoordsNames |
|
mappingPattern |
|
boundary |
|
loadImage |
|
... |
In the constructor, additional arguments passed to TENxFileList; otherwise, not used. |
con |
The connection from which data is loaded or to which data is
saved. If this is a |
text |
If |
Typically, the user will provide a path to a directory containing
the output of the spaceranger count command. The spaceranger count
command outputs a folder containing the "raw" or "filtered"
()_feature_bc_matrix.
Note that nucleus_segmentations.geojson file must be in the same
folder as the cell_segmentations.geojson file for the nucleus centroids
to be imported correctly when selecting the "both" for the boundary
argument.
A SpatialExperiment object
import(con = TENxVisiumHD, format = ANY, text = ANY): Import Visium HD data from multiple bin sizes
E. Y. Dong, M. Ramos
vdir <- system.file( "extdata", package = "VisiumIO", mustWork = TRUE ) ## with spacerangerOut folder TENxVisiumHD(spacerangerOut = vdir, bin_size = "002", images = "lowres") TENxVisiumHD(spacerangerOut = vdir, bin_size = "002", images = "lowres") |> import() ## indicate h5 format TENxVisiumHD( spacerangerOut = vdir, bin_size = "002", images = "lowres", format = "h5" ) TENxVisiumHD( spacerangerOut = vdir, bin_size = "002", images = "lowres", format = "h5" ) |> import() ## use resources and spatialResource arguments as file paths TENxVisiumHD( resources = file.path( vdir, "binned_outputs", "square_002um", "filtered_feature_bc_matrix.h5" ), spatialResource = file.path( vdir, "binned_outputs", "square_002um", "spatial" ), bin_size = "002", processing = "filtered", images = "lowres", format = "h5" ) |> import() ## provide the spatialResource argument as a TENxFileList TENxVisiumHD( resources = file.path( vdir, "binned_outputs", "square_002um", "filtered_feature_bc_matrix.h5" ), spatialResource = TENxFileList( file.path( vdir, "binned_outputs", "square_002um", "spatial" ) ), bin_size = "002", images = "lowres", format = "h5" ) |> import() ## with segmented_outputs folder seg_outs <- system.file( "extdata", "segmented_outputs", package = "VisiumIO", mustWork = TRUE ) TENxVisiumHD( segmented_outputs = seg_outs, format = "h5", images = "lowres" ) |> import()vdir <- system.file( "extdata", package = "VisiumIO", mustWork = TRUE ) ## with spacerangerOut folder TENxVisiumHD(spacerangerOut = vdir, bin_size = "002", images = "lowres") TENxVisiumHD(spacerangerOut = vdir, bin_size = "002", images = "lowres") |> import() ## indicate h5 format TENxVisiumHD( spacerangerOut = vdir, bin_size = "002", images = "lowres", format = "h5" ) TENxVisiumHD( spacerangerOut = vdir, bin_size = "002", images = "lowres", format = "h5" ) |> import() ## use resources and spatialResource arguments as file paths TENxVisiumHD( resources = file.path( vdir, "binned_outputs", "square_002um", "filtered_feature_bc_matrix.h5" ), spatialResource = file.path( vdir, "binned_outputs", "square_002um", "spatial" ), bin_size = "002", processing = "filtered", images = "lowres", format = "h5" ) |> import() ## provide the spatialResource argument as a TENxFileList TENxVisiumHD( resources = file.path( vdir, "binned_outputs", "square_002um", "filtered_feature_bc_matrix.h5" ), spatialResource = TENxFileList( file.path( vdir, "binned_outputs", "square_002um", "spatial" ) ), bin_size = "002", images = "lowres", format = "h5" ) |> import() ## with segmented_outputs folder seg_outs <- system.file( "extdata", "segmented_outputs", package = "VisiumIO", mustWork = TRUE ) TENxVisiumHD( segmented_outputs = seg_outs, format = "h5", images = "lowres" ) |> import()
This class contains a SimpleList of TENxVisium objects each
corresponding to one sample.
TENxVisiumList( sampleFolders, sample_ids, processing = c("filtered", "raw"), images = c("lowres", "hires", "detected", "aligned"), format = c("mtx", "h5"), jsonFile = .SCALE_JSON_FILE, tissuePattern = "tissue_positions.*\\.csv", spatialCoordsNames = c("pxl_col_in_fullres", "pxl_row_in_fullres"), ... ) ## S4 method for signature 'TENxVisiumList,ANY,ANY' import(con, format, text, ...)TENxVisiumList( sampleFolders, sample_ids, processing = c("filtered", "raw"), images = c("lowres", "hires", "detected", "aligned"), format = c("mtx", "h5"), jsonFile = .SCALE_JSON_FILE, tissuePattern = "tissue_positions.*\\.csv", spatialCoordsNames = c("pxl_col_in_fullres", "pxl_row_in_fullres"), ... ) ## S4 method for signature 'TENxVisiumList,ANY,ANY' import(con, format, text, ...)
sampleFolders |
|
sample_ids |
|
processing |
|
images |
|
format |
The format of the output. If missing and |
jsonFile |
|
tissuePattern |
|
spatialCoordsNames |
|
... |
In the constructor, additional arguments passed to TENxFileList; otherwise, not used. |
con |
The connection from which data is loaded or to which data is
saved. If this is a |
text |
If |
Typically, the user will provide a path to a directory containing
the output of the spaceranger count command. The spaceranger count
command outputs a folder containing the "raw" or "filtered"
()_feature_bc_matrix.
A SpatialExperiment object
import(con = TENxVisiumList, format = ANY, text = ANY): Import multiple Visium samples
https://support.10xgenomics.com/spatial-gene-expression/software/pipelines/latest/output/overview
sample_dirs <- list.dirs( system.file( file.path("extdata", "10xVisium"), package = "VisiumIO" ), recursive = FALSE, full.names = TRUE ) tvl <- TENxVisiumList( sampleFolders = sample_dirs, sample_ids = c("sample01", "sample02"), processing = "raw", images = "lowres", format = "mtx" ) import(tvl)sample_dirs <- list.dirs( system.file( file.path("extdata", "10xVisium"), package = "VisiumIO" ), recursive = FALSE, full.names = TRUE ) tvl <- TENxVisiumList( sampleFolders = sample_dirs, sample_ids = c("sample01", "sample02"), processing = "raw", images = "lowres", format = "mtx" ) import(tvl)