ouija: Fit descriptive single-cell pseudotime using Ouija

Description Usage Arguments Details Value Examples

View source: R/ouija.R

Description

Given single-cell expression data fit a Bayesian non-linear factor analysis model using Ouija. This infers pseudotimes along with interpretable gene behaviour parameters (corresponding to switch times and strengths, peak times and lengths). Each gene must be specified beforehand as switch-like or transient (default to all switch-like). Priors on all parameters may also be specified.

Usage

1
2
3
4
5
6
ouija(x, response_type = "switch", switch_strengths = NULL,
  switch_times = NULL, switch_strength_sd = NULL,
  switch_time_sd = NULL, peak_times = NULL, peak_lengths = NULL,
  peak_time_sd = NULL, peak_length_sd = NULL, student_df = 10,
  inference_type = c("hmc", "vb"), normalise_expression = TRUE,
  single_cell_experiment_assay = "logcounts", ...)

Arguments

x

Input expression. See details below.

response_type

A vector declaring whether each gene exhibits "switch" or "transient" expression. Defaults to "switch" for all genes

switch_strengths

Prior means of switch strengths

switch_times

Prior means of switch times

switch_strength_sd

Prior standard deviations of switch strengths

switch_time_sd

Prior standard deviations of switch times

peak_times

Prior means of peak times

peak_lengths

Prior means of peak lengths

peak_time_sd

Prior standard deviations of peak times

peak_length_sd

Prior standard deviations of peak lengths

student_df

Degrees of freedom for the student's t likelihood

inference_type

The type of inference to be performed, either hmc for Hamiltonian Monte Carlo or vb for ADVI (Variational Bayes). Note that HMC is typically more accurate but VB will be orders of magnitude faster.

normalise_expression

Logical, default TRUE. If TRUE the data is pre-normalised so the average peak expression is approximately 1. This makes the strength parameters approximately comparable between genes.

single_cell_experiment_assay

Character vector specifying the assay from SingleCellExperiment to use. Defaults to "logcounts", so the input expression matrix used is assay(single_cell_experiment, "logcounts").

...

Additional arguments to rstan::sampling or rstan::vb

Details

Input format

Ouija takes input in three formats:

  1. A cell-by-gene expression matrix of non-negative values. We recommend using log2(TPM + 1) or log2(RPKM + 1) as this is what the mean-variance relationship in the model is designed for.

  2. [Recommended] A SingleCellExperiment (from the SingleCellExperiment) package

Controlling inference with stan

The ... argument accepts various parameters than can be passed to rstan to control inference using HMC sampling. Specifically these are

  1. iter Number of HMC iterations (default 1e4)

  2. warmup Number of iterations to use as warmup (defaults to iter/2)

  3. chains Number of HMC chains to run in parallel (defaults to 1, but more recommended)

  4. thin The thinning of the markov chain (ie every thin iteration is kept). Defaults so that 1000 samples are returned.

Value

An object of type ouija_fit which contains both the stan fit along with information about the setup. For more information see the vignette (online at http://kieranrcampbell.github.io/ouija/).

Examples

1
2
3
4
5
6
## Not run: 
data(example_gex)
response_types <- c(rep("switch", 9), rep("transient", 2))
oui <- ouija(example_gex[1:40,], response_type = response_types, iter = 100)

## End(Not run)

kieranrcampbell/ouija documentation built on Dec. 2, 2019, 12:44 p.m.