In order to install SPATA with all its dependencies in the right order enter the following commands.
base::install.packages("devtools")
if (!requireNamespace("BiocManager", quietly = TRUE)){
install.packages("BiocManager")
}
BiocManager::install(c('BiocGenerics', 'DelayedArray', 'DelayedMatrixStats',
'limma', 'S4Vectors', 'SingleCellExperiment',
'SummarizedExperiment', 'batchelor', 'Matrix.utils'))
devtools::install_github('cole-trapnell-lab/leidenbase')
devtools::install_github('cole-trapnell-lab/monocle3')
devtools::install_github(repo = 'satijalab/seurat', ref = 'develop')
devtools::install_github(repo = "kueckelj/confuns")
devtools::install_github(repo = "theMILOlab/SPATA")
library(SPATA)
The center of the spata-package is an S4-object of class spata
. The easiest way to create one from scratch with your data is via SPATA::createSpataObject_10X()
. Behind the scenes it loads the necessary count-matrix as well as the histology image from the folder(s) you obtain from 10X Visium. It performs a variety of computations e.g. count normalization, dimensionality reduction, clustering while relying on gold-standard functions of the Seurat-package.
library(SPATA)
# create a spata-object from scratch
spata_obj <-
initiateSpataObject_10X(input_paths = c("your/paths/to/10Xvisium-folders"), sample_names = c("265_C"))
# if you want to save a spata object from your session use
saveSpataObject(object = spata_obj,
output_path = "data", # e.g. a folder named 'data'
file_name = "example")
# in order to load a spata object use
spata_obj <- loadSpataObject(input_path = "data/spata-obj-example.RDS")
Make sure to adjust your gene-set data.frame according to your spata-object’s count matrix.
initiateSpataObject_10X()
returns the assembled object and saves it automatically under the specified direction of argument output_path
. In order to load a previously created spata-object use loadSpataObject()
. We are doing our best to prevent you from getting uninformative, frustrating error-messages if something went wrong. If it happens nevertheless make sure to run validateSpataObject()
to obtain a detailed summary about which of the slots are valid and which might harbor some flaws.
# obtain a report about your object's integrity
# (we artificially discarded the TSNE slot)
validateSpataObject(spata_obj)
## Could not find slots: 'scvelo', 'version'. Can not validate slots that do not exist.
## Slot 'coordinates':
## Valid!
##
## --------------------------------------------------
##
## Slot 'data':
## Valid!
##
## --------------------------------------------------
##
## Slot 'dim_red':
## TSNE data.frame is empty.
##
## --------------------------------------------------
##
## Slot 'fdata':
## Valid!
##
## --------------------------------------------------
##
## Slot 'image':
## Valid!
##
## --------------------------------------------------
##
## Slot 'samples':
## Valid!
##
## --------------------------------------------------
##
## Slot 'trajectories':
##
## -----------------------------------
##
## Of sample: 265_C
##
## No trajectories.
##
## --------------------------------------------------
##
## Slot 'used_genesets':
## Valid!
##
## --------------------------------------------------