Skip to content

Part 1 Enhancer Encoder

JasonLinjc edited this page Jul 14, 2026 · 3 revisions

Part 1 — Enhancer-activity encoder

Do this first — Part 2 loads this encoder (frozen).

The encoder (enhancer_predictor_256bp in EPInformer/models.py) predicts 256 bp enhancer activity from sequence. Target = log2(0.1 + Activity) where Activity = sqrt(H3K27ac_RPM · DNase_RPM).

1a. Preprocessing — ENCODE → ABC → 256 bp activity CSV

# DNase/H3K27ac BAMs + Hi-C (K562/GM12878)
python scripts/download_encode_data.py --cell-types K562,GM12878
for f in data/*/{DNase,H3K27ac}/ENCFF*.bam; do samtools index "$f"; done

# H3K27ac narrowPeaks = the encoder's summit source
python scripts/download_encode_data.py --from-manifest config/encoder_narrowpeaks.json
gunzip -f reference/*_H3K27ac.*.narrowPeak.gz

# ABC nomination + encoder CSV (also produces the enhancer-gene links used in Part 2)
python run_pipeline.py --config config/config.yaml --samples K562,GM12878 --stages links
#   -> batch_output/{cell}/links/{cell}_peak_5bins_around_summit_activity_sequence.csv

1b. Train the encoder (12-fold leave-chromosome-out)

python train_seqEncoder.py --cell K562 \
    --data-csv batch_output/K562/links/K562_peak_5bins_around_summit_activity_sequence.csv \
    --loss l1kl --batch-size 256 --output-dir results/seqencoder/K562 --epochs 50
# all 12 folds via SLURM:   CELL=K562 sbatch slurm/train_seqencoder_12fold.slurm

Recipe: 5 bins at summit ±192·{−2..2} (256 bp windows), Activity = sqrt(H3K27ac_RPM · DNase_RPM), target log2(0.1 + Activity), L1KL loss, batch 256.

1c. Evaluate

python evaluate.py encoder --pred_dir results/seqencoder/K562

Report the pooled out-of-fold Pearson R (concatenate all 12 folds → one R). Targets:

H1 HepG2 K562 HUVEC NHEK GM12878
0.820 0.743 0.740 0.742 0.677 0.617

To skip training, download the pretrained encoders from JiecongLin/EPInformer-reproducible.

Clone this wiki locally