Enhancer links¶
Peak-to-gene links from RNA, ATAC and gene coordinates.
rustscenic.enhancer ¶
Enhancer-to-gene linking for chromatin-aware regulatory networks.
pySCENIC scores regulons as "TF → its top-N co-expressed target genes". SCENIC+ adds chromatin context:
TF → enhancer (motif enrichment, from cistarget) ↓ enhancer → target gene (peak accessibility ↔ gene expression correlated across matched cells)
The enhancer-to-gene edge is what this module produces. Combined with the motif-to-enhancer and TF-to-target edges rustscenic already computes, it is the raw material for eRegulons.
This module requires matched cells: every cell in rna_adata.obs_names
must also be in atac_adata.obs_names. Multiome data (10x Multiome
or nf-core/multiome) is the natural input. For non-matched samples,
CCA or Harmony-style integration needs to happen upstream.
Complexity: O(n_peaks × max_genes_in_window × n_cells) where max_genes_in_window is typically 20–50. On 100k peaks × 30 candidate genes × 50k cells that is about 150 GFLOPs. The Pearson path keeps the hot loop in Rust and emits only surviving peak-gene links back to pandas.
link_peaks_to_genes ¶
link_peaks_to_genes(
rna_adata,
atac_adata,
gene_coords: DataFrame,
peak_coords: DataFrame | None = None,
*,
max_distance: int = 500000,
min_abs_corr: float = 0.1,
method: str = "pearson",
) -> pd.DataFrame
Link ATAC peaks to nearby gene expression.
For each peak, finds candidate target genes whose TSS is within
max_distance bp of the peak center, computes the correlation of
peak accessibility vs gene expression across the matched cells, and
returns links whose absolute correlation exceeds min_abs_corr.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rna_adata
|
|
required | |
atac_adata
|
|
required | |
gene_coords
|
DataFrame
|
|
required |
peak_coords
|
DataFrame | None
|
Optional override; |
None
|
max_distance
|
int
|
Maximum bp between a peak's centre and a gene's TSS for the pair to be considered (default 500 kb, matching pycisTopic). |
500000
|
min_abs_corr
|
float
|
Minimum absolute correlation to emit a link (default 0.1). Increase for stricter filtering. |
0.1
|
method
|
str
|
Must be |
'pearson'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
One row per surviving peak-gene link with columns:
|