ex_selection_protocols

ex_selection_protocols shows how to use selection protocols

USAGE:
ex_selection_protocols 5edw.pdb

Keywords:

Categories:

  • core::protocols::keep_selected_atoms()

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
#include <iostream>
#include <sstream>
#include <core/data/io/Pdb.hh>
#include <core/data/structural/structure_selectors.hh>
#include <core/protocols/selection_protocols.hh>
#include <utils/exit.hh>

std::string program_info = R"(

ex_selection_protocols shows how to use selection protocols
USAGE:
    ex_selection_protocols 5edw.pdb

)";
/** @brief Shows how to use selection protocols
 *
 * CATEGORIES: core::protocols::keep_selected_atoms()
 * KEYWORDS:   PDB input; Selection protocols; structure selectors
 */
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::structural;
  using namespace core::protocols;

  core::data::io::Pdb reader(argv[1]);

  { // --- section which tests selecting nucleotides
    Structure_SP strctr = reader.create_structure(0);

    std::shared_ptr<AtomSelector> select_nt = std::make_shared<IsNT>();

    keep_selected_atoms(*select_nt, *strctr);
    for (auto chain_sp : *strctr)
      std::cout << utils::string_format("\tchain %c has %3d residues satisfying the selector\n", chain_sp->id(),
        chain_sp->size());
  }
}
../_images/file_icon.png