Bio.PDB.ic_rebuild module

Convert XYZ Structure to internal coordinates and back, test result.

Bio.PDB.ic_rebuild.structure_rebuild_test(entity, verbose: bool = False, quick: bool = False) Dict

Test rebuild PDB structure from internal coordinates.

Generates internal coordinates for entity and writes to a .pic file in memory, then generates XYZ coordinates from the .pic file and compares the resulting entity against the original.

See IC_Residue.pic_accuracy to vary numeric accuracy of the intermediate .pic file if the only issue is small differences in coordinates.

Note that with default settings, deuterated initial structures will fail the comparison, as will structures loaded with alternate IC_Residue.accept_atoms settings. Use quick=True and/or variations on AtomKey.d2h and IC_Residue.accept_atoms settings.

Parameters
  • entity (Entity) – Biopython Structure, Model or Chain. Structure to test

  • verbose (bool) – default False. print extra messages

  • quick (bool) – default False. only check the internal coords atomArrays are identical

Returns

dict comparison dict from compare_residues()

Bio.PDB.ic_rebuild.report_IC(entity: Union[Bio.PDB.Structure.Structure, Bio.PDB.Model.Model, Bio.PDB.Chain.Chain, Bio.PDB.Residue.Residue], reportDict: Optional[Dict[str, Any]] = None, verbose: bool = False) Dict[str, Any]

Generate dict with counts of ic data elements for each entity level.

reportDict entries are:
  • idcode : PDB ID

  • hdr : PDB header lines

  • mdl : models

  • chn : chains

  • res : residue objects

  • res_e : residues with dihedra and/or hedra

  • dih : dihedra

  • hed : hedra

Parameters

entity (Entity) – Biopython PDB Entity object: S, M, C or R

Raises
  • PDBException – if entity level not S, M, C, or R

  • Exception – if entity does not have .level attribute

Returns

dict with counts of IC data elements

Bio.PDB.ic_rebuild.IC_duplicate(entity) Bio.PDB.Structure.Structure

Duplicate structure entity with IC data, no atom coordinates.

Employs write_PIC(), read_PIC() with StringIO buffer. Calls Chain.atom_to_internal_coordinates() if needed.

Parameters

entity (Entity) – Biopython PDB Entity (will fail for Atom)

Returns

Biopython PDBStructure, no Atom objects except initial coords

Bio.PDB.ic_rebuild.compare_residues(e0: Union[Bio.PDB.Structure.Structure, Bio.PDB.Model.Model, Bio.PDB.Chain.Chain], e1: Union[Bio.PDB.Structure.Structure, Bio.PDB.Model.Model, Bio.PDB.Chain.Chain], verbose: bool = False, quick: bool = False, rtol: Optional[float] = None, atol: Optional[float] = None) Dict[str, Any]

Compare full IDs and atom coordinates for 2 Biopython PDB entities.

Skip DNA and HETATMs.

Parameters
  • e0,e1 (Entity) – Biopython PDB Entity objects (S, M or C). Structures, Models or Chains to be compared

  • verbose (bool) – Whether to print mismatch info, default False

  • quick (bool) – default False. Only check atomArrays are identical, aCoordMatchCount=0 if different

  • atol (float rtol,) – default 1e-03, 1e-03 or round to 3 places. NumPy allclose parameters; default is to round atom coordinates to 3 places and test equal. For ‘quick’ will use defaults above for comparing atomArrays

Returns dict

Result counts for Residues, Full ID match Residues, Atoms, Full ID match atoms, and Coordinate match atoms; report string; error status (bool)

Bio.PDB.ic_rebuild.write_PDB(entity: Bio.PDB.Structure.Structure, file: str, pdbid: Optional[str] = None, chainid: Optional[str] = None) None

Write PDB file with HEADER and TITLE if available.