pestifer.objs.resid module¶
- class pestifer.objs.resid.ResID(*args, resseqnum: int, insertion: str | None = None)[source]¶
Bases:
BaseObjA class for handling residue numbers and insertion codes. This class is used to represent a residue number and an optional insertion code. It provides methods to split and join residue numbers and insertion codes.
- increment(by_seqnum: bool = False) ResID[source]¶
Increments the insertion code of this ResID object by one. If there is no insertion code, it sets it to ‘A’.
- static join_ri(resseqnum: int, insertion: str | None = None) str[source]¶
Joins a residue sequence number and an insertion code into a single string.
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': False}¶
Configuration for
pydantic.BaseModel.
- model_post_init(context: Any, /) None¶
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- property pdbresid: str¶
Returns the residue number and insertion code in a format suitable for PDB files. If there is no insertion code, it returns just the residue number as a string.
- property resid: str | int¶
Returns the residue number and insertion code as a string, or if there is no insertion code, returns just the residue number as an integer. This is equivalent to the string representation of the ResID object.
- static split_ri(ri) tuple[int, str | None][source]¶
A simple utility function for splitting the integer resid and 1-byte insertion code out of a string resid-insertion code concatenation
- Parameters:
ri (str) – the string representation of a residue number, e.g.,
123Aor123- Returns:
tuple[int, str | None]
- Return type:
the integer resid and the 1-byte insertion code or None if none
- class pestifer.objs.resid.ResIDList(*args, **kwargs)[source]¶
Bases:
BaseObjList[ResID]A list of ResID objects. This class is used to handle a list of residue numbers and insertion codes. It inherits from BaseObjList and provides methods to describe the list.
- describe() str[source]¶
Describe the ResIDList.
- Returns:
A string description of the ResIDList, including the number of residues.
- Return type:
- static ri_range(val, split_chars: tuple[str] = ('-', '#')) tuple[ResID][source]¶
Splits a string representation of a range of residue numbers into a list of residue numbers. The string can contain multiple ranges separated by characters in
split_chars. The ranges can be specified as a single residue number, a range of residue numbers (e.g.,123-456), or a range of residue numbers with insertion codes (e.g.,123A-456B).