9 void Window::count_hits() {
11 for(vector<unsigned int>::iterator i = counts.begin(); i != counts.end(); ++i) {
16 Window::Window(string name, string chr, int start, int end, double score) {
23 counts.resize(end-start+1,0);
27 Window::Window(const Window& r) {
31 this->sequence = r.sequence;
32 this->start = r.start;
34 this->counts = r.counts;
37 Window& Window::operator=(const Window& r) {
39 this->score = r.score;
41 this->sequence = r.sequence;
42 this->start = r.start;
44 this->counts = r.counts;
48 ostream &operator<<( ostream &out, const Window &w ) {
49 out << w.chr.c_str() << "\t" << w.start << "\t" << w.end << "\t" << w.total;
53 bool Window::operator<(const Window& b) const {
54 if(this->chr == b.chr) { return this->start < b.start; } else { return this->chr < b.chr; } }
57 Window::Window(string line) {
58 istringstream outStream;
60 vector<string> fields;
62 split(line,delim,fields);
64 this->name = fields[0];
65 this->chr = fields[1];
66 this->start = atoi(fields[2].c_str());
67 this->end = atoi(fields[3].c_str());
68 this->score = strtod(fields[4].c_str(), NULL);
72 void Window::reset(unsigned int new_start, unsigned int new_end) {
73 this->start = new_start;
76 this->counts.resize(end-start+1,0);
79 bool compare_windows(const Window &a, const Window &b) { if(a.chr == b.chr) { return a.start < b.start; } else { return a.chr < b.chr; } }