moleculekit.tools.termini module#

Classify each protein chain terminus as a real biological end or a cut.

The builders cap every protein terminus by default, which is right for a construct boundary or an unfilled break and wrong for a mature protein’s own terminus - a real terminus is zwitterionic, and neutralising it invents chemistry. Telling the two apart needs evidence from outside the coordinate file, and this module is where that evidence is combined:

  • a terminal gap proves truncation on its own - the reference extends past the last modelled residue, whatever the reference is;

  • otherwise the terminus is flush with the reference, and it is a real end only if it maps onto a UniProt mature-chain boundary (via the SIFTS entity mapping or a precursor trim offset) - but “flush” is only readable when the chain was actually analysed for gaps, so a chain gap detection skipped gets unknown at both ends rather than a boundary comparison against an assumed alignment.

No network I/O happens here: the caller supplies the mature spans.

moleculekit.tools.termini.CAP_VOCABULARY = ('none', 'ACE', 'NME', 'NHE')#

the subset of moleculekit.residues.CAP_RESIDUE_NAMES a force field ships a template for (htmd carries ACE, NME and NHE only), plus none to leave the terminus charged on AMBER’s N*/C* variants. Deliberately narrower than the recognised set: NMA and NH2 are real cap resnames that can appear in a structure but cannot be built onto one.

Type:

The caps that can be requested

moleculekit.tools.termini.detectTermini(mol, sequences, gaps, chainmeta, mature_spans, skipped_chains=())#

Classify both ends of every protein chain as natural, truncated or unknown.

Parameters:
  • mol (Molecule) – The structure the caps will be applied to. Must be the final, gap-filled structure: a terminus that exists only because residues are missing is not the terminus the build will have.

  • sequences (dict) – {chain: reference_sequence} as used for gap detection.

  • gaps (list of dict) – detectSequenceGaps output for the same structure and references.

  • chainmeta (dict) – {chain: {"source", "accession", "uniprot_refs", "trim_offset"}} - the survey’s per-chain reference metadata. uniprot_refs is every UniProt row with its SIFTS regions; accession is the primary (most-covered) one, used only as a fallback label.

  • mature_spans (dict) – {accession: uniprotMatureChains(accession)} for every accession in uniprot_refs, fetched by the caller.

  • skipped_chains (iterable of str) – Chains whose gap analysis was skipped - detectSequenceGaps’ second return value. Flushness is read from the absence of a terminal gap, so a chain with no gap analysis has no flushness evidence at all and its termini are reported unknown rather than measured against the reference’s ends.

Returns:

termini – Two entries per protein chain (end "N" then "C"), each with chain, end, resid, insertion, resname, sel, classification (natural / truncated / unknown), evidence (uniprot_mature_chain / terminal_gap / no_gap_analysis / flush_no_evidence), accession, matched_feature, cappable and proposed_cap. sel is a verified-unique atom selection for the residue, and is None when the terminus cannot be capped or cannot be selected unambiguously.

Return type:

list of dict