You can install the most recent version of bayesVG
using:
remotes::install_github("jr-leary7/bayesVG")
library(Seurat)
library(bayesVG)
First, we load the 10X Genomics pbmc3k dataset, which is composed of 2,700 peripheral blood mononuclear cells from a single healthy donor.
data("seu_pbmc")
Now we’re able to model gene expression, summarize the posterior distribution of variance for each gene, and classify the top 3000 most-variable genes as HVGs.
seu_pbmc <- findVariableFeaturesBayes(seu_pbmc,
n.cells.subsample = 1000L,
algorithm = "meanfield",
save.model = TRUE) %>%
classifyHVGs(n.HVG = 3000L)
First, we load the 10X Genomics anterior mouse brain dataset.
data("seu_brain")
Before running bayesVG
for SVG detection it’s necessary to normalize
the expression data and identify a set of naive HVGs.
seu_brain <- SCTransform(seu_brain,
assay = "Spatial",
variable.features.n = 3000L,
vst.flavor = "v2",
return.only.var.genes = FALSE,
seed.use = 312,
verbose = FALSE)
Now we can model gene expression with an approximate Gaussian process, summarize the spatial component of variance for each gene, and classify the top 1000 most spatially variable genes as SVGs.
seu_brain <- findSpatiallyVariableFeaturesBayes(seu_brain,
kernel = "matern",
kernel.smoothness = 1.5,
algorithm = "meanfield",
n.cores = 4L,
save.model = TRUE) %>%
classifySVGs(n.SVG = 1000L)
This package is developed & maintained by Jack R. Leary. Feel free to reach out by opening an issue or by email ([email protected]) if more detailed assistance is needed.