testPseudotime: Test for differences along pseudotime

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Implements a simple method of testing for significant differences with respect to pseudotime, based on fitting linear models with a spline basis matrix.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
testPseudotime(x, ...)

## S4 method for signature 'ANY'
testPseudotime(
  x,
  pseudotime,
  df = 5,
  get.lfc = TRUE,
  get.spline.coef = FALSE,
  trend.only = TRUE,
  block = NULL,
  BPPARAM = NULL
)

## S4 method for signature 'SummarizedExperiment'
testPseudotime(x, ..., assay.type = "logcounts")

Arguments

x

A numeric matrix-like object containing log-expression values for cells (columns) and genes (rows). Alternatively, a SummarizedExperiment containing such a matrix.

...

For the generic, further arguments to pass to specific method.

For the SummarizedExperiment method, further arguments to pass to the ANY method.

pseudotime

A numeric vector of length equal to the number of columns of x.

df

Integer scalar specifying the degrees of freedom for the splines.

get.lfc

Logical scalar indicating whether to return an overall log-fold change along each path.

get.spline.coef

Logical scalar indicating whether to return the estimates of the spline coefficients.

trend.only

Logical scalar indicating whether only differences in the trend should be considered when testing for differences between paths.

block

Factor of length equal to the number of cells in x, specifying the blocking factor.

BPPARAM

A BiocParallelParam object from the BiocParallel package, used to control parallelization.

assay.type

String or integer scalar specifying the assay containing the log-expression matrix.

Details

Tis function fits a natural spline to the expression of each gene with respect to pseudotime. It then does an ANOVA to test whether any of the spline coefficients are non-zero. In this manner, genes exhibiting a significant (and potentially non-linear) trend with respect to the pseudotime can be detected as those with low p-values.

For trajectories with multiple paths, only one path should be tested at a time. This usually involves passing a single column of the matrix returned from orderCells. Cells with NA values in pseudotime are assumed to be assigned to a different path and are ignored.

By default, estimates of the spline coefficients are not returned as they are difficult to interpret. Rather, a log-fold change of expression along each path is estimated to provide some indication of the overall magnitude and direction of any change.

block can be used to fit a separate linear model to each of multiple batches, after which the statistics are combined across batches as described in testLinearModel. This avoids potential confounding effects from batch-specific differences in the distribution of cells across pseudotime.

Value

A DataFrame is returned containing the statistics for each gene (row), including the p-value and its BH-adjusted equivalent. If get.lfc=TRUE, an overall log-fold change is returned for each path.

If get.spline.coef=TRUE, the estimated spline coefficients are also returned (single path) or the differences in the spline fits to the first path are returned (multiple paths).

Author(s)

Aaron Lun

See Also

orderCells, to generate the pseudotime matrix.

testLinearModel, which performs the tests under the hood.

Examples

1
2
3
4
5
6
7
y <- matrix(rnorm(10000), ncol=100)
u <- runif(100)
testPseudotime(y, u)

# Handling a blocking factor.
b <- gl(2, 50)
testPseudotime(y, u, block=b)

TSCAN documentation built on Nov. 8, 2020, 5:13 p.m.