Compare RNA secondary structure by their confusion matrix. More...
#include <confusion_matrix.hh>
Public Member Functions | |
ConfusionMatrix (const std::string &ref, const std::string &pred, const bool slide, const bool conflict, const BasePairFilter::Filter &filter=BasePairFilter::BPMinLoopSize(3)) | |
ConfusionMatrix (const RnaStructure &ref, const RnaStructure &pred, const bool slide, const bool conflict, const BasePairFilter::Filter &filter=BasePairFilter::BPMinLoopSize(3)) | |
size_t | tp () const |
True positives. | |
size_t | tn () const |
True negatives. | |
size_t | fp () const |
False positives. | |
size_t | fn () const |
double | ppv () const |
double | sens () const |
double | spec () const |
double | f1_score () const |
double | mcc () const |
Protected Member Functions | |
size_t | count_common_bps (const RnaStructure &s1, const RnaStructure &s2) |
Count common base pairs. | |
size_t | count_tps (const RnaStructure &pred, const RnaStructure &ref) |
Count true positive base pairs. | |
size_t | count_conflicting_base_pairs (const RnaStructure &s1, const RnaStructure &s2) |
Count conflicting base pairs (including common bps) | |
size_t | count_potential_base_pairs (size_t length) |
Count potential base pairs. | |
size_t | count_base_pairs (const RnaStructure &s) |
Count base pairs in a structure. |
Compare RNA secondary structure by their confusion matrix.
Computes confusion matrix and Matthews' correlation coefficient
Base pair filters provide a generic way to count only a subset of potential base pairs, e.g. only canonical base pairs, or base pairs in a certain range l..u
Implements slide rule and conflict rule; see Paul special
Slide rule: tolerate shift of one base pair end by 1 position (affects true positives and false negatives)
Conflict rule: predicted base pairs are false only if they conflict with reference; two base pair conflict iff they share one end (affects "false positives")
LocARNA::ConfusionMatrix::ConfusionMatrix | ( | const std::string & | ref, |
const std::string & | pred, | ||
const bool | slide, | ||
const bool | conflict, | ||
const BasePairFilter::Filter & | filter = BasePairFilter::BPMinLoopSize(3) |
||
) |
Construct with reference and predicted structure (given as dot-bracket strings)
ref | reference structure |
pred | predicted structure |
slide | use slide rule [default off] |
conflict | use conflict rule [default off] |
filter | base pair filter |
LocARNA::ConfusionMatrix::ConfusionMatrix | ( | const RnaStructure & | ref, |
const RnaStructure & | pred, | ||
const bool | slide, | ||
const bool | conflict, | ||
const BasePairFilter::Filter & | filter = BasePairFilter::BPMinLoopSize(3) |
||
) |
Construct with reference and predicted structure (given as base pair sets)
ref | reference structure |
pred | predicted structure |
slide | use slide rule [default off] |
conflict | use conflict rule [default off] |
filter | base pair filter |
size_t LocARNA::ConfusionMatrix::count_base_pairs | ( | const RnaStructure & | s | ) | [protected] |
Count base pairs in a structure.
structure | RNA structure |
size_t LocARNA::ConfusionMatrix::count_common_bps | ( | const RnaStructure & | s1, |
const RnaStructure & | s2 | ||
) | [protected] |
Count common base pairs.
s1 | first structure |
s2 | second structure |
size_t LocARNA::ConfusionMatrix::count_conflicting_base_pairs | ( | const RnaStructure & | s1, |
const RnaStructure & | s2 | ||
) | [protected] |
Count conflicting base pairs (including common bps)
s1 | first structure |
s2 | second structure |
Two base pairs (i,j) and (i',j') conflict if and only if they share exactly one end.
size_t LocARNA::ConfusionMatrix::count_potential_base_pairs | ( | size_t | length | ) | [protected] |
Count potential base pairs.
length | length of RNA |
size_t LocARNA::ConfusionMatrix::count_tps | ( | const RnaStructure & | pred, |
const RnaStructure & | ref | ||
) | [protected] |
Count true positive base pairs.
pred | predicted structure |
ref | reference structure |
double LocARNA::ConfusionMatrix::f1_score | ( | ) | const |
F1 score (aka F-score, F-measure)
harmonic mean of PPV and SENS
size_t LocARNA::ConfusionMatrix::fn | ( | ) | const [inline] |
False negatives
size_t LocARNA::ConfusionMatrix::fp | ( | ) | const [inline] |
False positives.
double LocARNA::ConfusionMatrix::mcc | ( | ) | const |
Matthews' correlation coefficient
double LocARNA::ConfusionMatrix::ppv | ( | ) | const |
Positive prediction value
aka precision
double LocARNA::ConfusionMatrix::sens | ( | ) | const |
Sensitivity
aka recall
double LocARNA::ConfusionMatrix::spec | ( | ) | const |
Specificity
size_t LocARNA::ConfusionMatrix::tn | ( | ) | const [inline] |
True negatives.
size_t LocARNA::ConfusionMatrix::tp | ( | ) | const [inline] |
True positives.