molsysmt.element.group.amino_acid.get_1_letter_code_from_name#
- molsysmt.element.group.amino_acid.get_1_letter_code_from_name(name)[source]#
Return the one-letter IUPAC code for an amino acid given its three-letter or variant name.
The function first maps the input name to a canonical three-letter code via
name_to_type, then converts that code to the standard single-letter representation using the IUPAC amino-acid alphabet.- Parameters:
name (str) – Residue name as stored in the topology (e.g.
'ALA','HID','NALA'). Variant names (protonation states, N/C-terminal prefixes) are resolved to their canonical type before the lookup.- Returns:
Single IUPAC letter code for the amino acid (e.g.
'A'for alanine,'R'for arginine). Ambiguity codes ('B','Z','X','J') are returned for the corresponding degenerate residue types.- Return type:
str
- Raises:
KeyError – Raised if
nameis not present in thename_to_typemapping or if the resolved canonical name is not present in theaa3_to_aa1table.
Notes
The complete mapping from three-letter codes to one-letter codes follows the IUPAC-IUB nomenclature and includes the 20 standard amino acids as well as selenocysteine (
'SEC'→'U'), pyrrolysine ('PYL'→'O'), and the standard ambiguity codes.Added in version 1.0.0.