scHopfield.tools.decompose_bias_energy
- scHopfield.tools.decompose_bias_energy(adata: AnnData, cluster: str, spliced_key: str = 'Ms', cluster_key: str = 'cell_type', x: ndarray | None = None) ndarray[source]
Calculate gene-wise bias energy decomposition.
Computes the bias energy contribution for each gene separately, allowing analysis of which genes contribute most to the total bias energy.
- Parameters:
adata (AnnData) – Annotated data object with fitted parameters
cluster (str) – Cluster name to use for bias vector
spliced_key (str, optional (default: 'Ms')) – Key in adata.layers for spliced counts
cluster_key (str, optional (default: 'cell_type')) – Key in adata.obs for cluster labels
x (np.ndarray, optional) – Optional expression data. If None, uses stored sigmoid values
- Returns:
Array of shape (n_cells, n_genes) with bias energy per gene
- Return type:
np.ndarray