-
Notifications
You must be signed in to change notification settings - Fork 0
/
meme_graph.h
65 lines (46 loc) · 1.53 KB
/
meme_graph.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
/*
* This file contains utility datastructures and functions for graphing data
* from MEME testing.
*
* Author: Dan Lin, [email protected]
*
*/
#ifndef MEME_GRAPH_H_
#define MEME_GRAPH_H_
#include <vector>
namespace motif {
//-----------------------------------------------------------------------------
// A struct containing data associated with an ROC plot point in an ROC plot.
struct PlotScore {
bool operator<(const PlotScore& other) const {
return score < other.score;
}
// Whether this score represents a true positive hit on a motif.
bool is_positive;
// Associated score with this plot point.
double score;
};
//-----------------------------------------------------------------------------
// Plot point for an ROC graph. Represents prediction on sample at a specific
// threshold.
struct ROCPlotPoint {
ROCPlotPoint(const double fpr, const double tpr) :
fp_rate(fpr),
tp_rate(tpr) {
}
bool operator<(const ROCPlotPoint& other) const {
return fp_rate < other.fp_rate;
}
// False positive rate.
double fp_rate;
// True positive rate.
double tp_rate;
};
//-----------------------------------------------------------------------------
// Calculates an estaimate of the area under the curve of the ROC plot given
// by 'roc_plot_vec' using "trapezoidal rule". roc_plot_vec will be sorted as
// part of this routine.
double CalculateAUC(std::vector<ROCPlotPoint> *roc_plot_vec);
//-----------------------------------------------------------------------------
} // namespace
#endif // MEME_GRAPH_H_