schrodinger.protein.residue_identifier module¶
Canonical representation of a residue identifier.
- class schrodinger.protein.residue_identifier.FormatCode¶
Bases:
StrEnum%-codes used in residue identifier format strings.
- CHAIN = 'c'¶
- RES_CODE_LONG = 'R'¶
- RES_CODE_SHORT = 'r'¶
- INS_CODE = 'i'¶
- NUM = 'n'¶
- class schrodinger.protein.residue_identifier.CaseStyle¶
Bases:
StrEnumCase transformation applied to string fields during formatting.
- ORIGINAL = 'original'¶
- UPPER = 'upper'¶
- LOWER = 'lower'¶
- TITLE = 'title'¶
- schrodinger.protein.residue_identifier.COLON_SPACE_FMT = '%c:%R %n%i'¶
"A:ALA 123"or"A:ALA 123B"
- schrodinger.protein.residue_identifier.COLON_UNDERSCORE_FMT = '%c:%R_%n%i'¶
"A:ALA_123"or"A:ALA_123B"
- schrodinger.protein.residue_identifier.COLON_NUM_FMT = '%c:%n%i'¶
"A:123"or"A:123B"
- schrodinger.protein.residue_identifier.DISPLAY_FMT = '%R%n%i'¶
"ALA123"or"ALA123B"
- class schrodinger.protein.residue_identifier.ResidueIdentifier(num: int, res_code: str | None = None, chain: str | None = None, ins_code: str | None = None)¶
Bases:
objectCanonical representation of a residue identifier.
Supports parsing from and formatting to multiple string representations using a
strftime-style format language with %-codes.Format codes:
%c chain name %R multi-letter residue code (e.g. ALA, GLY) %r single-letter residue code (e.g. A, G) -- derived from res_code %n residue number (possibly negative) %i insertion code (single alpha char; placeholder if missing) %% literal '%'
Common format strings are provided as module-level constants:
COLON_SPACE_FMT,COLON_UNDERSCORE_FMT,COLON_NUM_FMT,DISPLAY_FMT.- num: int¶
- res_code: str | None = None¶
- chain: str | None = None¶
- ins_code: str | None = None¶
- __init__(num: int, res_code: str | None = None, chain: str | None = None, ins_code: str | None = None) None¶
- format(fmt: str, *, ins_placeholder: str = '', case_style: CaseStyle = CaseStyle.ORIGINAL) str¶
Format this identifier using a %-code format string.
- Parameters:
fmt – Format string with %-codes.
ins_placeholder – String to substitute when
ins_codeisNone.case_style – Case transformation applied to all string field values.
- Raises:
ValueError – If a required field is
Noneor if%ris used with an unrecognisedres_code.- Returns:
Formatted string.
- classmethod parse(s: str, fmt: str, *, ins_placeholder: str = '') ResidueIdentifier¶
Parse a string using a %-code format string.
- Parameters:
s – The string to parse.
fmt – Format string with %-codes.
ins_placeholder – Placeholder value that should be interpreted as
Nonefor the insertion code field.
- Raises:
ValueError – On format mismatch, adjacency violation, or unknown single-letter code for
%r.- Returns:
Parsed
ResidueIdentifier.
- classmethod from_residue(residue: _Residue) ResidueIdentifier¶
Construct from a
schrodinger.structure._Residue.- Parameters:
residue – A structure residue object.
- Returns:
New
ResidueIdentifier.