-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
109 lines (81 loc) · 3.21 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
output:
github_document:
toc: true
toc_depth: 2
fig_width: 9
fig_height: 6
dev: png
always_allow_html: true
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include=FALSE}
knitr::opts_chunk$set(warning = FALSE,
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
fig.retina = TRUE,
fig.width = 6,
fig.height = 4)
```
# `bayesVG`
<!-- badges: start -->
![last commit](https://img.shields.io/github/last-commit/jr-leary7/bayesVG/main?color=darkgreen)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
<!-- badges: end -->
# Installation
You can install the most recent version of `bayesVG` using:
```{r, eval=FALSE}
remotes::install_github("jr-leary7/bayesVG")
```
# Usage
## Libraries
```{r, eval=FALSE}
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.
```{r, eval=FALSE}
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.
```{r, eval=FALSE}
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.
```{r, eval=FALSE}
data("seu_brain")
```
Before running `bayesVG` for SVG detection it's necessary to normalize the expression data and identify a set of naive HVGs.
```{r, eval=FALSE}
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.
```{r, eval=FALSE}
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](https://github.com/jr-leary7/bayesVG/issues) or by email ([email protected]) if more detailed assistance is needed.