calc_pairwise_mmds: calc_pairwise_mmds

View source: R/calc_pairwise_mmds.R

calc_pairwise_mmdsR Documentation

calc_pairwise_mmds

Description

Maximum mean discrepancy (MMD) is a method for measuring distances between multivariate distributions. SampleQC uses this to determine which samples have similar distributions, and should therefore have the same model fit to them. In addition

Usage

calc_pairwise_mmds(
  qc_dt,
  qc_names = c("log_counts", "log_feats", "logit_mito"),
  annots_disc = NULL,
  annots_cont = NULL,
  one_group_only = NULL,
  n_cores = 4,
  sigma = length(qc_names),
  subsample = 100,
  n_times = 20,
  seed = 22
)

Arguments

qc_dt

data.table of QC metrics for all cells and samples

qc_names

List of metrics to actually use for calculating sample-to-sample distances

annots_disc, annots_cont

Which annotating variables should be added to the SampleQC object? These should be entries in qc_dt. annots_disc indicates discrete variables; annots_cont continuous variables.

one_group_only

A TRUE/FALSE variable specifying whether samples should be first clustered into groups, or assumed to form one group. The default is to cluster when there more than 10 samples, and not cluster when there are fewer than ten samples.

n_cores

How many cores to parallelize over?

sigma

Scale for MMD kernel (defaults to length of qc_names)

subsample

Should we downsample the number of cells per sample to this number

n_times

How many times do we sample MMD between each pair of samples? (if subsampled, MMD is a stochastic value)

Details

Calculates sample-to-sample MMD distances, clusters and embeds them

The most important variable to consider here is qc_names, which specifies the set of QC metrics that will be used both here and in later steps. The default is to use log counts, log features and the logit transformation of the mitochondrial proportion (under this transformation, the distribution is reasonably modelled as a gaussian mixture model)

Value

slightly funky sce object


wmacnair/SampleQC documentation built on Nov. 18, 2022, 5 p.m.