scHopfield.tools.get_network_links
- scHopfield.tools.get_network_links(adata: AnnData, cluster_key: str = 'cell_type', return_format: str = 'dict') Dict[str, DataFrame] | DataFrame[source]
Extract network links (edges) from interaction matrices.
Converts interaction matrices (W) into edge list format suitable for network analysis. Each edge represents a gene-gene interaction with its coefficient value.
- Parameters:
adata (AnnData) – Annotated data object with fitted interaction matrices
cluster_key (str, optional (default: 'cell_type')) – Key in adata.obs for cluster labels
return_format (str, optional (default: 'dict')) – Return format: ‘dict’ returns dict of DataFrames per cluster, ‘combined’ returns single DataFrame with cluster column
- Returns:
- If ‘dict’: Dictionary mapping cluster names to DataFrames with columns:
source: source gene
target: target gene
coef_mean: interaction coefficient
coef_abs: absolute value of coefficient
If ‘combined’: Single DataFrame with additional ‘cluster’ column
- Return type:
dict or pd.DataFrame