Skip to content
DunbrackLabPublic

About

IPSAE2: calculates ipSAE scores for protein/protein, protein/ligand, protein/nucleic-acid complexes, etc.

Resources

Stars

57 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

ipSAE2

Directional PAE-based confidence scoring for biomolecular complexes
Alpha release · v0.1.13

ipSAE2 computes directional interface predicted aligned error (ipSAE) scores from predicted coordinates and a PAE matrix. It supports protein, DNA, RNA, ligand and ion interactions. It can also import native pairwise ipTM confidence scores when the predictor provides them.

This is a new program and command-line interface. The original ipSAE implementation remains available separately. The new release is suitable for testing and research evaluation; it is not yet validated across every prediction format.

Install (Linux or macOS)

Python 3.10 or newer is required. You do not need AlphaFold, Boltz, PyTorch, a GPU or Conda. Use a separate virtual environment to avoid changing Gemmi or other libraries needed by your prediction programs.

git clone https://github.com/DunbrackLab/IPSAE2.git
cd IPSAE2
python3 -m venv .venv
source .venv/bin/activate
python -m pip install .
ipsae --version

Installed dependencies: NumPy, pandas, SciPy, Matplotlib, and Gemmi.

To activate ipSAE in a new terminal session,

if path_to_IPSAE2 is the IPSAE2 directory above

source path_to_IPSAE2/.venv/bin/activate

Run a directory of models (most common usage)

# Inspect auto-discovered coordinate/PAE/confidence matches first:
ipsae predictions/ --dry-run

# Process recursively, write individual TSVs beside each model,
# and create one combined file (with a single header):
ipsae predictions/ --output-file all_ipsae.tsv

# Only examine the given directory, not its subdirectories:
ipsae predictions/ --no-recursive --output-file all_ipsae.tsv

# Run the files in just the current directory, either with or without recursively searching the sub-folders
ipsae ./  --output-file all_ipsae.tsv
ipsae ./  --no-recursive --output-file all_ipsae.tsv

The combined TSV starts with a model column giving the relative path to each input structure. Ambiguous filename matches are skipped with a warning rather than incorrectly pairing a PAE matrix with a structure. For ColabFold results containing both relaxed_ and unrelaxed_ models for a given rank, model and seed, the unrelaxed structure is used; if only the relaxed model is present, it is used instead. ColabFold scores_*.json.gz files are read directly, without decompression.

Run one model

Provide coordinates (.pdb, .pdb.gz, .cif or .mmcif) and PAE (.json, .json.gz or .npz), with an optional native-confidence (.json or .npz) file in any order. It is assumed that the order of coordinates has not been changed, because the token order in the PAE matrix may be derived from it.

ipsae model.cif full_data.json summary_confidences.json
ipsae model.cif full_data.json
ipsae pae_model_0.npz model_0.cif confidence_model_0.json
# ColabFold 1.5: one JSON holds both PAE and native scalar ipTM
ipsae RAF1_KSR1_rank001_iptm0.50_ptm0.45_nrx_5_004.pdb.gz RAF1_KSR1_rank001_iptm0.50_ptm0.45_nrx_5_004.json
# Standard ColabFold 1.5: PDB.gz and scores JSON.gz, including job prefixes
ipsae job_unrelaxed_rank_001_alphafold2_multimer_v3_model_1_seed_000.pdb.gz job_scores_rank_001_alphafold2_multimer_v3_model_1_seed_000.json.gz

Options may appear before, after, or between input filenames:

ipsae model.cif full_data.json --output-file result.tsv
ipsae --output-file result.tsv model.cif full_data.json
ipsae model.cif --output-file result.tsv full_data.json

The default result is model_ipsae.tsv in the coordinate-file directory (the .pdb.gz extension is removed as a unit). Missing native ipTM data is reported as NA; it is not an error. A scalar overall ipTM is assigned to an individual molecular pair only when the structure has exactly two chains.

Generate PAE plots

PAE plots include lines separating molecular chains. By default, ions are omitted from the plots but remain included in ipSAE calculations. Ligand rows and columns can be enlarged by factors of 1–10 using --pae-ligand-scale (default 1) to make them visible.

ipsae predictions/ --write-pae-png

# Enlarge ligand rows and columns fourfold:
ipsae predictions/ --write-pae-png --pae-ligand-scale 4

# Include ions in the PAE plots:
ipsae predictions/ --write-pae-png --pae-include-ions

Score multiple chains as a single virtual molecule (--group)

Append grouped scores in addition to the normal chain-by-chain rows. Group members are joined by +; repeat the flag to declare disjoint groups:

# Antibody heavy and light chains against antigen A in a PDB file:
ipsae predicted.pdb pae.json --group H+L

# The same chains in mmCIF using label_asym_id A (antigen), B (heavy), C (light):
ipsae predicted.cif pae.json --group B+C

# Two groups, plus any ungrouped components in the structure:
ipsae model.cif pae.json --group A+B --group C+D

# Protein–double-stranded DNA: A = protein; B and C = the two DNA strands:
ipsae predicted_protein_dna.cif pae.json --group B+C

For PDB, chain identifiers come from the one-character PDB chain field (typically the author IDs). For mmCIF, ipSAE2 reads _atom_site.label_asym_id, not _atom_site.auth_asym_id. For example, PDB entry 2J88 uses author IDs A/H/L for antigen/heavy/light but label IDs A/B/C. The flags must refer to the identifiers in the coordinate file being scored. A prediction's chain IDs may differ from those in a reference crystal structure.

--group H+L adds the H+L versus other ungrouped molecules, but leaves the original H/A and L/A scores untouched. With multiple groups, only virtual-group-versus-virtual-group and virtual-group-versus-ungrouped rows are added (not groups versus their own members). Groups cannot overlap. Groups can include more than two molecules or mixed molecular types (e.g., protein plus ligand or ligand plus ion). Existing ≤5 Å contact filtering and --all-pairs apply to group pairs as well.

A virtual group collects the original PAE tokens; it does not combine or average the separate pairwise scores or define a new reference frame. ipsae12 aligns on chn1, scores chn2; ipsae21 aligns on chn2, scores chn1. For grouped rows, ipsae is the maximum of the two valid directions, regardless of group composition; ordinary pairwise scoring retains its original same-type/mixed-type convention.

When a scored group contains a protein, all group units with PAE ≤10 Å (default) may contribute to the score, but only qualifying protein residues set the protein length used in $d_0$. With nucleic acids but no protein, the PAE cutoff applies and $d_0$ is fixed at 2 Å. With only ligands and ions, no PAE cutoff applies and $d_0$ is fixed at 2 Å. Modified polymer residues count once even if tokenized by atoms. For mixed groups n0_12/21 reports all selected scoring units; protein-only units are used to calculate d0_12/21.

New group rows have NA in native ipTM columns (the predictors do not supply native confidence scores for these virtual pairs). Optional --write-by-token, --write-interface, and --write-pymol output supports group rows; PyMOL selections refer to the individual member chains, not a literal H+L chain. The generated PyMOL script sets cif_use_auth, off for mmCIF coordinates so its chain and residue selections match label_asym_id/label_seq_id. Alignment tokens for a virtual group are prefixed with their original chain identifier (for example, H/VAL:147:CA) to distinguish residues from different members; ordinary pairwise alignment-token labels do not change. This feature requires a predicted PAE matrix; an experimental PDB structure alone does not contain PAE and cannot be scored.

Score polymer regions and named groups (--region, --group)

Define additional objects without truncating the model or rerunning prediction:

# AKT1 dimer: two PH and two kinase domains
ipsae predictions/ --region A,B:1-122=PH A,B:141-480=Kinase

# A discontinuous region (one independent object per chain)
ipsae predictions/ --region A,B:122-150+180-200=Kinase

# Three separate helices and their union
ipsae predictions/ --region A:20-40=H1 A:80-100=H2 A:150-170=H3 \
    --group H1+H2+H3=HelicalDomain

# A union of two domains across chains
ipsae predictions/ --region A,B:1-122=PH A,B:141-480=Kinase \
    --group A:Kinase+B:Kinase=KinaseDimer --all-pairs

# Illustrative CDR positions (adjust to match each actual sequence)
ipsae predictions/ --region B:26-35+50-65+95-110=HeavyCDRs \
    C:24-34+50-56+89-97=LightCDRs \
    --group HeavyCDRs+LightCDRs=AllCDRs B+C=Antibody

Syntax: --region CHAINS:RANGES[=NAME]; --group OBJECT+OBJECT[+OBJECT...][=NAME]. Commas select chains independently; + joins ranges or objects; = assigns a name. Ranges are inclusive positive integer residue identifiers in the input coordinates (mmCIF label_seq_id, falling back to auth_seq_id when absent; PDB residue numbering). A single position such as A:23=Site is accepted. All specified positions must exist in every selected chain; missing positions, nonpolymer selections and insertion-coded positions in a selected range are rejected. Region selection uses all tokens belonging to each residue, including atom-tokenized modified residues. RNA and DNA use the same selection syntax.

Names may contain letters, digits, underscores and dots. Names are optional; unnamed regions use their range string as mol. Named regions can be referred to by CHAIN:NAME or by a unique bare name. Give discontinuous regions and nested groups explicit names before referencing them. Group definitions can refer to earlier named groups, as well as full-length chains and regions. All regions are resolved before groups, regardless of flag order. Both options can be repeated, or supplied with multiple consecutive specifications; placing all input files first is recommended. Duplicate output identities (chn, mol) and ambiguous references are rejected. Names conflicting with an original chain ID are rejected.

Pair enumeration: original full-chain scores are always retained. When regions or named groups are requested, all additional pairs with disjoint token sets are eligible, including two regions of the same chain. Groups are unions: shared tokens within a group count once; overlapping objects are never scored against one another. A region cannot be compared with its own full-length parent, but can be compared with a disjoint region of that chain. The existing contact filter applies to the actual selected heavy atoms; --all-pairs includes pairs without spatial contact. Unselected residues are not made into separate objects. Intrachain scores describe confidence in relative placement, not necessarily direct binding; covalent connectivity can contribute.

For backward compatibility, calls using only unnamed whole-chain --group options retain the disjoint grouping and pair enumeration described above. With --region or named groups, the more general all-disjoint-pair rule applies instead, so additional group-versus-chain rows can occur. Pure region pairs use the original same-type/mixed-type scoring rule; any group pair uses the maximum valid directional score. Protein d0 settings, including --protein-fixed-d0, apply to region and group scores as usual. Native ipTM is NA for all newly defined pairs.

The main TSV retains its existing columns: region names are in mol1/mol2, and original chain IDs in chn1/chn2. Same-chain groups use the original chain ID; multichain groups join their distinct original chain IDs with +. The identity of an object is the pair (chn, mol), not chn alone. Extended runs write *_objects.tsv with selections, token IDs, and counts of tokens and distinct scoring units. In extended runs, --write-by-token adds mol1 and mol2 to its diagnostic TSV, --write-interface adds mol and partner_mol, and PyMOL selections use distinct names per pair, direction and member chain. --write-pae-png and --write-pae-df are unchanged (the latter still exports only original interchain PAE entries).

Real-data examples

Change in v0.1.13: The default minimum protein (d_0) has been increased from 1.0 to 2.0 Å to avoid excessively small scaling parameters when scoring short protein regions, including antibody CDRs, peptides, and functional loops. To reproduce scores calculated using the previous default, specify --protein-min-d0 1.0. The default scaling for nucleic acids, ligands, and ions is unchanged.

BRAF homodimer (full-length AF2 predictions). Score the BRAF-specific region (BRS), RAS-binding domain (RBD), C1 domain and kinase domain separately, and combine selected domains into named objects:

ipsae ~/braf_dimer \
    --region A,B:42-106=BRS A,B:154-229=RBD \
             A,B:230-285=C1 A,B:453-716=Kinase \
    --group A:RBD+A:C1=RBDC1_A B:RBD+B:C1=RBDC1_B \
            A:Kinase+B:Kinase=KinaseDimer \
    --all-pairs --output-file braf_domains.tsv

In one tested model, the full-length pair had native ipTM 0.350 and ipSAE 0.679, while the kinase–kinase and BRS–BRS pairs had ipSAE 0.674 and 0.248, respectively. The selected regulatory regions had zero ipSAE against the combined kinase domains in that model. The regional scores help locate the source of the full-length confidence; they do not independently establish that the interfaces are structurally or biologically correct.

Nanobody–antigen complex (8Q7O, AF3 models from the Fromm et al. antibody–antigen benchmark). In these prediction files, chain A is the 124-residue antigen and chain B is the 119-residue llama nanobody. These chain IDs differ from the experimental PDB entry 8Q7O, in which chains A and B are nanobodies and chains C and D are antigens. Residue selections below refer to the prediction files, not the experimental PDB numbering.

ipsae 8q7ocomplex/ --output-file 8q7o.tsv \
    --region B:23-35=H1 B:50-58=H2 B:97-108=H3 \
    --group H1+H2+H3=CDRs

The same CDR union can be specified directly as a discontinuous region:

ipsae 8q7ocomplex/ --output-file 8q7o_discontinuous.tsv \
    --region B:23-35=H1 B:50-58=H2 B:97-108=H3 \
             B:23-35+50-58+97-108=CDRs

These two definitions gave identical numerical scores across 200 AF3 models when the directions were matched by molecular identity. With the default length-dependent protein d0 and a minimum of 2 Å (v0.1.13), the median antigen-to-CDRs and CDRs-to-antigen ipSAE scores were 0.569 and 0.670, respectively. With the previous minimum of 1 Å, the corresponding scores were 0.435 and 0.670. To compare regions using the same protein scaling parameter instead, add --protein-fixed-d0 2.0:

ipsae 8q7ocomplex/ --output-file 8q7o_discontinuous_d0_2.tsv \
    --region B:23-35=H1 B:50-58=H2 B:97-108=H3 \
             B:23-35+50-58+97-108=CDRs \
    --protein-fixed-d0 2.0

The corresponding median directional scores were 0.569 and 0.379 with this fixed scaling parameter. These examples illustrate the effect of the scored region's size on the default scaling; they do not establish an optimal d0 or a classification threshold for antibody interfaces. Use chn1/mol1 and chn2/mol2 to identify the direction in the TSV, because row orientation may change when a group is replaced by a directly defined region.

Try the bundled example

ipsae tests/data/model.pdb tests/data/pae.json tests/data/summary.json \
  --output example_ipsae.tsv
cat example_ipsae.tsv

The synthetic example produces three molecular-pair rows. For the full automated tests:

python -m pip install pytest
python -m pytest -q

How scoring works

For a pair of molecules, ipsae12 aligns on chn1 and scores chn2; ipsae21 aligns on chn2 and scores chn1. The final ipsae is:

  • For same-type pairs (protein–protein, nucleic acid–nucleic acid, ligand–ligand), the larger directional value.
  • For different-type pairs, the direction aligning on the more complex molecule, ordered protein > nucleic acid > ligand > ion.

Scored protein and nucleic-acid units use a PAE cutoff of ≤10 Å by default; ligands and ions have no PAE cutoff. Protein $d_0$ follows the length-dependent TM-style formula with a 2 Å minimum (previously 1 Å), and nucleic acids, ligands and ions use fixed $d_0=2$ Å. Use --protein-fixed-d0 VALUE to override the protein scaling parameter (in Å), including when scoring regions or groups. This is distinct from --fixed-d0, which controls the fixed scaling for nonprotein units. By default, only molecule pairs having a heavy-atom contact ≤5 Å are reported, but the contact filter does not limit which PAE-selected units contribute to ipSAE. Use --all-pairs if needed. Ion–ion scores are undefined and not reported.

The TSV puts the most useful information first:

chn1 chn2 type1 type2 mol1 mol2 iptm ipsae ipsae12 ipsae21
ipsae_source align_token12 align_token21 iPAE12 iPAE21 ...

Molecule labels report the modeled polymer length, for example AA_403, RNA_6, DNA_10, or NUC_109 (one chain containing both DNA and RNA). Ligands and ions retain labels such as ATP and MG.

See full scoring conventions, all columns, options and format details. Run ipsae --help for the complete list of options, including optional PAE plots and PyMOL selections.

Validation and limitations

  • AlphaFold3 and Boltz-2: directional scores have been numerically compared against the previous implementation for AURKA–TPX2–ATP–Mg examples; all six contacting pairs agreed to six decimal places in each case. Batch processing has been exercised on 1,600 seeded AURKA models per predictor.
  • Nucleic acids: initial AF3 DNA and Boltz-2 RNA tests have been performed. Wider DNA/RNA benchmark regression is still needed.
  • ColabFold 1.5: PDB or compressed .pdb.gz coordinates and the matching single JSON with pae and scalar iptm have been tested against a real RAF1–KSR1 heterodimer (648 and 923 residues). For two-chain complexes, scalar iptm populates the pair's iptm column; directional native ipTM columns are NA.
  • Region and group scoring (v0.1.12): exercised on full-length AF2 AKT1, BTK and BRAF models, including intrachain and interchain pairs, overlapping-object exclusion and nested groups. In 200 AF3 models of the 8Q7O benchmark complex, direct discontinuous-region definitions and group definitions gave equivalent scores; fixed protein d0 was also tested.
  • OpenFold3: batch matching includes _confidences_aggregated JSON files.
  • Other predictors: readers are included for additional formats, but remain experimental pending validation on real output files.
  • Platforms: installed and run on Linux and macOS; Windows has not been tested. The automated test suite uses synthetic examples.
  • Models need PAE matrices with a correctly inferred or specified token order; ambiguous mappings are rejected. Different predictors may report native ipTM differently, and some directions can be undefined (NA).

This is an alpha research release. Please report reproducible problems with predictor, version, command, file types and a minimal test case in GitHub Issues. Do not assume that two different scoring conventions are numerically interchangeable.

Citation and license

This package is presented in a Preprint on biorxiv.

This package extends the original ipSAE work: Dunbrack laboratory — original ipSAE preprint.

Licensed under the MIT License; see LICENSE.

About

IPSAE2: calculates ipSAE scores for protein/protein, protein/ligand, protein/nucleic-acid complexes, etc.

Resources

Stars

57 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages