Test whether or not slingshot should be fitted independently for different conditions or not.

topologyTest(sds, ...)

# S4 method for SlingshotDataSet
topologyTest(
  sds,
  conditions,
  rep = 100,
  threshs = 0.01,
  methods = ifelse(dplyr::n_distinct(conditions) == 2, "KS_mean", "Classifier"),
  parallel = FALSE,
  BPPARAM = BiocParallel::bpparam(),
  args_mmd = list(),
  args_classifier = list(),
  args_wass = list(),
  nmax = nrow(slingshot::slingPseudotime(sds))
)

# S4 method for SingleCellExperiment
topologyTest(
  sds,
  conditions,
  rep = 100,
  threshs = 0.01,
  methods = ifelse(dplyr::n_distinct(conditions) == 2, "KS_mean", "Classifier"),
  parallel = FALSE,
  BPPARAM = BiocParallel::bpparam(),
  args_mmd = list(),
  args_classifier = list(),
  args_wass = list(),
  nmax = ncol(sds)
)

# S4 method for PseudotimeOrdering
topologyTest(
  sds,
  conditions,
  rep = 100,
  threshs = 0.01,
  methods = ifelse(dplyr::n_distinct(conditions) == 2, "KS_mean", "Classifier"),
  parallel = FALSE,
  BPPARAM = BiocParallel::bpparam(),
  args_mmd = list(),
  args_classifier = list(),
  args_wass = list(),
  nmax = nrow(slingshot::slingPseudotime(sds))
)

Arguments

sds

A slingshot object already run on the full dataset. Can be either a SlingshotDataSet or a SingleCellExperiment object.

...

parameters including:

conditions

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

rep

How many permutations to run. Default to 50.

threshs

the threshold(s) for the KS test or classifier test. Default to .01 See ks_test and classifier_test.

methods

The method(s) to use to test. Must be among 'KS_mean', 'Classifier', "KS_all', "mmd' and 'wasserstein_permutation'. See details.

parallel

Logical, defaults to FALSE. Set to TRUE if you want to parallellize the fitting.

BPPARAM

object of class bpparamClass that specifies the back-end to be used for computations. See bpparam in BiocParallel package for details.

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.

nmax

How many samples to use to compute the mmd test. See details.

Value

A list containing the following components:

  • *method* The method used to test

  • *thresh* The threshold (if relevant)

  • *statistic* the value of the test statistic.

  • *p.value* the p-value of the test.

Details

If there is only two conditions, default to `KS_mean`. Otherwise, uses a classifier.

More than one method can be specified at once, which avoids running slingshot on the permutations more than once (as it is the slowest part).

For the `mmd_test`, if `null=unbiased`, it is recommand to set `nmax=2000` or something of that order of magnitude to avoid overflowing the memory.

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::getLineages(rd, cl) topologyTest(sds, condition, rep = 20)
#> Generating permuted trajectories
#> Running KS-mean test
#> method thresh statistic p.value #> 1 KS_mean 0.01 0.02571429 0.9999998