Imported Debian patch 0.12.7-3
[bowtie.git] / annot.cpp
1 /*
2  * annot.cpp
3  *
4  *  Created on: Aug 3, 2009
5  *      Author: Ben Langmead
6  */
7
8 #include <stdexcept>
9 #include "annot.h"
10
11 using namespace std;
12
13 /**
14  * Parse an annotation-map file.
15  */
16 void AnnotationMap::parse() {
17         ifstream in(fname_);
18         if(!in.good() && in.is_open()) {
19                 cerr << "Could not open annotation file " << fname_ << endl;
20                 throw 1;
21         }
22         while(in.peek() != EOF) {
23                 U32Pair pos;
24                 CharPair an;
25                 in >> pos.first >> pos.second >> an.first >> an.second;
26                 map_[pos] = an;
27                 while(isspace(in.peek())) in.get();
28         }
29         in.close();
30 }