transformSeuratToSpata: Transform seurat-object to spata-object

View source: R/t.R

transformSeuratToSpataR Documentation

Transform seurat-object to spata-object

Description

This function provides a convenient way to transform your seurat-object into a spata-object while maintaining as much analysis progress as possible. See details for more information.

Usage

transformSeuratToSpata(
  seurat_object,
  sample_name,
  method = "spatial",
  coords_from = "pca",
  assay_name = NULL,
  assay_slot = NULL,
  image_name = NULL,
  gene_set_path = NULL,
  verbose = TRUE
)

Arguments

seurat_object

A valid seurat object.

sample_name

Character value. Future input for SPATA's of_sample-argument.

method

Character value. Determines the data slots from which to compile the spata-object.

'spatial'

Denotes that the data to be used derived from spatial experiments.

'single_cell'

Denotes that the data to be used derived from single cell experiments.

coords_from

Character value. Either 'pca', 'tsne' or 'umap'.

Only relevant if method was set to 'single_cell'. Denotes the slot from which to take the surrogate coordinates. If the specified data ist not found the slot @coordinates will contain an empty data.frame and has to be set manually with setCoordsDf().

assay_name

Character value. Denotes the assay from which to transfer the data. If the seurat-object contains only one assay assay_name = NULL makes transformSeuratToSpata() choose the only one found.

assay_slot

Character value. Denotes the slot of the seurat-object's assay object from which to transfer the expression matrix (the count matrix is always taken from slot @counts). Either 'data' or 'scale.data'. If set to NULL the functions checks both options for validity. If both slots contain valid expression matrix candidates it defaults to 'scale.data'.

gene_set_path

Character value (or NULL). Specifies the path to a .RDS-file containing a data.frame that is to be used as input for slot @used_genesets.

Must have the character-variables

  • 'ont': The gene set names.

  • 'gene': The belonging gene names.

If set to NULL the default gene-set data.frame will used. Run ?gsdf to get more information.

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

Details

This function assembles a spata-object from the data it finds in the provided seurat-object. This always includes gene count- and expression-matrices as well as dimensional reduction data like PCA, UMAP and TSNE. Whenever transformSpataToSeurat() does not find anything it well tell you via a warning message or an error message if the missing data is essential to the spata-object. You might have to run certain functions afterwards with the obtained SPATA-object. (e.g. did not find UMAP data in seurat-object -> runUmap()).

If your seurat-object contains more than one assay-object or more than one SpatialImage-object you need to specify the respective objects by name using the arguments assay_name and image_name. If the assay you denoted with assay_name contains more than one valid expression matrix you need to specify the one you want to use as the spata-object's scaled_mtr using the argument assay_slot.

Seurat-objects containing data derived from spatial experiments (method = 'spatial'):

If you specify argument method as 'spatial' transformSeuratToSpata() assumes that the provided seurat-object contains a SpatialImage-object in slot @images from which it will extract the coordinates and the histology image.

Seurat-objects containing data derived from spatial experiments (method = 'single_cell'):

If you specify argument method as 'single_cell' transformSeuratToSpata() uses either tsne or umap embedding as surrogate coordinates.

Value

A spata object.


kueckelj/SPATA2 documentation built on March 16, 2024, 10:25 a.m.