ex_SelectPlanarCAGeometry

ex_SelectPlanarCAGeometry reads a PDB file and tests whether geometry at CA atom is tetrahedral or not. The program also prints the actual values of the N-CA-C-CB dihedral angle.

USAGE:
./ex_SelectPlanarCAGeometry 5edw.pdb

Categories:

  • core::data::structural::ResidueHasBBCB; core::data::structural::SelectResidueByName; core::data::structural::SelectPlanarCAGeometry

Output files:

Program source:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <core/data/io/Pdb.hh>
#include <core/data/structural/structure_selectors.hh>
#include <core/data/structural/SelectPlanarCAGeometry.hh>

#include <utils/exit.hh>
#include <utils/io_utils.hh>

std::string program_info = R"(

ex_SelectPlanarCAGeometry reads a PDB file and tests whether geometry at CA atom is tetrahedral or not.
The program also prints the actual values of the N-CA-C-CB dihedral angle.
USAGE:
    ./ex_SelectPlanarCAGeometry 5edw.pdb

)";

/** @brief Tests whether alpha-carbons actually have tetrahedral geometry as they should.
 *
 * CATEGORIES: core::data::structural::ResidueHasBBCB; core::data::structural::SelectResidueByName; core::data::structural::SelectPlanarCAGeometry
 * KEYWORDS:   residue geometry; structure selectors; PDB input; structure validation
 * IMG: 1NXB_A_56_Glu_pymol_5.png
 * IMG_ALT: GLU56 of 1NXB deposit has planar geometry of alpha-carbon (witch contradicts basic chemical knowledge)
 */
int main(const int argc, const char *argv[]) {

  if (argc < 2) utils::exit_OK_with_message(program_info); // --- complain about missing program parameter
  using namespace core::data::io;

  core::data::io::Pdb reader(argv[1], is_not_alternative); // file name (PDB format, may be gzip-ped)
  core::data::structural::Structure_SP strctr = reader.create_structure(0);

  // --- Selector that returns true if a residue has beta-carbon
  core::data::structural::ResidueHasBBCB has_bb_cb;
  // --- Selector that test the geometry on alpha carbon
  core::data::structural::SelectPlanarCAGeometry tester;
  // --- Selector that selects GLY residues
  core::data::structural::SelectResidueByName is_gly("GLY");
  for (auto res_it = strctr->first_residue(); res_it != strctr->last_residue(); ++res_it) {
    // --- If a residue is not GLY and has C-beta ...
    if ((has_bb_cb(**res_it)) && (!is_gly(**res_it)))
      std::cout << utils::string_format("%4d %3s %c %s %7.2f %s\n", (*res_it)->id(),
        (*res_it)->residue_type().code3.c_str(), (*res_it)->owner()->id(),
        (tester(**res_it)) ? "WRONG" : " OK  ", tester.evaluate_angle(**res_it), utils::basename(strctr->code()).c_str());
  }
}
../_images/1NXB_A_56_Glu_pymol_5.png