Learn R Programming

SVG (version 1.0.0)

CalSVG_MarkVario: Detect SVGs using Mark Variogram Method

Description

Identifies spatially variable genes using the mark variogram approach, as implemented in Seurat's FindSpatiallyVariableFeatures function with selection.method = "markvariogram".

Usage

CalSVG_MarkVario(
  expr_matrix,
  spatial_coords,
  r_metric = 5,
  normalize = TRUE,
  n_threads = 1L,
  verbose = TRUE
)

Value

A data.frame with SVG detection results. Columns:

  • gene: Gene identifier

  • r.metric.X: Variogram value at distance r_metric

  • rank: Rank by variogram value (ascending, lower = more spatially variable)

Arguments

expr_matrix

Numeric matrix of gene expression values.

spatial_coords

Numeric matrix of spatial coordinates.

r_metric

Numeric. Distance at which to evaluate the variogram. Default is 5. Larger values capture broader spatial patterns.

normalize

Logical. Whether to normalize the variogram. Default is TRUE.

n_threads

Integer. Number of parallel threads. Default is 1.

verbose

Logical. Print progress messages. Default is TRUE.

Details

Method Overview:

The mark variogram measures how the correlation between gene expression values changes with distance. It is computed using the spatstat package's markvario function.

Interpretation:

  • Lower variogram values indicate stronger spatial autocorrelation

  • Values near 1 indicate random spatial distribution

  • Values < 1 indicate positive spatial autocorrelation (clustering)

Note: Requires the spatstat package suite to be installed: spatstat.geom and spatstat.explore.

References

Baddeley, A. et al. (2015) Spatial Point Patterns: Methodology and Applications with R. Chapman and Hall/CRC.

See Also

CalSVG_Seurat

Examples

Run this code
# \donttest{
# Load example data
data(example_svg_data)
expr <- example_svg_data$logcounts[1:5, ]
coords <- example_svg_data$spatial_coords

# Requires spatstat packages
if (requireNamespace("spatstat.geom", quietly = TRUE) &&
    requireNamespace("spatstat.explore", quietly = TRUE)) {
    results <- CalSVG_MarkVario(expr, coords, verbose = FALSE)
    head(results)
}
# }

Run the code above in your browser using DataLab