ex_PdbLineFilter

Reads a PDB file and removes waters and alternate atom locations.

USAGE:
ex_PdbLineFilter 5edw.pdb

Categories:

  • core::data::io::PdbLineFilter

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

std::string program_info = R"(

Reads a PDB file and removes waters and alternate atom locations.
USAGE:
    ex_PdbLineFilter 5edw.pdb

)";

/** @brief Simple cleanup for a PDB file.
 * Removes waters and alternate atom locations.
 *
 * CATEGORIES: core::data::io::PdbLineFilter;
 * KEYWORDS:   PDB input; PDB output; PDB line filter
 */
int main(const int argc, const char *argv[]) {

  if (argc < 2) utils::exit_OK_with_message(program_info); // --- complain about missing program parameter
  core::data::io::Pdb reader(argv[1], // --- input PDB file name
    core::data::io::all_true(core::data::io::is_not_water, core::data::io::is_not_alternative), // --- The PDB line filter
    true); // --- YES, parse header
  core::data::structural::Structure_SP s = reader.create_structure(0);
  for (auto a_it = s->first_atom(); a_it != s->last_atom(); ++a_it)
    std::cout << (*a_it)->to_pdb_line() << "\n";
}
../_images/file_icon.png