Creates, saves and returns an object of class spata from scratch. Several samples can be stored in one object, though we recommand to stick to one. (See details for more.)

initiateSpataObject_10X(
  input_paths,
  sample_names,
  gene_set_path = NULL,
  output_path = NULL,
  file_name = NULL,
  SCTransform = FALSE,
  NormalizeData = list(normalization.method = "LogNormalize", scale.factor = 1000),
  FindVariableFeatures = list(selection.method = "vst", nfeatures = 2000),
  ScaleData = TRUE,
  RunPCA = list(npcs = 60),
  FindNeighbors = list(dims = 1:30),
  FindClusters = list(resolution = 0.8),
  RunTSNE = TRUE,
  RunUMAP = list(dims = 1:30),
  verbose = TRUE
)

Arguments

input_paths

Character vector. Specifies the 10X visium-folders from which to load the information. This folder must contain the following sub directories:

  • '/outs/filtered_feature_bc_matrix.h5'

  • '/outs/spatial/*.jpg

sample_names

Character vector. The sample name with which to refer to the respective sample. Should start with a letter.

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.

output_path

Character vector or NULL. Specifies the folder in which to store the object if the directory is valid.

file_name

Character value. The name-suffix for the file name under which the spata-object is stored. Is prefixed with 'spata-obj-' and suffixed with '.RDS'.

SCTransform

A named list of arguments given to Seurat::SCTransform(), TRUE or FALSE.

NormalizeData

A named list of arguments given to Seurat::NormalizeData(), TRUE or FALSE.

FindVariableFeatures

A named list of arguments given to Seurat::FindVariableFeatures(), TRUE or FALSE.

ScaleData

A named list of arguments given to Seurat::ScaleData(), TRUE or FALSE.

Hint: If set to TRUE or the argument-list provided does not specify the argument features input for argument features is set to base::rownames(seurat_object).

RunPCA

A named list of arguments given to Seurat::RunPCA(), TRUE or FALSE.

FindNeighbors

A named list of arguments given to Seurat::FindNeighbors(), TRUE or FALSE.

FindClusters

A named list of arguments given to Seurat::FindClusters(), TRUE or FALSE.

RunTSNE

A named list of arguments given to Seurat::RunTSNE(), TRUE or FALSE.

RunUMAP

A named list of arguments given to Seurat::RunUMAP(), TRUE or FALSE.

verbose

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

(Warning messages will always be printed.)

Value

A spata-object.

Details

The loading and preprocessing of the spata-object currently relies on the Seurat-package. Before any pre processing function is applied mitochondrial and stress genes are discarded. For more advanced users the arguments above starting with a capital letter allow to manipulate the way the spata-object is processed. For all of these arguments apply the following instructions:

  • If set to FALSE the processing function is skipped.

  • If set to TRUE the respective function is called with it's default argument settings. Note: RunUMAP() needs additional input!

  • If a named list is provided the respective function is called whereby the named list will provide the argument-input (the seurat-object to be constructed must not be named and will be passed to every function as the first argument!!!.)

Note that certain listed functions require previous functions! E.g. if RunPCA is set to FALSE RunTSNE() will result in an error. (base::tryCatch() will prevent the function from crashing but the respective slot is going to be empty.) Skipping functions might result in an incomplete spata-object. Use validateSpataObject() after initiating it in order to see which slots are valid and which are not.

Handling more than one sample:

Several samples can be stored in one object. If so, the count-matrices will be combined to one matrix which is given to the seurat-object that is temporarily initiated in order to perform the pre processing steps. Sample related unambiguity with respect to the barcode's belonging is maintained by suffixing the barcode-sequences with the respective sample name specified in sample_names. The meta.data data.frame of the seurat-object is joined with a variable called sample denoting the sample-belonging of every barcode which can be used as input for pre processing functions.

For now we recommend to stick to one sample per spata-object.