harreman.hotspot.calculate_module_scores#
- harreman.hotspot.calculate_module_scores(adata, device=device(type='cpu'), 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 (torch.device, optional) – Device to use for computation (e.g., CUDA or CPU). Defaults to GPU if available.
verbose (bool, optional (default: False)) – Whether to print progress and status messages.
- Returns:
The following results are stored in the AnnData object: - adata.obsm[‘module_scores’]: (cells x modules) DataFrame with per-cell module activity scores - adata.varm[‘gene_loadings’]: (genes x modules) DataFrame with gene loadings for each module - adata.uns[‘gene_modules’]: dictionary mapping module names to gene lists
- Return type:
None