topologyTest: Differential Topology Test

topologyTestR Documentation

Differential Topology Test

Description

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

Usage

topologyTest(sds, ...)

## S4 method for signature '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)),
  distinct_samples = NULL
)

## S4 method for signature '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),
  distinct_samples = NULL
)

## S4 method for signature '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)),
  distinct_samples = NULL
)

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.

distinct_samples

The samples to which each cell belong to. Only use with method 'distinct'. See 'distinct_test' for help.

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.

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.

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 = 10)

HectorRDB/condiments documentation built on Feb. 5, 2024, 10:24 p.m.