PAC-MAPS: Classifying Protein Architecture from Contact Maps

November 4, 2026

Protein Architecture Classification from contact MAPS

PAC-MAPS is a CNN that predicts a protein domain’s CATH architecture (e.g. β-barrel, 3-layer αβα sandwich) from its Cβ contact map alone. Every test domain comes from a superfamily the model never saw in training, so the score measures generalization to new superfamilies, not recognition of close homologs.

Across three independent superfamily splits, PAC-MAPS reaches 74 ± 4% balanced accuracy (~10× chance over 14 classes), matching Foldseek nearest-neighbor structural search (75 ± 5%) while using only a 2D contact representation.

Twelve RGB contact maps from held-out test superfamilies, each labelled with its true and predicted CATH architecture. The top two rows are confident correct predictions, the bottom row the most confident errors. Predictions on held-out test superfamilies (split seed 2002). Top two rows: the most confident correct prediction for eight architectures. Bottom row: the most confident distinct errors.

The code, splits and figures are on GitHub, and the full training logs are on Weights & Biases.

Approach #

Leakage-aware splits. Whole CATH superfamilies are held out for validation and test, so no close homolog of a test domain appears in training. Random domain-level splits leak homologs across the split and inflate accuracy, which is one of the most common pitfalls in structural ML.

One pixel = one residue. Each domain becomes an L×L image, zero-padded to 400×400 and never resized, so the pixel scale of helices, strands and their packing stays physically meaningful across domains of different lengths.

Structure-aware input channels.

ChannelEncodes
RCβ–Cβ distance, inverted and clipped at 30 Å (bright = close)
Gresidue pairs where both residues are in helices
Bresidue pairs where both residues are in strands

Secondary structure is assigned with biotite’s P-SEA (annotate_sse). In the images, helix–helix blocks appear green (yellow where the helices pack closely) and strand–strand blocks appear blue (purple where the strands pair).

Model. A dilated residual CNN with squeeze-and-excitation blocks and a sequence-separation coordinate channel (log |i − j|, in residues), trained with class-balanced sampling and one geometrically valid augmentation: N↔C sequence reversal (flipping the map about its anti-diagonal).

Results #

Stage 1: architecture selection #

Early pipeline: 224 px resized binary contact maps on a preliminary split. Numbers are comparable within this table only.

ModelBest val. bal. acc.
ResNet34 (fine-tuned)0.60
Vanilla CNN0.72
Dilated residual CNN + SE0.77
+ CoordConv (sequence separation)0.82

Stage 2: final pipeline #

Superfamily-held-out splits, 400 px zero-padding, Cβ distance ≤ 30 Å + SSE channels, dilated CoordConv CNN, 18 epochs, one model per split.

Split seedVal. bal. acc.Test acc.Test bal. acc.
420.6960.670.69
160.7010.820.77
20020.6860.770.75
Mean ± SD0.694 ± 0.0080.75 ± 0.080.74 ± 0.04

Stage 3: benchmark against Foldseek #

Same three test sets. Foldseek searches each seed’s test domains against that seed’s training domains only.

MethodInputTest acc.Test bal. acc.
PAC-MAPS2D Cβ distance map + SSE channels0.75 ± 0.080.74 ± 0.04
Foldseek, top-1 nearest neighborfull 3D structure0.80 ± 0.040.73 ± 0.05
Foldseek, top-5 majority votefull 3D structure0.81 ± 0.040.75 ± 0.05

PAC-MAPS matches Foldseek on balanced accuracy while using only a 2D contact representation. Foldseek achieves higher overall accuracy, driven by better performance on the largest architectures. The two methods distribute their errors differently: PAC-MAPS’s accuracy and balanced accuracy are nearly equal, while Foldseek is stronger on the large classes that dominate plain accuracy.

SD is the sample standard deviation across the three seeds. Foldseek was run with easy-search in exhaustive mode (E ≤ 10); top-5 ties are broken by summed bit score, and the ~2% of queries with no hit are counted as errors. Chance balanced accuracy ≈ 7%. Small classes such as 3.50 may be absent from some test sets, so per-seed balanced accuracy can cover slightly different class sets.

What the errors show #

The model’s mistakes fall between architectures that are geometrically close, and they point at specific information the input lacks:

Normalized confusion matrix for the seed 2002 test set across 14 CATH architectures. Most off-diagonal mass sits among the helical classes 1.10, 1.20 and 6.10, while 2.130, 3.20, 2.60 and 3.40 are near the diagonal. Normalized test-set confusion matrix for split seed 2002 (rows are true architectures, with the number of test domains in each). Matrices for seeds 42 and 16 are in the repo.

Limitations #

Future work #

Reproducing #

Everything runs from one notebook, PAC_MAPS.ipynb: data → contact maps → splits → training → evaluation → Foldseek benchmark. The exact superfamily splits for seeds 42, 16 and 2002 are in splits/.

  1. Open PAC_MAPS.ipynb in Google Colab or Kaggle with a GPU runtime.
  2. Add your Weights & Biases API key as a secret named WANDB_API_KEY, and set WANDB_ENTITY / WANDB_PROJECT in the config cell.
  3. Run the notebook top to bottom. It downloads the CATH S40 non-redundant domain set, generates the contact maps, and trains on the splits in splits/.
  4. The Foldseek benchmark cells at the end run on CPU (or GPU with the Foldseek GPU build).

Training one model takes ~1.5 hours on a single T4 (18 epochs).

Stack: PyTorch, fastai, biotite, scikit-learn, Foldseek, Weights & Biases.

←
Previous Post How I Found 71 Natural Alternatives to a $200 Million Drug