Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CytoKspace

Nonparametric kernel-based detection of spatially variable genes (SVGs) with adaptive shrinkage and scalable multi-sample inference.

CytoKspace summarises each gene with a quadratic form in a sparse exponential nearest-neighbor kernel and calibrates that statistic by permuting residuals across spatial locations. The only assumption is exchangeability of residuals under the null, so p-values are exact in finite samples regardless of whether expression is Gaussian, Poisson, negative binomial or zero-inflated.

Installation

Install the development version from GitHub:

if (!requireNamespace("devtools", quietly = TRUE))
    install.packages("devtools")
devtools::install_github("Ghoshlab/CytoKspace")

Quick start

library(CytoKspace)
library(SpatialExperiment)

spe <- CytoKspace(spe, phi_mode = "per_gene", seed = 1)

res <- as.data.frame(rowData(spe))
head(res[order(res$pval), c("Q_stat", "padj", "theta_shrunk", "lfsr",
                            "svg_class")])

Multiple biological replicates:

res <- CytoKspaceCombine(spe_list, combine_method = "fisher", seed = 1)

What you get back

Two independent lines of evidence per gene:

Column Meaning
pval, padj Permutation p-value and BH adjustment
Q_stat Quadratic-form statistic
phi Kernel bandwidth used for that gene
nperm Permutations actually spent
theta_shrunk Empirical Bayes posterior spatial effect
posterior_sd Posterior standard deviation
lfsr Local false sign rate
svg_class Joint label from both tracks

Rank genes on theta_shrunk rather than Q_stat: the raw statistic scales with the number of spots and with total kernel affinity, the shrunk effect does not.

Main features

  • Distribution-free inference. Exact finite-sample permutation p-values under exchangeability alone.
  • Per-gene spatial scales. Genes varying over tens of micrometres are detected alongside genes varying over hundreds, at O(N) cost.
  • Adaptive permutation schedule. The permutation budget concentrates on genes near the significance boundary.
  • Adaptive shrinkage. Stabilised effect sizes and local false sign rates, which implicitly correct for the mean-variance relationship in log-transformed spatial data.
  • Multi-sample scalability. Per-sample inference plus Fisher or Cauchy combination; memory does not grow with the number of samples.

Documentation

vignette("CytoKspace")

Reproducing the manuscript

Code for every figure, table and benchmark in the accompanying manuscript lives in the separate reproducibility capsule archived on Zenodo. See the Data availability statement of the paper.

Citation

Ghosh T, Ghosh D (2026). Nonparametric kernel-based detection of spatially variable genes with adaptive shrinkage and scalable multi-sample inference. bioRxiv.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages