LocARNA-1.9.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Protected Member Functions
LocARNA::ConfusionMatrix Class Reference

Compare RNA secondary structure by their confusion matrix. More...

#include <confusion_matrix.hh>

List of all members.

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.

Detailed Description

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")


Constructor & Destructor Documentation

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)

Parameters:
refreference structure
predpredicted structure
slideuse slide rule [default off]
conflictuse conflict rule [default off]
filterbase 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)

Parameters:
refreference structure
predpredicted structure
slideuse slide rule [default off]
conflictuse conflict rule [default off]
filterbase pair filter

Member Function Documentation

size_t LocARNA::ConfusionMatrix::count_base_pairs ( const RnaStructure s) [protected]

Count base pairs in a structure.

Parameters:
structureRNA structure
Returns:
number of base pairs
size_t LocARNA::ConfusionMatrix::count_common_bps ( const RnaStructure s1,
const RnaStructure s2 
) [protected]

Count common base pairs.

Parameters:
s1first structure
s2second structure
Returns:
number of base pairs in the first structure that are as well in the second (optionally according to slide rule)
Note:
due to slide rule this is not symmetric
size_t LocARNA::ConfusionMatrix::count_conflicting_base_pairs ( const RnaStructure s1,
const RnaStructure s2 
) [protected]

Count conflicting base pairs (including common bps)

Parameters:
s1first structure
s2second structure

Two base pairs (i,j) and (i',j') conflict if and only if they share exactly one end.

Returns:
number of base pairs in s1 that conflict with s2
size_t LocARNA::ConfusionMatrix::count_potential_base_pairs ( size_t  length) [protected]

Count potential base pairs.

Parameters:
lengthlength of RNA
Returns:
number of potential base pairs
size_t LocARNA::ConfusionMatrix::count_tps ( const RnaStructure pred,
const RnaStructure ref 
) [protected]

Count true positive base pairs.

Parameters:
predpredicted structure
refreference structure
Returns:
number of true positive base pairs

F1 score (aka F-score, F-measure)

harmonic mean of PPV and SENS

Returns:
F1 = PPV*SENS / (PPV+SENS), if PPV+SENS!=0; 0, otherwise
size_t LocARNA::ConfusionMatrix::fn ( ) const [inline]

False negatives

Returns:
number of false negative base pairs
Note:
A false negative is pair annotated to basepair but not predicted.
size_t LocARNA::ConfusionMatrix::fp ( ) const [inline]

False positives.

Returns:
number of false positive base pairs
Note:
A false positive is a pair predicted to basepair but not annotated.

Matthews' correlation coefficient

Returns:
MCC = (TP*TN - FP*FN) / sqrt( (TP+FP)*(TP+FN)*(TN+FP)*(TN+FN) )

Positive prediction value

aka precision

Returns:
PPV = TP/(TP+FP)

Sensitivity

aka recall

Returns:
SENS = TP/(TP+FN)

Specificity

Returns:
SPEC = TN/(TN+FP)
size_t LocARNA::ConfusionMatrix::tn ( ) const [inline]

True negatives.

Returns:
number of true negative base pairs
Note:
A true negative is a pair which is neither annotated nor predicted to basepair
size_t LocARNA::ConfusionMatrix::tp ( ) const [inline]

True positives.

Returns:
number of true positive base pairs
Note:
A true positive is a pair that is basepaired in both prediction and annotation; this is softened with slide rule, see ().

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends