Learn R Programming

⚠️There's a newer version (1.5.0) of this package.Take me there.

DeLorean (version 1.2.0)

Estimates Pseudotimes for Single Cell Expression Data

Description

Implements the DeLorean model to estimate pseudotimes for single cell expression data. The DeLorean model uses a Gaussian process latent variable model to model uncertainty in the capture time of cross-sectional data.

Copy Link

Version

Install

install.packages('DeLorean')

Monthly Downloads

13

Version

1.2.0

License

MIT + file LICENSE

Maintainer

John Reid

Last Published

April 15th, 2016

Functions in DeLorean (1.2.0)

cov.calc.gene.conditioned

Calculate covariance for gene over test inputs when conditioned on data at estimated pseudotimes.
cov.all.genes.conditioned

Calculate covariances for all genes when conditioned on data at estimated pseudotimes.
de.lorean

Initialise DeLorean object
alpha.for.rug

Calculate a suitable value for a rug plot given the number of points
calc.inducing.pseudotimes

Calculate inducing pseudotimes for sparse approximation
held.out.melt

Melt held out genes
filter.cells

Filter cells
held.out.posterior

Calculate posterior covariance and estimate parameters for held out genes given pseudotimes estimated by DeLorean model.
held.out.select.genes

Select held out genes by those with highest variance
ordering.invert

Invert the ordering
cmp.profiles.plot

Plot a comparison of the profiles from several de.lorean objects
cov.calc.dl.dists

Calculate distances over estimated pseudotimes and test inputs.
filter.genes

Filter genes
de.lorean.stylesheet

The filename of the R markdown stylesheet
cov.calc.dists

Calculate distances between vectors of time points
fit.model.sample

Fit the model using Stan sampler
find.good.ordering

Run a find good ordering method and append results to existing orderings
test.fit

Test fit for log normal and gamma
fit.model

Fit the model using specified method (sampling or variational Bayes).
get.posterior.mean

Get posterior mean of samples
knit.report

Knit a report, the file inst/Rmd/.Rmd must exist in the package directory.
ordering.metropolis.hastings

Metropolis-Hastings on orderings.
fit.held.out

Fit held out genes
tau.offsets.plot

Plot the tau offsets, that is how much the pseudotimes (tau) differ from their prior means over the full posterior.
cov.matern.32

Matern 3/2 covariance function
roughness.test

Calculate roughnesses under fit samples and also under random permutations
windram.expr

Windram et al. investigated the defense response in Arabidopsis thaliana to the necrotrophic fungal pathogen Botrytis cinerea. They collected data at 24 time points in two conditions for 30336 genes.
default.num.cores

Default number of cores to use.
compile.model

Compile the model and cache the DSO to avoid unnecessary recompilation.
ordering.is.valid

Check that it is a valid ordering
ordering.test.score

Test ordering score: sum every time consecutive items are in order.
ordering.random.block.move

Randomly move a block in an ordering to another location
cov.periodise

Makes a distance periodic
expr.data.plot

Plot the expression data by the capture points
estimate.hyper

Estimate hyperparameters for model using empirical Bayes.
aov.dl

Perform an analysis of variance to select genes for the DeLorean model.
centralise

Centralises a periodic position into [period/2, period) by shifting by n*period, where n is an integer
mutate.profile.data

Mutate the profile data into shape compatible with GP plot function
partition.de.lorean

Partition de.lorean object by cells
find.smooth.tau

Find best order of the samples assuming some smooth GP prior on the expression profiles over this ordering.
print.de.lorean

Print details of DeLorean object
held.out.posterior.filter

Filter the genes
optimise.best.sample

Optimise the best sample and update the best.sample index.
ordering.move

Move one item in an ordering and shift the other items.
test.robustness.de.lorean

Test robustness of pseudotime estimation on subsets of de.lorean object
ordering.improve

Improve the ordering in the sense that some function is maximised.
analyse.noise.levels

Analyse noise levels and assess which genes have the greatest ratio of temporal variance to noise. This are labelled as the 'gene.high.psi' genes.
ordering.maximise

Find a good ordering in the sense that some function is locally maximised.
fit.dl

Perform all the steps necessary to fit the model. - prepare the data - compile the model - find suitable initialisations - fit the model using the specified method (sampling or variational Bayes) - process the posterior.
inducing.covariance

Calculate the covariance structure of the inducing points
plot.add.expr

Add expression data to a plot
permute.df

Permute a data frame, x. If group.col is given it should name an ordered factor that the order of the permutation should respect.
marg.like.plot

Plot posterior for marginal log likelihoods of individual gene's expression profiles
kouno.expr

Kouno et al. investigated the transcriptional network controlling how THP-1 human myeloid monocytic leukemia cells differentiate into macrophages. They provide expression values for 45 genes in 960 single cells captured across 8 distinct time points.
roughness.of.permutations

Apply permutation based roughness test to held out genes
gene.covariances

Calculate the covariance structure of the tau
dim.de.lorean

Dimensions of DeLorean object
pseudotimes.pair.plot

Plot two sets of pseudotimes against each other.
analyse.variance

Analyse variance of expression between and within capture times.
create.ordering.ll.fn

Calculate the covariance structure of evenly spread tau and create a function that calculates the log likelihood of orderings.
held.out.posterior.by.variation

Order the genes by the variation of their posterior mean
guo.expr

Single cell expression data and meta data from Guo et al. (2012). They investigated the expression of 48 genes in 500 mouse embryonic cells.
process.posterior

Process the posterior, that is extract and reformat the samples from Stan. We also determine which sample has the highest likelihood, this is labelled as the 'best' sample.
is.de.lorean

Is a DeLorean object?
test.mh

Test ordering Metropolis-Hastings sampler.
calc.roughness

Calculate the roughness of the vector. The roughness is the RMS of the differences between consecutive points.
fit.model.vb

Fit the model using Stan variational Bayes
anders.huber.cell.sizes

Estimate the cell sizes according to Anders & Huber Differential expression analysis for sequence count data
ordering.random.move

Randomly move one item in an ordering to another location
orderings.plot

Plot likelihoods of orderings against elapsed times taken to generate them
plot.add.mean.and.variance

Add posterior representation to a plot.
pseudotimes.from.orderings

Convert best orderings into initialisations
roughnesses.plot

Plot results of roughness test
DeLorean

DeLorean.
estimate.capture.cell.sizes

Estimate the cell sizes per capture. Only uses genes that are expressed in more than half the cells.
held.out.posterior.join

Join with another data frame. Useful for adding gene names etc..
Rhat.plot

Plot the Rhat convergence statistics. examine.convergence must be called before this plot can be made.
examine.convergence

Analyse the samples and gather the convergence statistics. Note this only makes sense if a sampling method was used to fit the model as opposed to variational Bayes.
find.best.tau

Find best tau to initialise chains with by sampling tau from the prior and using empirical Bayes parameter estimates for the other parameters.
profiles.plot

Plot best sample predicted expression.
adjust.by.cell.sizes

Estimate the cell sizes and adjust the expression by cell size.
expected.sample.var

The expected within sample variance of a Gaussian with the given covariance.
report.file

The filename of the R markdown report.
cov.calc.gene

Calculate covariance structure for gene over pseudotimes and test inputs.
gp.log.marg.like

The log marginal likelihood. See "2.3 Varying the Hyperparameters" on page 19 of Rasmumssen and Williams' book.
prepare.for.stan

Prepare for Stan
pseudotime.plot

Plot pseudotime (tau) against observed capture time.
magda.find.orderings

Use Magda's code to find good orderings
melt.expr

Melt an expression matrix.
avg.par.samples

Average across a parameters samples.
gp.predictions.df

Convert the output of gp.predict() into a data.frame.
make.predictions

Make predictions
gp.predict

Predictive mean, variance and log marginal likelihood of a GP. See "2.3 Varying the Hyperparameters" on page 19 of Rasmumssen and Williams' book.
ordering.block.move

Move a block in an ordering and shift the other items.
make.init.fn

Returns a function that constructs parameter settings with good tau.
plot.held.out.posterior

Plot the posterior of held out genes
permuted.roughness

Permute cells and test roughness of expression.
gaussian.condition

Condition a Guassian on another. See Eqn. A.6 on page 200 of Rasmumssen and Williams' book.
plot.de.lorean

Various DeLorean object plots
roughness.of.sample

Calculate the roughness of the held out genes given the sample.
seriation.find.orderings

Use seriation package to find good orderings