molsysmt.build.get_missing_residues#
- molsysmt.build.get_missing_residues(molecular_system, sequence=None, selection='all', syntax='MolSysMT', engine='MolSysMT')[source]#
Identify residues that are missing from a molecular system relative to a reference sequence.
This function compares the residues present in the molecular system against a reference sequence and returns a mapping of insertion positions to the names of the residues that are absent.
- Parameters:
molecular_system (molecular system) – Molecular system in any of the supported forms.
sequence (dict or None, default None) –
Reference sequence as
{chain_id: [res_name_1, res_name_2, ...]}, where residue names are 3-letter codes. WhenNone(default), the function attempts to extract the reference sequence automatically:file:pdb — from SEQRES records.
file:bcif / file:bcif_gz — from the
_entity_poly_seqmmCIF table.string:pdb_id — downloads the binary CIF and uses the same path.
All other forms — emits a
UserWarningand returns{}.
selection (str, list, tuple, or numpy.ndarray, default 'all') – Atom selection used to restrict the search to a subset of the system.
syntax (str, default 'MolSysMT') – Syntax used to interpret the
selectionstring.engine ({'MolSysMT', 'PDBFixer'}, default 'MolSysMT') –
Backend used to detect missing residues.
'MolSysMT': native implementation usingSequenceMatcherto align the structural sequence against the reference. Requires a reference sequence (fromsequenceor auto-detected).'PDBFixer': delegates topdbfixer.PDBFixer.findMissingResidues. Ignores thesequenceargument.
- Returns:
Dictionary mapping
(chain_index, insertion_position)tuples to lists of residue names (str).chain_indexis the 0-based index of the chain in the (sub)system;insertion_positionis the 0-based index within that chain’s structural sequence before which the missing residues should be inserted. For insertions after the last residue of a chain theinsertion_positionequals the number of residues in that chain.- Return type:
dict
- Raises:
NotImplementedMethodError – Raised if the requested
engineis not supported.
Notes
engine=’MolSysMT’ limitations: Only amino-acid and nucleotide chains with a detectable reference sequence are analysed. Non-standard residues in the reference that are absent from the structure will be reported as missing; non-standard residues present in the structure but absent from the reference will be silently ignored.
Post-1.0 roadmap: When
sequence=Noneand the molecular system has no embedded sequence information, a future version will optionally query UniProt or the PDB REST API using the entity name or PDB ID.Added in version 1.0.0.