scviva.tools.harreman.hotspot.create_modules#

scviva.tools.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 | None

Minimum number of genes required to define a module.

fdr_threshold float | None

FDR threshold used to determine the minimum Z-score significance if z_threshold is not provided.

z_threshold float | None

If provided, uses this Z-score as the cutoff for module inclusion instead of computing it from FDR.

core_only bool

If True, assigns only tightly correlated (core) genes to modules and leaves others unassigned.

verbose bool | None

If True, print progress messages and the elapsed time.

Returns:

None 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 ops)