Skip to contents

Calculate direct communication features from a kernel

Usage

calculateDirect(
  kernel,
  unifKernel = NULL,
  cells,
  Dcell = NULL,
  bundle = TRUE,
  patient_names = NULL,
  zero_threshold = 1
)

Arguments

kernel

Kernel array returned by compute_kernel().

unifKernel

Optional normalized baseline kernel.

cells

Character vector of cell-type names.

Dcell

Patient-by-cell-type abundance matrix, used to weight raw (unnormalized) scores. Ignored when unifKernel is supplied, since the abundance weights cancel out of the ratio.

bundle

Logical; if TRUE, combine reciprocal directions.

patient_names

Optional character vector of patient labels, matching the patient order in kernel. Defaults to Patient_1, Patient_2, ... when omitted, matching compute_racing_montecarlo()'s output when it is also given real names.

zero_threshold

Drop a cell-type pair once its fraction of zero-valued patients reaches this threshold. Default 1 only drops pairs that are zero for every patient (the original behavior); lower it (e.g. 0.9) to also drop merely zero-inflated pairs.

Value

A patient-by-feature data frame of direct communication scores. Cell-type pairs with no possible ligand-receptor pathway in any patient (zero for every patient) are dropped rather than returned as all-zero columns.