neurosnap.algos.ipsae module#
- neurosnap.algos.ipsae.calculate_ipSAE(structure, plddt, pae_matrix, *, input_format='auto', pae_cutoff=10.0, dist_cutoff=10.0, pDockQ_cutoff=8.0, return_pml=False)[source]#
Compute ipSAE/ipTM and related interface scores for all chain pairs.
Uses a Neurosnap structure container to derive an ordered analysis list and evaluates multiple interface confidence metrics between every ordered pair of chains: ipSAE (three d0 variants), inter-chain ipTM (d0chn), pDockQ, pDockQ2, and LIS. Symmetric summaries include both per-direction asymmetry and pairwise maxima and minima.
Alignment contract#
The function first derives a residue-level order from the structure (standard amino acids or nucleotides only; one representative atom per residue). If the payload shapes do not match, it falls back to token-expanded orders where non-standard residues contribute one or more heavy-atom sites.
plddtwith shape(N,)andpae_matrixwith shape(N, N)must match whichever order is selected.input_formatcan be used to select a specific alignment strategy for AF3-like payloads.- type structure:
- param structure:
Single-model Neurosnap
Structurecontaining the complex.- type plddt:
- param plddt:
Per-site pLDDT aligned to the selected analysis order and normalized to
[0, 100].- type pae_matrix:
- param pae_matrix:
Site-site PAE matrix in angstroms aligned to the same order.
- type input_format:
- param input_format:
Payload layout selector. Supported values are
"auto","boltz2","chai1", and"protenix"."auto"preserves the historical shape-based fallback behavior.- type pae_cutoff:
- param pae_cutoff:
PAE threshold in angstroms for ipSAE and counting valid pairs.
- type dist_cutoff:
- param dist_cutoff:
Distance cutoff in angstroms for interface-restricted counts.
- type pDockQ_cutoff:
- param pDockQ_cutoff:
Distance cutoff in angstroms used by pDockQ and pDockQ2 neighbor tests.
- type return_pml:
- param return_pml:
If
True, include a PyMOL coloring alias script underpml.- returns:
Dictionary containing:
by_residuePer-direction arrays for each chain pair, including
iptm_d0chn,ipsae_d0chn,ipsae_d0dom,ipsae_d0res,n0res_byres, andd0res_byres.asymBest single-site values per direction and the residue labels that achieve them.
maxSymmetric maxima for each metric across both directions.
minSymmetric minima for each metric across both directions.
countsSupporting count and d0 summaries for chain, domain, and residue granularities.
scoresAuxiliary interface-level scores including
pDockQ,pDockQ2, andLIS.paramsEffective cutoff parameters used for the calculation.
pmlOptional PyMOL alias script string when
return_pmlisTrue.residue_orderMetadata describing the selected analysis order, with
names,chains, andnumbersarrays.
- rtype:
dict
- raises ValueError:
If no usable analysis sites are found, or if
plddtandpae_matrixdo not match any supported alignment order.
Notes
Standard residues use representative atoms. Proteins prefer C-beta (glycine uses C-alpha, and C-alpha is also the fallback if C-beta is missing). Nucleic acids prefer
C3'orC3*, thenC1'orC1*, thenP.Non-standard residues are handled in multiple modes. Residue-level mode removes them when the payload length matches the raw polymer residue count. Token-expanded fallback keeps one representative site per standard residue plus heavy atoms for non-standard residues.
boltz2uses one token per non-hetero residue and expands hetero residues to heavy atoms.chai1uses representative sites for standard residues, expands modified residues inside protein chains to heavy atoms, and gives standalone non-standard chains both a residue-level site and heavy-atom sites.protenixuses the hetero-token-expanded site order for PAE and aggregates atom-level pLDDT onto the selected sites.Chain-type classification sets the minimum d0 value to
2.0for pairs containing nucleic acids and1.0otherwise, and still applies the standard length-based d0 formula. pDockQ neighbors usepDockQ_cutoffon representative-atom distances. LIS averages(12 - PAE) / 12over inter-chain pairs withPAE <= 12angstroms.
- neurosnap.algos.ipsae.extract_interchain_metrics(res)[source]#
Extracts major inter-chain confidence metrics from a calculate_ipSAE() result.
This helper flattens the most relevant directional interface metrics into a clean, consistent structure suitable for export or downstream analysis. It includes the primary ipSAE/ipTM scores and auxiliary interface predictors like pDockQ, pDockQ2, and LIS.
- Parameters:
res (
dict) – Output dictionary fromcalculate_ipSAE(). It must containasymandscoresentries.- Returns:
Nested dictionary keyed by metric name. Returned metrics are
iptm_d0chn,ipsae_d0chn,ipsae_d0dom,ipsae_d0res,pDockQ,pDockQ2, andLIS. Each metric mapschain1 -> chain2 -> float.- Return type:
- neurosnap.algos.ipsae.extract_minimum_interchain_metrics(res)[source]#
Extracts minimum inter-chain confidence metrics from a calculate_ipSAE() result.
This helper returns the minimum values of the ipSAE and ipTM metric families representing the worst-case interface confidence between chain pairs.
- Parameters:
res (
dict) – Output dictionary fromcalculate_ipSAE(). It must contain theminentry.- Returns:
Nested dictionary containing
iptm_d0chn,ipsae_d0chn,ipsae_d0dom, andipsae_d0resaschain1 -> chain2 -> floatmappings.- Return type: