runSpatialCorrelationAnalysis: Initiate gene clustering analysis based on spatial patterns

View source: R/unused.R

runSpatialCorrelationAnalysisR Documentation

Initiate gene clustering analysis based on spatial patterns

Description

This function screens a subset of genes and evaluates their spatial overlap by correlation- and subsequent clustering analysis. Results can be conveniently obtained or processed with additional functions such as clusterSpCorResults(), getGenes() or getSpCorResults().

Usage

runSpatialCorrelationAnalysis(
  object,
  of_sample = "",
  genes = 2000,
  genes_additional = NULL,
  threshold_stw = 0.5,
  threshold_stpv = 0.1,
  with_ties = TRUE,
  method_cor = "pearson",
  method_dist = "euclidean",
  mtr_name = NULL,
  verbose = TRUE
)

Arguments

object

A valid spata-object.

of_sample

This argument is currently inactive. It might be reactivated when spata-objects can store more than one sample.

genes

A numeric value (integer) or a character vector. Determines which genes are included in the correlation assessment. If specified as a numeric value the genes are sorted in a decreasing fashion corresponding to their variance across all barcode spots. Then the top n genes are included whereby n is equal to the specified numeric value.

If specified as a character vector it's elements are considered to be gene names and all valid inputs are included.

genes_additional

Character vector of gene names. If genes is specified as a numeric value but you want certain genes to be included irrespective of their variance you can denote them here and they are added after the variance evaluation.

threshold_stw, threshold_stpv

Numeric values. Both values refer to the results of the shapiro-wilkinson test results for each gene. Before beeing sorted according to their variance you can use both arguments to filter for genes with a W-value bigger or equal to threshold_stw and a respective p-value lower or equal to threshold_stpv.

with_ties

Logical. If set to TRUE (the default) genes with equal variances are kept even if the total number of genes

method_dist

Character value or vector (see details for more). Denotes the distance methods (e.g. 'euclidean') to be used. Run validDistanceMethods() to obtain all valid input options.

Details

The overall expression matrix is filtered according to the input of argument genes, transposed and given to stats::cor(). The returned correlation matrix is given to stats::dist() to calculate the distance matrix needed for subsequent cluster analysis.

Use getGenes() and it's argument similar_to in order to get genes that feature a similar expression profile/pattern as a gene of interest.

Value

An updated spata-object.


theMILOlab/SPATA2 documentation built on Feb. 8, 2025, 11:41 p.m.