]> git.donarmstrong.com Git - rsem.git/blob - wiggle.h
Refactored wiggle code and added rsem-bam2readdepth program
[rsem.git] / wiggle.h
1 #include <cstdio>
2 #include <string>
3 #include <vector>
4 #include <ostream>
5
6 struct Wiggle {
7     std::string name;
8     std::vector<float> read_depth;
9 };
10
11 class WiggleProcessor {
12 public:
13     virtual ~WiggleProcessor() {}
14     virtual void process(const Wiggle& wiggle) = 0;
15 };
16
17 class UCSCWiggleTrackWriter : public WiggleProcessor {
18 public:
19     UCSCWiggleTrackWriter(const std::string& output_filename,
20                           const std::string& track_name);
21         
22     ~UCSCWiggleTrackWriter();
23
24     void process(const Wiggle& wiggle);
25
26 private:
27     FILE *fo;
28 };
29
30 class ReadDepthWriter : public WiggleProcessor {
31 public:
32     ReadDepthWriter(std::ostream& stream);
33
34     void process(const Wiggle& wiggle);
35
36 private:
37     std::ostream& stream_;
38 };
39
40 void build_wiggles(const std::string& bam_filename,
41                    WiggleProcessor& processor);