windowMaker.h 1.61 KB
Newer Older
Aaron's avatar
Aaron committed
1
/*****************************************************************************
Aaron's avatar
Aaron committed
2
windowMaker.h
Aaron's avatar
Aaron committed
3

Aaron's avatar
Aaron committed
4
5
6
7
8
(c) 2009 - Aaron Quinlan
Hall Laboratory
Department of Biochemistry and Molecular Genetics
University of Virginia
aaronquinlan@gmail.com
Aaron's avatar
Aaron committed
9

Aaron's avatar
Aaron committed
10
Licenced under the GNU General Public License 2.0 license.
Aaron's avatar
Aaron committed
11
12
******************************************************************************/
#include "genomeFile.h"
Aaron's avatar
Aaron committed
13
#include "bedFile.h"
Aaron's avatar
Aaron committed
14
15
16
17
18
19
20
21
22
23

using namespace std;


//************************************************
// Class methods and elements
//************************************************
class WindowMaker {

public:
Aaron's avatar
Aaron committed
24
25
26
27
28
29
30
31
    enum INPUT_FILE_TYPE {
        GENOME_FILE,
        BED_FILE
    };
    enum WINDOW_METHOD {
        FIXED_WINDOW_SIZE,
        FIXED_WINDOW_COUNT
    };
32
33
34
35
36
37
    enum ID_METHOD {
        ID_NONE,
        ID_WINDOW_NUMBER,
        ID_SOURCE_ID,
        ID_SOURCE_ID_WINDOW_NUMBER
    };
Aaron's avatar
Aaron committed
38

Aaron's avatar
Aaron committed
39
    // constructor
40
41
    WindowMaker(string &fileName, ID_METHOD id_method, INPUT_FILE_TYPE input_file_type, uint32_t count);
    WindowMaker(string &fileName, ID_METHOD id_method, INPUT_FILE_TYPE input_file_type, uint32_t size, uint32_t step);
Aaron's avatar
Aaron committed
42

Aaron's avatar
Aaron committed
43
44
    // destructor
    ~WindowMaker(void);
Aaron's avatar
Aaron committed
45

Aaron's avatar
Aaron committed
46
47
    void MakeWindowsFromGenome(const string& genomeFileName);
    void MakeWindowsFromBED(string& bedFileName);
Aaron's avatar
Aaron committed
48
49

private:
Aaron's avatar
Aaron committed
50
    uint32_t _size;
Aaron's avatar
Aaron committed
51
    uint32_t _step;
Aaron's avatar
Aaron committed
52
53
    uint32_t _count;
    WINDOW_METHOD _window_method;
54
    ID_METHOD _id_method;
Aaron's avatar
Aaron committed
55
56
57
58
59

    void MakeBEDWindow(const BED& interval);

    void MakeFixedSizeWindow(const BED& interval);
    void MakeFixedCountWindow(const BED& interval);
60
61
62

    string GenerateID(const BED& interval, uint32_t window_index) const;
};