harreman.hotspot.create_modules#
- harreman.hotspot.create_modules(adata, min_gene_threshold=20, fdr_threshold=0.05, z_threshold=None, core_only=False, verbose=False)[source]#
Perform hierarchical clustering on gene-gene local correlation Z-scores to assign gene modules.
- Parameters:
adata (AnnData) – Annotated data object (AnnData) containing the local correlation Z-scores in adata.uns[‘lc_zs’].
min_gene_threshold (int, optional (default: 20)) – Minimum number of genes required to define a module.
fdr_threshold (float, optional (default: 0.05)) – FDR threshold used to determine the minimum Z-score significance if z_threshold is not provided.
z_threshold (float, optional) – If provided, uses this Z-score as the cutoff for module inclusion instead of computing it from FDR.
core_only (bool, optional (default: False)) – If True, assigns only tightly correlated (core) genes to modules and leaves others unassigned.
- Returns:
The function modifies the AnnData object in place by adding the following to adata.uns: - modules: pandas Series mapping each gene to a module ID (integer, as string) - gene_modules_dict: dictionary mapping module IDs (as strings) to lists of gene names - linkage: linkage matrix from hierarchical clustering (for visualization or tree operations)
- Return type:
None