Test whether or not the pseudotime distribution are identical within lineages between conditions

progressionTest(pseudotime, ...)

# S4 method for matrix
progressionTest(
  pseudotime,
  cellWeights,
  conditions,
  global = TRUE,
  lineages = FALSE,
  method = ifelse(dplyr::n_distinct(conditions) == 2, "KS", "Classifier"),
  thresh = ifelse(method == "Classifer", 0.05, 0.01),
  args_mmd = list(),
  args_classifier = list(),
  args_wass = list(),
  rep = 10000
)

# S4 method for SlingshotDataSet
progressionTest(
  pseudotime,
  conditions,
  global = TRUE,
  lineages = FALSE,
  method = ifelse(dplyr::n_distinct(conditions) == 2, "KS", "Classifier"),
  thresh = ifelse(method == "Classifer", 0.05, 0.01),
  args_mmd = list(),
  args_classifier = list(),
  args_wass = list(),
  rep = 10000
)

# S4 method for SingleCellExperiment
progressionTest(
  pseudotime,
  conditions,
  global = TRUE,
  lineages = FALSE,
  method = ifelse(dplyr::n_distinct(conditions) == 2, "KS", "Classifier"),
  thresh = ifelse(method == "Classifer", 0.05, 0.01),
  args_mmd = list(),
  args_classifier = list(),
  args_wass = list(),
  rep = 10000
)

# S4 method for PseudotimeOrdering
progressionTest(
  pseudotime,
  conditions,
  global = TRUE,
  lineages = FALSE,
  method = ifelse(dplyr::n_distinct(conditions) == 2, "KS", "Classifier"),
  thresh = ifelse(method == "Classifer", 0.05, 0.01),
  args_mmd = list(),
  args_classifier = list(),
  args_wass = list(),
  rep = 10000
)

Arguments

pseudotime

Can be either a SlingshotDataSet or a SingleCellExperiment object or a matrix of pseudotime values, each row represents a cell and each column represents a lineage.

...

parameters including:

cellWeights

If pseudotime is a matrix of pseudotime values, this represent the cell weights for each lineage. Ignored if pseudotime is not a matrix.

conditions

Either the vector of conditions, or a character indicating which column of the metadata contains this vector.

global

If TRUE, test for all lineages simultaneously.

lineages

If TRUE, test for all lineages independently.

method

One of "KS", "Classifier", "mmd", "wasserstein_permutation" or "Permutation" for a permutation. See details. Default to KS if there is two conditions and to "Classifier" otherwise.

thresh

The threshold for the KS test or Classifier test. Ignored if method = "Permutation". Default to .01 for KS and .05 for the 'classifier'.

args_mmd

arguments passed to the mmd test. See mmd_test.

args_classifier

arguments passed to the classifier test. See classifier_test.

args_wass

arguments passed to the wasserstein permutation test. See wasserstein_permut.

rep

Number of permutations to run. Ignored if method = "KS". Default to 1e4.

Value

A data frame with 3 columns:

  • lineage for individual lineages, the lineage number. For global, "All".

  • p.value the pvalue for the test at the global or lineage level

  • statistic for individual lineages, either the modified KS statistic if method = "KS", or the weighted difference of means, if method = "Permutation". For the global test, the combined Z-score.

Details

For every lineage, we compare the pseudotimes of the cells from either conditions, using the lineage weights as observations weights.

  • If method = "KS", this uses the updated KS test, see ks_test for details.

  • If method = "Classifier", this uses a classifier to assess if that classifier can do better than chance on the conditions

  • If method = "Permutation", the difference of weighted mean pseudotime between condition is computed, and a p-value is found by permuting the condition labels.

  • If method = "mmd", this uses the mean maximum discrepancies statistics.

The p-value at the global level can be computed in two ways. method is "KS" or "Permutation", then the p-values are computed using stouffer's z-score method, with the lineages weights acting as weights. Otherwise, the test works on multivariate data and is applied on all pseudotime values.

References

Stouffer, S.A.; Suchman, E.A.; DeVinney, L.C.; Star, S.A.; Williams, R.M. Jr. (1949). The American Soldier, Vol.1: Adjustment during Army Life. Princeton University Press, Princeton.

Examples

data('slingshotExample', package = "slingshot") rd <- slingshotExample$rd cl <- slingshotExample$cl condition <- factor(rep(c('A','B'), length.out = nrow(rd))) condition[110:139] <- 'A' sds <- slingshot::slingshot(rd, cl) progressionTest(sds, condition)
#> lineage statistic p.value #> 1 All 2.873272 0.002031221