Skip to content

Identify variable genes in scRNA-seq and spatial transcriptomics data using Bayesian inference

License

Notifications You must be signed in to change notification settings

jr-leary7/bayesVG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bayesVG

last commit License: MIT

Installation

You can install the most recent version of bayesVG using:

remotes::install_github("jr-leary7/bayesVG")

Usage

Libraries

library(Seurat)
library(bayesVG)

HVG detection

Data

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")

Modeling

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)

SVG detection

Data

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)

Modeling

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)

Contact information

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.

About

Identify variable genes in scRNA-seq and spatial transcriptomics data using Bayesian inference

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published