-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathfilterresult.h
79 lines (72 loc) · 2.49 KB
/
filterresult.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef FILTER_RESULT_H
#define FILTER_RESULT_H
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include "common.h"
#include "options.h"
#include <fstream>
#include <map>
struct classcomp {
bool operator() (const string& lhs, const string& rhs) const {
if (lhs.length() < rhs.length())
return true;
else if(lhs.length() == rhs.length()) {
return lhs < rhs;
} else
return false;
}
};
using namespace std;
class FilterResult{
public:
FilterResult(Options* opt, bool paired = false);
~FilterResult();
inline long* getFilterReadStats() {return mFilterReadStats;}
void addFilterResult(int result, int readNum=1);
static FilterResult* merge(vector<FilterResult*>& list);
void print();
// for single end
void addAdapterTrimmed(string adapter, bool isR2 = false, bool incTrimmedCounter = true);
// for paired end
void addAdapterTrimmed(string adapter1, string adapter2);
void addPolyXTrimmed(int base, int length);
long getTotalPolyXTrimmedReads();
long getTotalPolyXTrimmedBases();
// a part of JSON report
void reportJson(ofstream& ofs, string padding);
// a part of JSON report for adapters
void reportAdapterJson(ofstream& ofs, string padding);
// a part of JSON report for polyX trim
void reportPolyXTrimJson(ofstream& ofs, string padding);
// a part of HTML report
void reportHtml(ofstream& ofs, long totalReads, long totalBases);
// a part of HTML report for adapters
void reportAdapterHtml(ofstream& ofs, long totalBases);
void outputAdaptersJson(ofstream& ofs, map<string, long, classcomp>& adapterCounts);
void outputAdaptersHtml(ofstream& ofs, map<string, long, classcomp>& adapterCounts, long totalBases);
// deal with base correction results
long* getCorrectionMatrix() {return mCorrectionMatrix;}
long getTotalCorrectedBases();
void addCorrection(char from, char to);
long getCorrectionNum(char from, char to);
void incCorrectedReads(int count);
void addMergedPairs(int pairs);
public:
Options* mOptions;
bool mPaired;
long mCorrectedReads;
long mMergedPairs;
private:
long mFilterReadStats[FILTER_RESULT_TYPES];
long mTrimmedAdapterRead;
long mTrimmedAdapterBases;
long mTrimmedPolyXReads[4] = {0};
long mTrimmedPolyXBases[4] = {0};
map<string, long, classcomp> mAdapter1;
map<string, long, classcomp> mAdapter2;
long* mCorrectionMatrix;
};
#endif