fit_maple: Fit Maple multi-sample Bayesian spatial mixture model

View source: R/fit_maple.R

fit_mapleR Documentation

Fit Maple multi-sample Bayesian spatial mixture model

Description

This function allows you to detect sub-populations and explain membership with relevant covariates in multi-sample spatial transcriptomics experiments.

Usage

fit_maple(
  seurat_obj,
  K,
  emb = "PCs",
  n_dim = 8,
  covars = NULL,
  MCAR = FALSE,
  CAR = FALSE,
  smooth = TRUE,
  r = 3,
  nsim = 2000,
  burn = 1000,
  z_init = NULL
)

Arguments

seurat_obj

An integrated Seurat object.

K

The number of sub-populations to infer. Each should be present in each sample.

emb

The cell spot embedding to use. Either one of "PCs", "scGNN", "harmony", "HVGs", or "SVGs".

n_dim

The number of dimensions to use.

covars

Column names of Seurat meta data to use as covariates. If none specified, will fit a global intercept and sample-indicator model for cell type membership probabilities.

MCAR

Logical. Include multivariate CAR random intercepts in gene expression model?

CAR

Logical. Include univariate CAR random intercepts in multinomial gene expression model?

smooth

Logical. Use manual spatial smoothing controlled by r parameter?

r

Spatial smoothing parameter for if smooth == TRUE. Should be greater than 0 with larger values enforcing stronger prior spatial association.

nsim

Number of total MCMC iterations to conduct.

burn

Number of initial MCMC iterations to discard as burn in. The number of saved iterations is nsim-burn.

z_init

Initialized cluster allocation vector to aid in MCMC convergence. If NULL z_init will be set using hierarchical clustering.

Value

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

Examples

## Not run: 
brain1 <- LoadData("stxBrain", type = "anterior1")
brain2 <- LoadData("stxBrain", type = "anterior2")
brain1 <- SCTransform(brain1, assay = "Spatial", verbose = FALSE)
brain2 <- SCTransform(brain2, assay = "Spatial", verbose = FALSE)
brain <- merge(brain1,brain2)
DefaultAssay(brain) <- "SCT"
VariableFeatures(brain) <- c(VariableFeatures(brain1),VariableFeatures(brain2))
brain <- RunPCA(brain)
brain_fit_PCs <- fit_maple(brain,K = 6,emb = "PCs")

## End(Not run)



maple documentation built on March 18, 2022, 6:02 p.m.

Related to fit_maple in maple...