ex_evaluate_phi_psi

Calculates Phi,Psi angles (Ramachandran map) for every model found in the input protein structure

USAGE:
ex_evaluate_phi_psi 2kwi.pdb

Categories:

  • core::calc::structural::LocalBackboneProperties

Input files:

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

#include <iostream>
#include <core/data/io/Pdb.hh>
#include <core/calc/structural/local_backbone_geometry.hh>
#include <utils/exit.hh>

std::string program_info = R"(

Calculates Phi,Psi angles (Ramachandran map) for every model found in the input protein structure
USAGE:
    ex_evaluate_phi_psi 2kwi.pdb

)";

/** @brief Calculates Phi,Psi angles (Ramachandran map) for the input protein structure
 *
 * CATEGORIES: core::calc::structural::LocalBackboneProperties
 * KEYWORDS:   PDB input; structure properties; structure validation; Ramachandran map
 * IMG: phi_psi_scatterplot.png
 * IMG_ALT: Phi,Psi values plotted for every residue of 2KWI PDB deposit; radius of a circle denotes standard deviation calculated from the NMR ensemble
 */
int main(const int argc, const char *argv[]) {

  using namespace core::calc::structural;

  if (argc < 2) utils::exit_OK_with_message(program_info); // --- complain about missing program parameter

  core::data::io::Pdb reader(argv[1]);  // Create a PDB reader for a given file
  for(int i=0;i<reader.count_models();++i) {
    core::data::structural::Structure_SP str = reader.create_structure(i); // Create a structure object from all the models
    std::vector<LocalBackboneProperties> phi_psi_properties = {LocalBackboneProperties::PHI, LocalBackboneProperties::PSI};
    for (const auto ci_sp:*str) {
      for (size_t i = 2; i < ci_sp->size() - 2; ++i) {
        const auto ires = *((*ci_sp)[i]);
        if (validate(*ci_sp, phi_psi_properties[0], i) && validate(*ci_sp, phi_psi_properties[1], i)) {
          evaluate(*ci_sp, LocalBackboneProperties::PHI, i);
          std::cout << utils::string_format("%4d %3s %c %8.2f %8.2f\n", ires.id(), ires.residue_type().code3.c_str(),
            ires.owner()->id(), evaluate(*ci_sp, LocalBackboneProperties::PHI, i),
            evaluate(*ci_sp, LocalBackboneProperties::PSI, i));
        }
      }
    }
  }
}
../_images/phi_psi_scatterplot.png