douweschulte / pdbtbx

A library to open/edit/save (crystallographic) Protein Data Bank (PDB) and mmCIF files in Rust.

Home Page:https://crates.io/crates/pdbtbx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support atom bonds

douweschulte opened this issue · comments

Bonds are currently partly supported, only disulfide bonds are read from PDBs. The main issue is in the implementation design. Currently the bonds are saved as a list of bond type and the serial numbers of the atoms involved on the PDB struct. This removes any possibility to trace the bound state from an individual atom. The implementation is open for discussion.

Best case from a user perspective

  • From an atom find its bound state (amount of bonds + type of covalent bonds (single, double, triple))
  • From an atom find the bounding partners maybe something like: Atom::bonds() -> impl Iterator<Item=(Bond, &Atom)>
  • Read all bond types from PDB and mmCIF
  • Fill in missing bonds for common structures, like all amino acids

Implementation idea: the bonds function on atoms could use a reference to the PDB to get the reference to the other atoms.

If a bonds method on an atom takes a PDB by reference it has to go through all bonds listed in the PDB and for the ones matching the current atom find the atom reference using binary_find_atom. This would leave a n * a log a runtime (n = number of bonds matching the atom, a = total number of atoms) which should be reasonable for the current goals.