pestifer.objs.ter module

A class for handling TER records in PDB files. Why is this necessary? TER records are used to indicate ‘breaks’ in the list of ATOM records in a PDB file to signify physical discontinuity of the amino acid chain(s). The problem we have to solve is that sometimes a TER record gets a unique atom serial number, even though they are not atoms. So in a list of atoms the sequence of serial numbers can be discontinuous. This is not a problem per se, but when VMD reads in a PDB file it ignores both TER records and the explicit atom serial numbers. Pidibble by default does not, so to make the atom records VMD-compliant, we have to adjust atom serial numbers, and to do that we have to know where any non-empty TER records are.

class pestifer.objs.ter.Ter(*args, serial: int | None = None, resname: str | None = None, chainID: str | None = None, resid: ResID | None = None)[source]

Bases: BaseObj

A class for handing TER records in PDB files

chainID: str | None
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.

resid: ResID | None
resname: str | None
serial: int | None
class pestifer.objs.ter.TerList(initlist: Iterable[T] = ())[source]

Bases: BaseObjList[Ter]

describe()[source]

Abstract method to describe the contents of the BaseObjList. Subclasses should implement this method to provide a meaningful description.

classmethod from_pdb(parsed: PDBRecordDict, model_id=None) TerList[source]

Create a TerList from parsed PDB data.

Parameters:
  • parsed (PDBRecordDict) – A dictionary containing parsed PDB records.

  • model_id (int, optional) – The model ID to filter the TER records by. If None, all models are included.

Returns:

A new TerList instance containing Ter objects created from the PDB data.

Return type:

TerList

has_serials()[source]