ap_scorefile_columns

Reads a score file or a silent file (produced by Rosetta) and extracts requested columns of scores

USAGE:
ap_scorefile_columns default.out
ap_scorefile_columns score.fsc

Keywords:

Categories:

  • core::data::io::scorefile_io

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

#include <core/data/io/scorefile_io.hh>
#include <utils/exit.hh>

std::string program_info = R"(

Reads a score file or a silent file (produced by Rosetta) and extracts requested columns of scores
USAGE:
    ap_scorefile_columns default.out
    ap_scorefile_columns score.fsc

)";

/** @brief Reads a score-file or a silent file (produced by Rosetta) and extracts requested columns of scores
 *
 * CATEGORIES: core::data::io::scorefile_io
 * KEYWORDS:   score file input; silent file output; Rosetta scorefile
 */
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;

  std::shared_ptr<NamedDataTable> fsc =  read_scorefile(argv[1]);
  std::vector<core::index1> columns;
  if(argc>2)
    for(core::index1 i=2;i<argc;++i) columns.push_back(fsc->column_index(argv[i]));
  else {
    columns.push_back(fsc->column_index("score"));
    columns.push_back(fsc->column_index("rms"));
  }
  std::vector<std::string> tags;
  std::cout << "#";
  for (core::index1 icol : columns) std::cout << " "<< fsc->column_name(icol) ;
  std::cout << "\n";
  for (const auto &row: *fsc) {
    for (core::index1 icol : columns) std::cout << row[icol] << " ";
    std::cout << "\n";
  }
}
../_images/file_icon.png