| OpenMS 2.5.0

Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Friends | List of all members
MRMFeatureSelector Class Referenceabstract

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

Inheritance diagram for MRMFeatureSelector:

## Classes

struct | SelectorParameters

## Public Types

enum | VariableType { INTEGER = 1, CONTINUOUS }
enum | 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, std::vector< Int > indices, 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 | ( |  | ) |

virtual default

## Member Function Documentation

## ◆ addConstraint_()

void addConstraint_ | ( | LPWrapper & | problem,
|  | std::vector< Int > | indices,
|  | 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] | problem | LPWrapper object
  [in] | indices | LP matrix indices
  [in] | values | LP matrix values
  [in] | name | Row name
  [in] | lb | Lower bound
  [in] | ub | Upper bound
  [in] | param | Row 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] | problem | LPWrapper object
  [in] | name | Column name
  [in] | bounded | Double bounded if true, otherwise Unbounded.
  [in] | obj | Objective value
  [in] | variableType | Either 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 contraints.

Parameters

  [in] | feature | Input feature
  [in] | score_weights | Score 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] | features | Input features
  [out] | time_to_name | Pairs representing a mapping of retention times to transition names
  [out] | feature_name_map | Transitions' names to their features objects
  [in] | select_transition_group | Transition group selection

## ◆ 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_name | Pairs representing a mapping of retention times to transition names
  [in] | feature_name_map | Transitions' names to their features objects
  [out] | result | Transitions' names filtered out of the LP problem
  [in] | parameters | Parameters

Implemented in MRMFeatureSelectorScore, and MRMFeatureSelectorQMIP.

## ◆ removeSpaces_()

String removeSpaces_ | ( | String | str | ) | const

private

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

## ◆ 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] | features | Input features
  [out] | selected_filtered | Output features
  [in] | parameters | Parameters

## ◆ 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:

- LambdaScore::LINEAR
- LambdaScore::INVERSE
- LambdaScore::LOG
- LambdaScore::INVERSE_LOG
- LambdaScore::INVERSE_LOG10

Exceptions

  Exception::IllegalArgument | When an invalid `lambda_score` is passed

Parameters

  [in] | score | Value to transform
  [in] | lambda_score | A string representing the desired transformation

Returns
  The weighted value

## Friends And Related Function Documentation

## ◆ MRMFeatureSelector_test

friend class MRMFeatureSelector_test

friend

To test private and protected methods.