forked from BenLangmead/bowtie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
annot.h
63 lines (52 loc) · 1.15 KB
/
annot.h
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
56
57
58
59
60
61
62
63
/*
* annot.h
*
* Created on: Aug 3, 2009
* Author: Ben Langmead
*/
#ifndef ANNOT_H_
#define ANNOT_H_
#include <stdint.h>
#include <map>
#include <iostream>
#include <fstream>
#include "btypes.h"
/**
* Encapsulates a sorted list of reference positions that are annotated
* somehow (e.g. as a SNP).
*/
class AnnotationMap {
public:
typedef std::pair<TIndexOffU, TIndexOffU> UPair;
typedef std::pair<char, char> CharPair;
typedef std::map<UPair, CharPair> AnnotMap;
typedef std::map<UPair, CharPair>::const_iterator Iter;
AnnotationMap(const char *fname) {
fname_ = fname;
parse();
}
/**
* Give a reference coordinate in the index, translate it into a
* new reference coordinate via the reference map supplied by the
* user.
*/
Iter lower_bound(const UPair& h) const {
return map_.lower_bound(h);
}
Iter begin() const {
return map_.begin();
}
Iter end() const {
return map_.end();
}
protected:
/**
* Parse an annotation-map file.
*/
void parse();
/// filename of file containing the annotation map
const char *fname_;
/// maps reference positions to character annotations
AnnotMap map_;
};
#endif /* ANNOT_H_ */