Imported Upstream version 0.12.7
[bowtie.git] / chaincat.cpp
1 /*
2  * chaincat.cpp
3  *
4  * Print out a chained-hit file.
5  *
6  *  Created on: Jul 31, 2009
7  *      Author: Ben Langmead
8  */
9
10 #include <iostream>
11 #include <stdexcept>
12 #include "hit_set.h"
13 #include "filebuf.h"
14
15 using namespace std;
16
17 int main(int argc, char **argv) {
18         try {
19                 if(argc <= 1) {
20                         cerr << "Error: must specify chain file as first argument" << endl;
21                         return 1;
22                 }
23                 FILE *in = fopen(argv[1], "rb");
24                 if(in == NULL) {
25                         cerr << "Could not open " << argv[1] << endl;
26                         return 1;
27                 }
28                 FileBuf fb(in);
29                 while(!fb.eof()) {
30                         HitSet s(fb);
31                         s.reportUpTo(cout);
32                 }
33                 fb.close();
34         } catch(std::exception& e) {
35                 return 1;
36         }
37 }