tfidf: TF-IDF normalization

View source: R/models.R

tfidfR Documentation

TF-IDF normalization

Description

Run TF-IDF on binary cell x peak matrix. Returns normalized TF-IDF values in the residuals slot. Code adapted from Andrew Hill (http://andrewjohnhill.com/blog/2019/05/06/dimensionality-reduction-for-scatac-data/).

Usage

tfidf(
  obj,
  frequencies = T,
  log_scale_tf = T,
  scale_factor = 10000,
  doL2 = F,
  slotName = "residuals"
)

Arguments

obj

list object containing dgCMatrix in 'counts' slot.

frequencies

logical, whether to scale matrix by barcode peak sums. Defaults to TRUE.

log_scale_tf

logical, whether to log1p transform the term frequency (TF). Defaults to TRUE.

scale_factor

numeric,

doL2

logical, whether or not to L2 normalize TFIDF values (per cell). Defaults to FALSE.

slotName

character, specify the slot name for saving residuals. Useful for saving multiple normalization steps. Note, make sure to update the slotName argument for downstream functions. Defaults to "residuals".


plantformatics/Socrates documentation built on April 3, 2025, 1:02 p.m.