findInteractions: Calculate the Interaction Strength

View source: R/models.R

findInteractionsR Documentation

Calculate the Interaction Strength

Description

Calculate the interaction strength and statistical significance using random permutation tests.

Usage

findInteractions(
  data,
  idents,
  ligand,
  receptor,
  stats = c("mean", "median"),
  pair.fxn = c("+", "*"),
  n_perm = 100,
  emd = FALSE,
  nbins = 100,
  weighted = TRUE,
  p.adjust.method = "none",
  threshold = 0,
  min_pct = 0,
  max_pct = 1,
  drop_zero = FALSE,
  cutoff.stats = NA,
  return.perm = FALSE,
  n_cores = NULL,
  seed = 1
)

Arguments

data

Expression data. A d x M matrix with d rows of features and M columns of data points (cells).

idents

Cell type identity in characters or factors.

ligand

Name or index for ligand.

receptor

Name or index for receptor.

stats

Method used to calculate strength.

  • mean, using mean (Default).

  • medain, using median.

pair.fxn

Functions used to calculate pair strength.

  • +, using sum of the pairs (Default).

  • *, using product of the pairs.

n_perm

Number of random permutations. Default is 100.

emd

Whethter to run Earth Mover's Distance adjustment. Default is FALSE.

nbins

Number of bins to use for Earth Mover's Distance calculation. Default is 10.

weighted

Logic, compute weighted Earth Mover's Distance which will give higher weight/penalty on lowly expressed genes. Default is TRUE.

p.adjust.method

p value adjustment method. Default is "none". See details p.adjust.

threshold

Threshold used for interaction products. See details calcStrength.

min_pct

Earth Movre's Distance values below this percentile will be replaced with this percentile value. Default is 0.

max_pct

Earth Movre's Distance Values above this percentile will be replaced with this percentile value. Default is 1.

drop_zero

Whether to drop all the zeros in the data when calculating EMD. Default is FALSE.

cutoff.stats

Cutoff used to calculate the statistics (mean or median). Default is NA. If set to 0, all 0 values will be removed when calculating mean or median.

return.perm

Whether to return the permutation result. Default is FALSE.

n_cores

Number of cores used. Default is to use all cores - 1. See details makeCluster.

seed

Random seed number for permutation. Default is 1.

Value

Returns a list contains interaction strength and pvalues, optionally the null strength and Earth Mover's Distance similarity.


stevexniu/scMatchmaker documentation built on June 2, 2022, 12:35 p.m.