OpenMS
MRMFeatureSelector Class Referenceabstract

#include <OpenMS/ANALYSIS/OPENSWATH/MRMFeatureSelector.h>

Inheritance diagram for MRMFeatureSelector:
[legend]

Classes

struct  SelectorParameters
 

Public Types

enum class  VariableType { INTEGER = 1 , CONTINUOUS }
 
enum class  LambdaScore {
  LINEAR = 1 , INVERSE , LOG , INVERSE_LOG ,
  INVERSE_LOG10
}
 

Public Member Functions

 MRMFeatureSelector ()=default
 
virtual ~MRMFeatureSelector ()=default
 
virtual void optimize (const std::vector< std::pair< double, String >> &time_to_name, const std::map< String, std::vector< Feature >> &feature_name_map, std::vector< String > &result, const SelectorParameters &parameters) const =0
 
void selectMRMFeature (const FeatureMap &features, FeatureMap &selected_filtered, const SelectorParameters &parameters) const
 

Protected Member Functions

Int addVariable_ (LPWrapper &problem, const String &name, const bool bounded, const double obj, const VariableType variableType) const
 
double computeScore_ (const Feature &feature, const std::map< String, LambdaScore > &score_weights) const
 
void addConstraint_ (LPWrapper &problem, const std::vector< Int > &indices, const std::vector< double > &values, const String &name, const double lb, const double ub, const LPWrapper::Type param) const
 

Private Member Functions

void constructTargTransList_ (const FeatureMap &features, std::vector< std::pair< double, String >> &time_to_name, std::map< String, std::vector< Feature >> &feature_name_map, const bool select_transition_group) const
 
double weightScore_ (const double score, const LambdaScore lambda_score) const
 
String removeSpaces_ (String str) const
 Removes spaces from the given string, not-in-place. More...
 

Friends

class MRMFeatureSelector_test
 To test private and protected methods. More...
 

Detailed Description

A Base class (it contains a pure virtual function named optimize()) for selection of MRM Features through Linear Programming.

Member Enumeration Documentation

◆ LambdaScore

enum LambdaScore
strong
Enumerator
LINEAR 
INVERSE 
LOG 
INVERSE_LOG 
INVERSE_LOG10 

◆ VariableType

enum VariableType
strong
Enumerator
INTEGER 
CONTINUOUS 

Constructor & Destructor Documentation

◆ MRMFeatureSelector()

MRMFeatureSelector ( )
default

◆ ~MRMFeatureSelector()

virtual ~MRMFeatureSelector ( )
virtualdefault

Member Function Documentation

◆ addConstraint_()

void addConstraint_ ( LPWrapper problem,
const std::vector< Int > &  indices,
const std::vector< double > &  values,
const String name,
const double  lb,
const double  ub,
const LPWrapper::Type  param 
) const
protected

Add constraint to the LP problem instantiated in optimize()

Parameters
[in,out]problemLPWrapper object
[in]indicesLP matrix indices
[in]valuesLP matrix values
[in]nameRow name
[in]lbLower bound
[in]ubUpper bound
[in]paramRow type

◆ addVariable_()

Int addVariable_ ( LPWrapper problem,
const String name,
const bool  bounded,
const double  obj,
const VariableType  variableType 
) const
protected

Add variable to the LP problem instantiated in optimize()

Parameters
[in,out]problemLPWrapper object
[in]nameColumn name
[in]boundedDouble bounded if true, otherwise Unbounded.
[in]objObjective value
[in]variableTypeEither integer or continuous
Returns
The variable's column index

◆ computeScore_()

double computeScore_ ( const Feature feature,
const std::map< String, LambdaScore > &  score_weights 
) const
protected

Scoring method used by the optimizer. Metavalues to use are decided by the score_weights argument. The returned value is used in the LP problems' variables and constraints.

Parameters
[in]featureInput feature
[in]score_weightsScore weights
Returns
Computed score

Referenced by MRMFeatureSelector_test::computeScore_().

◆ constructTargTransList_()

void constructTargTransList_ ( const FeatureMap features,
std::vector< std::pair< double, String >> &  time_to_name,
std::map< String, std::vector< Feature >> &  feature_name_map,
const bool  select_transition_group 
) const
private

Construct the target transition's or transition group's retention times that will be used to score candidate features based on their deviation from the relative distance between the target transition's or transition group's times

Parameters
[in]featuresInput features
[out]time_to_namePairs representing a mapping of retention times to transition names
[out]feature_name_mapTransitions' names to their features objects
[in]select_transition_groupTransition group selection

Referenced by MRMFeatureSelector_test::constructTargTransList_().

◆ optimize()

virtual void optimize ( const std::vector< std::pair< double, String >> &  time_to_name,
const std::map< String, std::vector< Feature >> &  feature_name_map,
std::vector< String > &  result,
const SelectorParameters parameters 
) const
pure virtual

Derived classes implement this pure virtual method.

It sets up the linear programming problem and solves it.

Parameters
[in]time_to_namePairs representing a mapping of retention times to transition names
[in]feature_name_mapTransitions' names to their features objects
[out]resultTransitions' names filtered out of the LP problem
[in]parametersParameters

Implemented in MRMFeatureSelectorScore, and MRMFeatureSelectorQMIP.

◆ removeSpaces_()

String removeSpaces_ ( String  str) const
private

Removes spaces from the given string, not-in-place.

Referenced by MRMFeatureSelector_test::removeSpaces_().

◆ selectMRMFeature()

void selectMRMFeature ( const FeatureMap features,
FeatureMap selected_filtered,
const SelectorParameters parameters 
) const

The features are sorted by retention time and splitted into segments with the given step and window length. The features are then selected based on the results of optimize() method applied to each segment. The segments may overlap.

Parameters
[in]featuresInput features
[out]selected_filteredOutput features
[in]parametersParameters

◆ weightScore_()

double weightScore_ ( const double  score,
const LambdaScore  lambda_score 
) const
private

Transform the given score through the chosen lambda function

Possible values for lambda_score are:

Exceptions
Exception::IllegalArgumentWhen an invalid lambda_score is passed
Parameters
[in]scoreValue to transform
[in]lambda_scoreA string representing the desired transformation
Returns
The weighted value

Referenced by MRMFeatureSelector_test::weightScore_().

Friends And Related Function Documentation

◆ MRMFeatureSelector_test

friend class MRMFeatureSelector_test
friend

To test private and protected methods.