-
Notifications
You must be signed in to change notification settings - Fork 296
Expand file tree
/
Copy pathGenomeFile.h
More file actions
74 lines (52 loc) · 1.93 KB
/
GenomeFile.h
File metadata and controls
74 lines (52 loc) · 1.93 KB
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
64
65
66
67
68
69
70
71
72
73
74
/*****************************************************************************
GenomeFile.h
(c) 2009 - Aaron Quinlan
Hall Laboratory
Department of Biochemistry and Molecular Genetics
University of Virginia
aaronquinlan@gmail.com
Licensed under the GNU General Public License 2.0 license.
******************************************************************************/
#ifndef GENOMEFILE_H
#define GENOMEFILE_H
#include <map>
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cstring>
#include <cstdio>
#include <stdint.h>
#include <algorithm> // for bsearch lower_bound()
#include "api/BamReader.h"
#include "api/BamAux.h"
using namespace BamTools;
using namespace std;
typedef int64_t CHRPOS;
// typedef for mapping b/w chrom name and it's size in b.p.
typedef map<string, CHRPOS, std::less<string> > chromToSizes;
class GenomeFile {
public:
// Constructor using a file
GenomeFile(const string &genomeFile);
// Constructor using a vector of BamTools RefVector
GenomeFile(const RefVector &genome);
// Destructor
~GenomeFile(void);
// load a GENOME file into a map keyed by chrom. value is size of chrom.
void loadGenomeFileIntoMap();
pair<string, CHRPOS> projectOnGenome(CHRPOS genome_pos);
uint64_t getChromSize(const string &chrom); // return the size of a chromosome
uint64_t getGenomeSize(void); // return the total size of the geonome
vector<string> getChromList(); // return a list of chrom names
int getNumberOfChroms(); // return the number of chroms
string getGenomeFileName(); // return the name of the genome file
private:
string _genomeFile;
chromToSizes _chromSizes;
vector<string> _chromList;
// projecting chroms into a single coordinate system
CHRPOS _genomeLength;
vector<CHRPOS> _startOffsets;
};
#endif /* GENOMEFILE_H */