ap_hhpred_converter

ap_hhpred_converter reads alignments from HHPred output and prints then in Edinburgh, FASTA or PIR format

USAGE:
ap_hhpred_converter hhpred.out flag

where flag is one of the following

-e for Edinburgh output format -f for FASTA output format -p for PIR output format

Keywords:

  • sequence alignment, FASTA, PIR

Categories:

  • core::data::io::read_hhpred

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
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include <core/data/io/alignment_io.hh>
#include <core/data/io/fasta_io.hh>
#include <core/data/io/pir_io.hh>
#include <utils/exit.hh>

std::string program_info = R"(

ap_hhpred_converter reads alignments from HHPred output and prints then in Edinburgh, FASTA or PIR format

USAGE:
    ap_hhpred_converter hhpred.out flag

where flag is one of the following

 -e for Edinburgh output format
 -f for FASTA output format
 -p for PIR output format

)";

/** @brief Extract alignments from HHPred output
 *
 * CATEGORIES: core::data::io::read_hhpred;
 * KEYWORDS:   sequence alignment, FASTA, PIR
 * GROUP:      File processing;Format conversion
 */
int main(const int argc, const char* argv[]) {

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

  std::vector<core::alignment::PairwiseSequenceAlignment_SP> alignments;
  core::data::io::read_hhpred(argv[1], alignments);

  char flag = argv[2][1]; // --- E, e, F, f, P, p
  switch(flag) {
    case 'E' :
    case 'e' :
      for(const auto & seq_ali : alignments)
        core::data::io::write_edinburgh(*seq_ali, std::cout, 80);
      break;
    case 'F' :
    case 'f' :
      for(const auto & seq_ali : alignments)
        std::cout << core::data::io::create_fasta_string(*seq_ali, 80) << "\n";
      break;
    case 'P' :
    case 'p' :
      for(const auto & seq_ali : alignments)
        std::cout << core::data::io::create_pir_string(*seq_ali, 80) << "\n";
      break;
    default: std::cerr << "Incorrect output format requested!\n";
  }

}
../_images/file_icon.png