scviva.tools.harreman.hotspot.calculate_module_scores#

scviva.tools.harreman.hotspot.calculate_module_scores(adata, device='auto', verbose=False)[source]#

Calculate module scores for gene modules across cells.

Parameters:
adata AnnData

Annotated data object (AnnData). Required fields in adata.uns: - ‘layer_key’: name of the layer from which to extract the expression matrix - ‘model’: statistical model used to normalize expression (e.g., ‘DANB’, ‘normal’) - ‘umi_counts’: total UMI counts per cell - ‘gene_modules_dict’: dictionary mapping module IDs (as strings) to lists of gene names

device device | str

Device to use for computation (e.g., CUDA or CPU). Defaults to GPU if available.

verbose bool | None

Whether to print progress and status messages.

Return type:

None

Returns:

None The following results are stored in the AnnData object: - adata.obsm['module_scores']: (cells x modules) DataFrame with per-cell module scores - adata.varm['gene_loadings']: (genes x modules) DataFrame with gene loadings per module - adata.uns['gene_modules']: dictionary mapping module names to gene lists