Description Usage Arguments Details Value Author(s) See Also Examples
Implements a simple method of testing for significant differences with respect to pseudotime, based on fitting linear models with a spline basis matrix.
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")
|
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 |
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 |
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. |
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.
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).
Aaron Lun
orderCells
, to generate the pseudotime matrix.
testLinearModel
, which performs the tests under the hood.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.