fitPseudotime: Fit probabilistic pseudotime model

Description Usage Arguments Details Value Examples

View source: R/pseudogp.R

Description

This method takes one or more reduced-dimension representations of the gene expression data and returns a one-dimensional Bayesian Gaussian Process latent variable model as a 'stanfit' object. The free parameters 'smoothing_alpha' and 'smoothing_beta' correspond to the hyper-hyper distribution on 'lambda' which effectively controls the arc-length and therefore the smoothness of the pseudotime trajectories.

Usage

1
2
3
4
fitPseudotime(X, initialise_from = c("random", "principal_curve", "pca"),
  smoothing_alpha = 10, smoothing_beta = 3, pseudotime_mean = 0.5,
  pseudotime_var = 1, chains = 1, iter = 1000,
  seed = sample.int(.Machine$integer.max, 1), ...)

Arguments

X

Either a ncells-by-2 reduced dimension matrix or list of such matrices corresponding to multiple representations.

initialise_from

How to initialise the MCMC chain. One of "random" (stan decides), "principal_curve", or "pca" (the first component of PCA rescaled is taken to be the pseudotimes). Note: if multiple representations are provided, pseudogp will take the principal curve or pca from the first rather than combining them. If a particular representation is required, it is up to the user to re-order them.

smoothing_alpha

The hyperparameter for the Gamma distribution that controls arc-length

smoothing_beta

The hyperparameter for the Gamma distribution that controls arc-length

pseudotime_mean

The mean of the constrained normal prior on the pseudotimes

pseudotime_var

The variance of the constrained normal prior on the pseudotimes

chains

The number of chains for the MCMC trace

iter

The number of iterations for the MCMC trace

seed

The seed argument that is passed to stan. Explicitly defined here as it is used if "principal_curve" is defined as initialisation to ensure consistency.

...

Additional arguments to be passed to rstan::stan that can control curve fitting (ie the HMC inference algorithm)

Details

This function essentially wraps the rstan function stan, and in doing so returns a stanfit object. To extract posterior pseudotime samples see example below.

Value

An object of class rstan::stan, that contains posterior samples for the model parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
## load libraries for MAP and credible intervals:
library(coda)
library(MCMCglmm)
fit <- fitPseudotime(...)
pst <- extract(fit, pars = "t")$t # extract pseudotime from stan object
tmcmc <- mcmc(pst)
tmap <- posterior.mode(tmcmc) # extract MAP estimate of pseudotimes
hpd_intervals <- HPDinterval(tmcmc) # extract HPD credible intervals (95% default)

## End(Not run)

kieranrcampbell/pseudogp documentation built on May 20, 2019, 9:24 a.m.