fit_banyan: Fit Banyan community detection model for spatially resolved...

View source: R/fit_banyan.R

fit_banyanR Documentation

Fit Banyan community detection model for spatially resolved single cell data

Description

This function allows you to fit the Bayesian multi-layer SBM for integration of spatial and gene expression data for identifying cell sub-populations

Usage

fit_banyan(
  seurat_obj = NULL,
  labels = NULL,
  exp = NULL,
  coords_df = NULL,
  z_init = NULL,
  K,
  n_pcs = 16,
  R = NULL,
  a0 = 2,
  b10 = 1,
  b20 = 1,
  n_iter = 1000,
  burn = 100,
  verbose = TRUE,
  s = 1.2
)

Arguments

seurat_obj

A Seurat object with PCA reduction and spatial coordinates. If provided, the exp and coords arguments are ignored

labels

User-defined tissue architecture labels as a length-n vector. If provided, only posterior of ACC parameters will be provided and tissue architecture identification will be skipped.

exp

A binary adjacency matrix encoding the gene expression network. Not used if seurat_obj is provided.

coords_df

A matrix or data frame with rows as cells and 2 columns for coordinates. Rows should be ordered the same as in exp. Not used if seurat_obj is provided.

z_init

An optional initialization for cluster indicators. Ignored if seurat_obj is provided.

K

The number of sub-populations to infer

n_pcs

The number of principal components to use from the Seurat object

R

A length 2 vector of integers for the number of neighbors to use. 1st element corresponds to the number of neighbors in gene expression network and 2nd element for spatial.

a0

Dirichlet prior parameter (shared across all communities)

b10

Beta prior number of connections

b20

Beta prior number on non-edges

n_iter

The number of total MCMC iterations to run.

burn

The number of MCMC iterations to discard as burn-in. A total of n_iter - burn iterations will be saved.

verbose

Whether or not to print cluster allocations at each iteration

s

Louvain resolution parameter

Value

A list of MCMC samples, including the MAP estimate of cluster indicators (z)


carter-allen/banyan documentation built on Nov. 30, 2022, 11:58 p.m.