Skip to contents

Compute peak-peak co-accessibility

Usage

add_co_accessibility(proj, ...)

# S3 method for class 'MarchRProject'
add_co_accessibility(
  proj,
  embedding_name = character(0),
  atac_assay_name = "PeakMatrix",
  dataset_names = character(0),
  dims_to_use = 1:30,
  cells_to_use = NULL,
  exclude_chr = NULL,
  k = 100L,
  knn_iteration = 500L,
  overlap_cutoff = 0.8,
  max_dist = 100000L,
  scale_to = 10000,
  log2_norm = TRUE,
  knn_method = knn_hnsw(),
  seed = 1L,
  verbose = getOption("MarchR.verbose", FALSE),
  overwrite = FALSE,
  ...
)

Arguments

proj

(MarchRProject) Project with a PeakMatrix and a dim reduction.

...

Additional arguments passed to methods.

embedding_name

(character) Dim reduction assay name; auto-selected if only one exists.

atac_assay_name

(character) Peak matrix assay name. Default "PeakMatrix".

dataset_names

(character) Datasets to include. Default all.

dims_to_use

(integer) Embedding dimensions to use. Default 1:30.

cells_to_use

(character; optional) Cell subset. Default NULL (all cells).

exclude_chr

(character; optional) Chromosomes to skip. Default NULL.

k

(integer) Cells per metacell. Default 100L.

knn_iteration

(integer) Anchor cells sampled. Default 500L.

overlap_cutoff

(numeric) Max fractional overlap between accepted metacells. Default 0.8.

max_dist

(integer) Max peak-summit distance in bp for a candidate pair. Default 100000L.

scale_to

(numeric) Per-metacell depth normalization target. Default 1e4.

log2_norm

(logical) Apply log2(x + 1) after depth normalization. Default TRUE.

knn_method

(function) KNN engine (BPCells partial-application). Default knn_hnsw().

seed

(integer) Random seed for metacell sampling. Default 1L.

verbose

(logical) Print progress messages. Default getOption("MarchR.verbose", FALSE).

overwrite

(logical) Replace an existing co_accessibility result. Default FALSE.

Value

proj with proj$co_accessibility populated as a data.frame with columns queryHits, subjectHits, seqnames, correlation, Variability1, Variability2, TStat, Pval, FDR, VarQuantile1, VarQuantile2.

Details

Reproduces ArchR's addCoAccessibility(): peaks are grouped into low-overlap KNN metacells built from a dim reduction, metacell peak counts are depth-normalized, and Pearson correlation is computed for every same-chromosome peak pair within max_dist of each other.