STlist | R Documentation |
Creates an STlist object from one or multiple spatial transcriptomic samples.
STlist(rnacounts = NULL, spotcoords = NULL, samples = NULL, cores = NULL)
rnacounts |
the count data which can be provided in one of these formats:
|
spotcoords |
the cell/spot coordinates. Not required if inputs are Visium or Xenium (spaceranger or xeniumranger outputs).
|
samples |
the sample names/IDs and (optionally) metadata associated with
each spatial sample.
The following options are available for
|
cores |
integer indicating the number of cores to use during parallelization.
If NULL, the function uses half of the available cores at a maximum. The parallelization
uses |
Objects of the S4 class STlist are the starting point of analyses in spatialGE
.
The STlist contains data from one or multiple samples (i.e., tissue slices), and
results from most spatialGE
's functions are stored within the object.
Raw gene counts and spatial coordinates. Gene count data have genes in rows and sampling units (e.g., cells, spots) in columns. Spatial coordinates have sampling units in rows and three columns: sample unit IDs, Y position, and X position.
Visium outputs from Space Ranger. The Visium directory must have the directory
structure resulting from spaceranger count
, with either a count matrix represented in
MEX files or a h5 file. The directory should also contain a spatial
sub-directory,
with the spatial coordinates (tissue_positions_list.csv
), and
optionally the high resolution tissue image and scaling factor file scalefactors_json.json
.
Xenium outputs from Xenium Ranger. The Xenium directory must have the directory
structure resulting from the xeniumranger
pipeline, with either a cell-feature matrix
represented in MEX files or a h5 file. The directory should also contain a parquet file,
with the spatial coordinates (cells.parquet
).
CosMx-SMI outputs. Two files are required to process SMI outputs: The exprMat
and
metadata
files. Both files must contain the "fov" and "cell_ID" columns. In addition,
the metadata
files must contain the "CenterX_local_px" and "CenterY_local_px" columns.
Seurat object (V4). A Seurat V4 object produced via Seurat::Load10X_Spatial
.
Optionally, the user can input a path to a file containing a table of sample-level metadata (e.g., clinical outcomes, tissue type, age). This sample metadata file should contain sample IDs in the first column partially matching the file names of the count/coordinate file paths or Visium directories. Note: The sample ID of a given sample cannot be a substring of the sample ID of another sample. For example, instead of using "tissue1" and "tissue12", use "tissue01" and "tissue12".
The function uses parallelization if run in a Unix system. Windows users will experience longer times depending on the number of samples.
an STlist object containing the counts and coordinates, and optionally
the sample metadata, which can be used for downstream analysis with spatialGE
# Using included melanoma example (Thrane et al.)
# Download example data set from spatialGE_Data
thrane_tmp = tempdir()
unlink(thrane_tmp, recursive=TRUE)
dir.create(thrane_tmp)
lk='https://github.com/FridleyLab/spatialGE_Data/raw/refs/heads/main/melanoma_thrane.zip?download='
download.file(lk, destfile=paste0(thrane_tmp, '/', 'melanoma_thrane.zip'), mode='wb')
zip_tmp = list.files(thrane_tmp, pattern='melanoma_thrane.zip$', full.names=TRUE)
unzip(zipfile=zip_tmp, exdir=thrane_tmp)
# Generate the file paths to be passed to the STlist function
count_files <- list.files(paste0(thrane_tmp, '/melanoma_thrane'),
full.names=TRUE, pattern='counts')
coord_files <- list.files(paste0(thrane_tmp, '/melanoma_thrane'),
full.names=TRUE, pattern='mapping')
clin_file <- list.files(paste0(thrane_tmp, '/melanoma_thrane'),
full.names=TRUE, pattern='clinical')
# Create STlist
library('spatialGE')
melanoma <- STlist(rnacounts=count_files[c(1,3)],
spotcoords=coord_files[c(1,3)],
samples=clin_file) # Only first three samples
melanoma
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.