STutils.tl.aucell#
- STutils.tl.aucell(adata, signatures, auc_threshold=0.05, noweights=False, seed=42, num_workers=2, use_raw=None)#
Calculate enrichment of gene signatures for single cells.
This function efficiently handles both dense and sparse expression matrices. For sparse matrices, it uses optimized CSR format operations to avoid unnecessary memory usage.
- Parameters:
adata (
AnnData) – The annotated data matrix.signatures (
Sequence[type[GeneSignature]]) – The gene signatures or regulons to calculate enrichment for.auc_threshold (
float(default:0.05)) – The fraction of the ranked genome to take into account for the calculation of the Area Under the recovery Curve.noweights (
bool(default:False)) – Should the weights of the genes part of a signature be used in calculation of enrichment?seed (
int(default:42)) – The random seed for sampling. Used for reproducibility in ranking calculations.num_workers (
int(default:2)) – The number of CPU cores to use for parallel processing.use_raw (
bool|None(default:None)) – Whether to userawattribute ofadata. Defaults toTrueif.rawis present.
- Return type:
- Returns:
list[str] A list of column names for the calculated AUC values, which are also added to
adata.obs.