scHopfield.tools.get_top_eigenvector_genes

scHopfield.tools.get_top_eigenvector_genes(adata: AnnData, cluster: str, which: str = 'max', n_genes: int = 20, part: str = 'real', cluster_key: str = 'cell_type') DataFrame[source]

Get top genes from eigenvector corresponding to extreme eigenvalue.

Parameters:
  • adata (AnnData) – Annotated data object with computed eigenanalysis

  • cluster (str) – Cluster name

  • which (str, optional (default: 'max')) – Which eigenvalue to use: ‘max’ for largest real part, ‘min’ for smallest (most negative) real part

  • n_genes (int, optional (default: 20)) – Number of top genes to return

  • part (str, optional (default: 'real')) – Which part of eigenvector to use: ‘real’, ‘imag’, or ‘abs’

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

Returns:

DataFrame with columns ‘gene’ and ‘component_value’

Return type:

pd.DataFrame

Raises:

ValueError – If eigenanalysis has not been computed yet