OpenMS  2.6.0
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
IDScoreSwitcherAlgorithm Class Reference

#include <OpenMS/ANALYSIS/ID/IDScoreSwitcherAlgorithm.h>

Inheritance diagram for IDScoreSwitcherAlgorithm:
[legend]
Collaboration diagram for IDScoreSwitcherAlgorithm:
[legend]

Public Types

enum  ScoreType {
  RAW, RAW_EVAL, PP, PEP,
  FDR, QVAL
}
 

Public Member Functions

 IDScoreSwitcherAlgorithm ()
 
template<typename IDType >
void switchScores (IDType &id, Size &counter)
 
void switchToGeneralScoreType (std::vector< PeptideIdentification > &id, ScoreType type, Size &counter)
 
void switchToGeneralScoreType (ConsensusMap &cmap, ScoreType type, Size &counter, bool unassigned_peptides_too=true)
 
template<typename IDType >
String findScoreType (IDType &id, IDScoreSwitcherAlgorithm::ScoreType type)
 finds a certain score type in an ID and its metavalues if present, otherwise returns empty string More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
virtual DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 

Private Member Functions

void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method. More...
 

Private Attributes

const double tolerance_ = 1e-6
 relative tolerance for score comparisons: More...
 
String new_score_
 will be set according to the algorithm parameters More...
 
String new_score_type_
 
String old_score_
 
bool higher_better_
 will be set according to the algorithm parameters More...
 
std::map< ScoreType, std::set< String > > type_to_str_
 a map from ScoreType to their names as used around OpenMS More...
 
std::map< ScoreType, bool > type_to_better_
 a map from ScoreType to their ordering More...
 

Additional Inherited Members

- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &prefix="")
 Writes all parameters to meta values. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 

Member Enumeration Documentation

◆ ScoreType

enum ScoreType
strong

This is a rough hierarchy of possible score types in MS In an ideal case this should be reimplemented to follow ontology hierarchies as soon as e.g. MS-OBO is complete and we switched the Metavalues to CV terms.

Enumerator
RAW 
RAW_EVAL 
PP 
PEP 
FDR 
QVAL 

Constructor & Destructor Documentation

◆ IDScoreSwitcherAlgorithm()

Member Function Documentation

◆ findScoreType()

String findScoreType ( IDType &  id,
IDScoreSwitcherAlgorithm::ScoreType  type 
)
inline

finds a certain score type in an ID and its metavalues if present, otherwise returns empty string

References OPENMS_LOG_INFO, and OPENMS_LOG_WARN.

◆ switchScores()

void switchScores ( IDType &  id,
Size counter 
)
inline

Switches all main scores in all hits in id according to the settings in the param object of the switcher class

References DataValue::isEmpty(), and DataValue::toString().

◆ switchToGeneralScoreType() [1/2]

void switchToGeneralScoreType ( ConsensusMap cmap,
ScoreType  type,
Size counter,
bool  unassigned_peptides_too = true 
)
inline

Looks at the first Hit of the given id and according to the given type , deduces a fitting score and score direction to be switched to. Then tries to switch all hits.

References String::chop(), String::hasSuffix(), and OPENMS_LOG_WARN.

◆ switchToGeneralScoreType() [2/2]

void switchToGeneralScoreType ( std::vector< PeptideIdentification > &  id,
ScoreType  type,
Size counter 
)
inline

Looks at the first Hit of the given id and according to the given type , deduces a fitting score and score direction to be switched to. Then tries to switch all hits.

References String::chop(), String::hasSuffix(), and OPENMS_LOG_WARN.

◆ updateMembers_()

void updateMembers_ ( )
overrideprivatevirtual

This method is used to update extra member variables at the end of the setParameters() method.

Also call it at the end of the derived classes' copy constructor and assignment operator.

The default implementation is empty.

Reimplemented from DefaultParamHandler.

Member Data Documentation

◆ higher_better_

bool higher_better_
private

will be set according to the algorithm parameters

◆ new_score_

String new_score_
private

will be set according to the algorithm parameters

◆ new_score_type_

String new_score_type_
private

◆ old_score_

String old_score_
private

◆ tolerance_

const double tolerance_ = 1e-6
private

relative tolerance for score comparisons:

◆ type_to_better_

std::map<ScoreType, bool> type_to_better_
private
Initial value:
=
{
{ScoreType::RAW, true},
{ScoreType::PP, true},
{ScoreType::PEP, false},
{ScoreType::FDR, false},
{ScoreType::QVAL, false}
}

a map from ScoreType to their ordering

◆ type_to_str_

std::map<ScoreType, std::set<String> > type_to_str_
private
Initial value:
=
{
{ScoreType::RAW, {"XTandem", "OMSSA", "SEQUEST:xcorr", "Mascot", "mvh"}},
{ScoreType::RAW_EVAL, {"expect", "SpecEValue", "E-Value", "evalue", "MS:1002053", "MS:1002257"}},
{ScoreType::PP, {"Posterior Probability"}},
{ScoreType::PEP, {"Posterior Error Probability", "pep", "MS:1001493"}},
{ScoreType::FDR, {"FDR", "fdr", "false discovery rate"}},
{ScoreType::QVAL, {"q-value", "qvalue", "MS:1001491", "q-Value", "qval"}}
}

a map from ScoreType to their names as used around OpenMS

OpenMS::IDScoreSwitcherAlgorithm::ScoreType::RAW
OpenMS::IDScoreSwitcherAlgorithm::ScoreType::FDR
OpenMS::IDScoreSwitcherAlgorithm::ScoreType::QVAL
OpenMS::IDScoreSwitcherAlgorithm::ScoreType::PP
OpenMS::IDScoreSwitcherAlgorithm::ScoreType::PEP
OpenMS::IDScoreSwitcherAlgorithm::ScoreType::RAW_EVAL