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) → Dict

Test rebuild PDB structure from internal coordinates.

  • entity – Biopython Structure, Model or Chain Structure to test

  • verbose – bool print extra messages


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: 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


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

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

  • Exception – if entity does not have .level attribute


dict with counts of IC data elements


Duplicate structure entity with IC data, no atom coordinates.

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


entity – Biopython PDB Entity (will fail for Atom)


Biopython PDBStructure, no Atom objects

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) → Dict[str, Any]

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

Skip DNA and HETATMs.

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

  • verbose – Bool whether to print mismatch info, default False


Dictionary 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: str = None, chainid: str = None) → None

Write PDB file with HEADER and TITLE.