pyucell.compute_scores_from_ranks#
- pyucell.compute_scores_from_ranks(adata, ranks, signatures, max_rank=1500, missing_genes='impute', w_neg=1.0, suffix='_UCell')#
Compute UCell scores from a pre-computed rank matrix.
Use this when scoring multiple signature sets against the same dataset: compute ranks once with
get_rankings, then call this function for each set of signatures without re-ranking.- Parameters:
adata (AnnData) – AnnData object whose obs will receive the scores. Must share var_names and obs_names with the object used to compute
ranks.ranks (csr_matrix of shape (n_genes, n_cells)) – Pre-computed rank matrix from
get_rankings.signatures (dict[str, list[str]]) – Signature name → list of gene names.
max_rank (int) – Must match the
max_rankused inget_rankings.missing_genes (str) – “impute”: missing genes are treated as max_rank. “skip”: missing genes are excluded.
w_neg (float) – Weight on negative gene sets.
suffix (str) – Appended to each signature name when writing to adata.obs.
- Return type: