BASiCStan: Stan implementation of BASiCS.

View source: R/BASiCStan.R

BASiCStanR Documentation

Stan implementation of BASiCS.

Description

The stan programming language enables the use of MAP, VB, and HMC inference. Only the regression mode featuring a joint prior between mean and overdispersion parameters is implemented

Usage

BASiCStan(
  Data,
  Method = c("vb", "sampling", "optimizing"),
  WithSpikes = length(altExpNames(Data)) > 0,
  Regression = TRUE,
  BatchInfo = Data$BatchInfo,
  L = 12,
  PriorMu = c("EmpiricalBayes", "uninformative"),
  NormFactorFun = scran::calculateSumFactors,
  ReturnBASiCS = TRUE,
  Verbose = TRUE,
  ...
)

Arguments

Data

SingleCellExperiment object

Method

Inference method. One of: "vb" for Variational Bayes, "sampling" for Hamiltonian Monte Carlo, "optimizing" for or maximum a posteriori estimation.

WithSpikes

Do the data contain spike-in genes? See BASiCS for details. When WithSpikes=FALSE, the cell-specific scaling normalisation factors are fixed; use NormFactorFun to specify how size factors should be generated or extracted.

Regression

Use joint prior for mean and overdispersion parameters? Included for compatibility with BASiCS_MCMC, but only TRUE is supported.

BatchInfo

Vector describing which batch each cell is from.

L

Number of regression terms (including slope and intercept) to use in joint prior for mu and delta.

PriorMu

Type of prior to use for mean expression. Default is "EmpiricalBayes", but "uninformative" is the prior used in Eling et al. and previous work.

NormFactorFun

Function that returns cell-specific scaling normalisation factors. See computeSumFactors for details on the default.

ReturnBASiCS

Should the object be converted into a BASiCS_Chain object?

Verbose

Should output of the stan commands be printed to the terminal?

...

Passed to vb or sampling.

Value

An object of class BASiCS_Chain.

Examples

library("BASiCS")
sce <- BASiCS_MockSCE(NGenes = 10, NCells = 10)

fit_spikes <- BASiCStan(sce, tol_rel_obj = 1)

## uses fixed scaling normalisation factors
fit_nospikes <- BASiCStan(sce, WithSpikes = FALSE, tol_rel_obj = 1)


Alanocallaghan/BASiCStan documentation built on Feb. 19, 2024, 10:40 p.m.