scHopfield.tools.get_correlation_table

scHopfield.tools.get_correlation_table(adata: AnnData, cluster_key: str = 'cell_type', energy_type: str = 'total', n_top_genes: int = 20, order: list | None = None) DataFrame[source]

Get correlation table with top genes per cluster.

Creates a formatted table showing the top N genes correlated with energy for each cluster.

Parameters:
  • adata (AnnData) – Annotated data object with computed energy-gene correlations

  • cluster_key (str, optional (default: 'cell_type')) – Key in adata.obs for cluster labels

  • energy_type (str, optional (default: 'total')) – Type of energy correlation: ‘total’, ‘interaction’, ‘degradation’, or ‘bias’

  • n_top_genes (int, optional (default: 20)) – Number of top correlated genes to show per cluster

  • order (list, optional) – Order of clusters to display. If None, uses all unique clusters

Returns:

DataFrame with MultiIndex columns (cluster, [‘Gene’, ‘Correlation’]) showing top correlated genes for each cluster

Return type:

pd.DataFrame