muon.atac.pp.tfidf#
- muon.atac.pp.tfidf(data: AnnData | MuData, log_tf: bool = True, log_idf: bool = True, log_tfidf: bool = False, scale_factor: int | float = 10000.0, inplace: bool = True, copy: bool = False, from_layer: str | None = None, to_layer: str | None = None)#
Transform peak counts with TF-IDF (Term Frequency - Inverse Document Frequency).
TF: peak counts are normalised by total number of counts per cell DF: total number of counts for each peak IDF: number of cells divided by DF
By default, log(TF) * log(IDF) is returned.
- Parameters:
data – AnnData object with peak counts or multimodal MuData object with ‘atac’ modality.
log_idf – Log-transform IDF term (True by default).
log_tf – Log-transform TF term (True by default).
log_tfidf – Log-transform TF*IDF term (False by default). Can only be used when log_tf and log_idf are False.
scale_factor – Scale factor to multiply the TF-IDF matrix by (1e4 by default).
inplace – If to modify counts in the AnnData object (True by default).
copy – If to return a copy of the AnnData object or the ‘atac’ modality (False by default). Not compatible with inplace=False.
from_layer – Layer to use counts (AnnData.layers[from_layer]) instead of AnnData.X used by default.
to_layer – Layer to save transformed counts to (AnnData.layers[to_layer]) instead of AnnData.X used by default. Not compatible with inplace=False.