| OpenMS 2.5.0

Classes | Public Member Functions | Private Attributes | List of all members
ConsensusFeature Class Reference
Kernel

A consensus feature spanning multiple LC-MS/MS experiments. More...

`#include <OpenMS/KERNEL/ConsensusFeature.h>`

Inheritance diagram for ConsensusFeature:

## Classes

struct | MapsLess
| Compare by the sets of consensus elements (lexicographically) More...
struct | Ratio
| slim struct to feed the need for systematically storing of ratios ( More...
struct | SizeLess
| Compare by size(), the number of consensus elements. More...

## Public Types

typedef std::set< FeatureHandle, FeatureHandle::IndexLess > | HandleSetType
| Type definitions. More...
typedef HandleSetType::const_iterator | const_iterator
typedef HandleSetType::iterator | iterator
typedef HandleSetType::const_reverse_iterator | const_reverse_iterator
typedef HandleSetType::reverse_iterator | reverse_iterator
Public Types inherited from BaseFeature
enum | AnnotationState { FEATURE_ID_NONE, FEATURE_ID_SINGLE, FEATURE_ID_MULTIPLE_SAME, FEATURE_ID_MULTIPLE_DIVERGENT, SIZE_OF_ANNOTATIONSTATE }
| state of identification, use getIDState() to query it More...
typedef float | QualityType
| Type of quality values. More...
typedef Int | ChargeType
| Type of charge values. More...
typedef float | WidthType
| Type of feature width/FWHM (RT) More...
Public Types inherited from Peak2D
typedef float | IntensityType
| Intensity type. More...
typedef double | CoordinateType
| Coordinate type (of the position) More...
typedef DPosition< 2 > | PositionType
| Position type. More...
enum | DimensionDescription { RT = 0, MZ = 1, DIMENSION = 2 }
| This enum maps the symbolic names of the dimensions to numbers. More...
Public Types inherited from UniqueIdInterface
enum | { INVALID = 0 }
| This is the invalid unique id (cast it to a UInt64 if you like) More...

## Public Member Functions

void | computeConsensus ()
| Computes and updates the consensus position, intensity, and charge. More...
void | computeMonoisotopicConsensus ()
| Computes and updates the consensus position, intensity, and charge. More...
void | computeDechargeConsensus (const FeatureMap &fm, bool intensity_weighted_averaging=false)
| Computes the uncharged parent RT & mass, assuming the handles are charge variants. More...
void | addRatio (const Ratio &r)
| Add a ratio. More...
void | setRatios (std::vector< Ratio > &rs)
| Add a ratio vector. More...
std::vector< Ratio > | getRatios () const
| Get the ratio vector. More...
std::vector< Ratio > & | getRatios ()
| Get the ratio vector. More...
Constructors and Destructor
| ConsensusFeature ()
| Default constructor. More...
| ConsensusFeature (const ConsensusFeature &rhs)=default
| Copy constructor. More...
| ConsensusFeature (ConsensusFeature &&rhs)=default
| Move constructor. More...
| ConsensusFeature (const BaseFeature &feature)
| Constructor from basic feature. More...
| ConsensusFeature (UInt64 map_index, const Peak2D &element, UInt64 element_index)
| Constructor with map and element index for a singleton consensus feature. More...
| ConsensusFeature (UInt64 map_index, const BaseFeature &element)
| Constructor with map index for a singleton consensus feature. More...
ConsensusFeature & | operator= (const ConsensusFeature &rhs)=default
| Assignment operator. More...
ConsensusFeature & | operator= (ConsensusFeature &&rhs)=default
| Move Assignment operator. More...
| ~ConsensusFeature () override
| Destructor. More...
Management of feature handles
void | insert (const ConsensusFeature &cf)
| Adds all feature handles (of the CF) into the consensus feature. More...
void | insert (const FeatureHandle &handle)
| Adds an feature handle into the consensus feature. More...
void | insert (const HandleSetType &handle_set)
| Adds all feature handles in `handle_set` to this consensus feature. More...
void | insert (UInt64 map_index, const Peak2D &element, UInt64 element_index)
| Creates a FeatureHandle and adds it. More...
void | insert (UInt64 map_index, const BaseFeature &element)
| Creates a FeatureHandle and adds it. More...
const HandleSetType & | getFeatures () const
| Non-mutable access to the contained feature handles. More...
std::vector< FeatureHandle > | getFeatureList () const
| Mutable access to a copy of the contained feature handles. More...
void | setFeatures (HandleSetType h)
| Set the feature set to a new one. More...
Accessors
DRange< 2 > | getPositionRange () const
| Returns the position range of the contained elements. More...
DRange< 1 > | getIntensityRange () const
| Returns the intensity range of the contained elements. More...
Accessors for set of FeatureHandles
Size | size () const
const_iterator | begin () const
iterator | begin ()
const_iterator | end () const
iterator | end ()
const_reverse_iterator | rbegin () const
reverse_iterator | rbegin ()
const_reverse_iterator | rend () const
reverse_iterator | rend ()
void | clear ()
bool | empty () const
Public Member Functions inherited from BaseFeature
WidthType | getWidth () const
| Non-mutable access to the features width (full width at half max, FWHM) More...
void | setWidth (WidthType fwhm)
| Set the width of the feature (FWHM) More...
const ChargeType & | getCharge () const
| Non-mutable access to charge state. More...
void | setCharge (const ChargeType &ch)
| Set charge state. More...
BaseFeature & | operator= (const BaseFeature &rhs)=default
| Assignment operator. More...
BaseFeature & | operator= (BaseFeature &&rhs) &=default
| Move Assignment operator. More...
bool | operator== (const BaseFeature &rhs) const
| Equality operator. More...
bool | operator!= (const BaseFeature &rhs) const
| Inequality operator. More...
const std::vector< PeptideIdentification > & | getPeptideIdentifications () const
| returns a const reference to the PeptideIdentification vector More...
std::vector< PeptideIdentification > & | getPeptideIdentifications ()
| returns a mutable reference to the PeptideIdentification vector More...
void | setPeptideIdentifications (const std::vector< PeptideIdentification > &peptides)
| sets the PeptideIdentification vector More...
AnnotationState | getAnnotationState () const
| state of peptide identifications attached to this feature. If one ID has multiple hits, the output depends on the top-hit only More...
| BaseFeature ()
| Default constructor. More...
| BaseFeature (const BaseFeature &feature)=default
| Copy constructor. More...
| BaseFeature (BaseFeature &&feature)=default
| Move constructor. More...
| BaseFeature (const BaseFeature &rhs, UInt64 map_index)
| Copy constructor with a new map_index. More...
| BaseFeature (const Peak2D &point)
| Constructor from raw data point. More...
| BaseFeature (const RichPeak2D &point)
| Constructor from raw data point with meta information. More...
| ~BaseFeature () override
| Destructor. More...
QualityType | getQuality () const
| Non-mutable access to the overall quality. More...
void | setQuality (QualityType q)
| Set the overall quality. More...
Public Member Functions inherited from RichPeak2D
| RichPeak2D ()
| Default constructor. More...
| RichPeak2D (const RichPeak2D &p)=default
| Copy constructor. More...
| RichPeak2D (const Peak2D &p)
| Constructor from Peak2D. More...
| RichPeak2D (const PositionType &pos, const IntensityType in)
| Member constructor. More...
| RichPeak2D (RichPeak2D &&p)=default
| Move constructor. More...
| ~RichPeak2D () override
| Destructor. More...
RichPeak2D & | operator= (const RichPeak2D &rhs)=default
| Assignment operator. More...
RichPeak2D & | operator= (RichPeak2D &&rhs) &=default
| Move Assignment operator. More...
RichPeak2D & | operator= (const Peak2D &rhs)
| Assignment operator. More...
bool | operator== (const RichPeak2D &rhs) const
| Equality operator. More...
bool | operator!= (const RichPeak2D &rhs) const
| Equality operator. More...
Public Member Functions inherited from Peak2D
Peak2D & | operator= (const Peak2D &rhs)=default
| Assignment operator. More...
Peak2D & | operator= (Peak2D &&) &=default
| Move assignment operator. More...
bool | operator== (const Peak2D &rhs) const
| Equality operator. More...
bool | operator!= (const Peak2D &rhs) const
| Equality operator. More...
| Peak2D ()
| Peak2D (const PositionType &pos, const IntensityType in)
| Member constructor. More...
| Peak2D (const Peak2D &p)=default
| Copy constructor. More...
| Peak2D (Peak2D &&)=default
| Move constructor. More...
| ~Peak2D ()
| Destructor. More...
IntensityType | getIntensity () const
void | setIntensity (IntensityType intensity)
| Non-mutable access to the data point intensity (height) More...
PositionType const & | getPosition () const
| Non-mutable access to the position. More...
PositionType & | getPosition ()
| Mutable access to the position. More...
void | setPosition (const PositionType &position)
| Mutable access to the position. More...
CoordinateType | getMZ () const
| Returns the m/z coordinate (index 1) More...
void | setMZ (CoordinateType coordinate)
| Mutable access to the m/z coordinate (index 1) More...
CoordinateType | getRT () const
| Returns the RT coordinate (index 0) More...
void | setRT (CoordinateType coordinate)
| Mutable access to the RT coordinate (index 0) More...
Public Member Functions inherited from MetaInfoInterface
| MetaInfoInterface ()
| Constructor. More...
| MetaInfoInterface (const MetaInfoInterface &rhs)
| Copy constructor. More...
| MetaInfoInterface (MetaInfoInterface &&) noexcept
| Move constructor. More...
| ~MetaInfoInterface ()
| Destructor. More...
MetaInfoInterface & | operator= (const MetaInfoInterface &rhs)
| Assignment operator. More...
MetaInfoInterface & | operator= (MetaInfoInterface &&) noexcept
| Move assignment operator. More...
bool | operator== (const MetaInfoInterface &rhs) const
| Equality operator. More...
bool | operator!= (const MetaInfoInterface &rhs) const
| Equality operator. More...
const DataValue & | getMetaValue (const String &name, const DataValue &default_value=DataValue::EMPTY) const
| Returns the value corresponding to a string, or a default value (default: DataValue::EMPTY) if not found. More...
const DataValue & | getMetaValue (UInt index, const DataValue &default_value=DataValue::EMPTY) const
| Returns the value corresponding to an index, or a default value (default: DataValue::EMPTY) if not found. More...
bool | metaValueExists (const String &name) const
| Returns whether an entry with the given name exists. More...
bool | metaValueExists (UInt index) const
| Returns whether an entry with the given index exists. More...
void | setMetaValue (const String &name, const DataValue &value)
| Sets the DataValue corresponding to a name. More...
void | setMetaValue (UInt index, const DataValue &value)
| Sets the DataValue corresponding to an index. More...
void | removeMetaValue (const String &name)
| Removes the DataValue corresponding to `name` if it exists. More...
void | removeMetaValue (UInt index)
| Removes the DataValue corresponding to `index` if it exists. More...
void | getKeys (std::vector< String > &keys) const
| Fills the given vector with a list of all keys for which a value is set. More...
void | getKeys (std::vector< UInt > &keys) const
| Fills the given vector with a list of all keys for which a value is set. More...
bool | isMetaEmpty () const
| Returns if the MetaInfo is empty. More...
void | clearMetaInfo ()
| Removes all meta values. More...
Public Member Functions inherited from UniqueIdInterface
| UniqueIdInterface ()
| Default constructor - the unique id will be invalid More...
| UniqueIdInterface (const UniqueIdInterface &rhs)=default
| Copy constructor - copies the unique id. More...
| UniqueIdInterface (UniqueIdInterface &&rhs)=default
| Move constructor. More...
UniqueIdInterface & | operator= (UniqueIdInterface const &rhs)=default
| Assignment operator - copies the unique id. More...
UniqueIdInterface & | operator= (UniqueIdInterface &&) &=default
| Move Assignment operator - copies the unique id. More...
virtual | ~UniqueIdInterface ()=default
| Destructor. More...
bool | operator== (UniqueIdInterface const &rhs) const
| Equality comparison operator - the unique ids must be equal (!) More...
UInt64 | getUniqueId () const
| Non-mutable access to unique id - returns the unique id. More...
Size | clearUniqueId ()
| Clear the unique id. The new unique id will be invalid. Returns 1 if the unique id was changed, 0 otherwise. More...
void | swap (UniqueIdInterface &from)
Size | hasValidUniqueId () const
| Returns whether the unique id is valid. Returns 1 if the unique id is valid, 0 otherwise. More...
Size | hasInvalidUniqueId () const
| Returns whether the unique id is invalid. Returns 1 if the unique id is invalid, 0 otherwise. More...
Size | setUniqueId ()
| Assigns a new, valid unique id. Always returns 1. More...
Size | ensureUniqueId ()
| Assigns a valid unique id, but only if the present one is invalid. Returns 1 if the unique id was changed, 0 otherwise. More...
void | setUniqueId (UInt64 rhs)
| Assigns the given unique id. More...
void | setUniqueId (const String &rhs)
| Mutable access to unique id. More...

## Private Attributes

HandleSetType | handles_
std::vector< Ratio > | ratios_

## Additional Inherited Members

Static Public Member Functions inherited from Peak2D
static char const * | shortDimensionName (UInt const dim)
| Short name of the dimension (abbreviated form) More...
static char const * | shortDimensionNameRT ()
| Short name of the dimension (abbreviated form) More...
static char const * | shortDimensionNameMZ ()
| Short name of the dimension (abbreviated form) More...
static char const * | fullDimensionName (UInt const dim)
| Full name of the dimension (self-explanatory form) More...
static char const * | fullDimensionNameRT ()
| Full name of the dimension (self-explanatory form) More...
static char const * | fullDimensionNameMZ ()
| Full name of the dimension (self-explanatory form) More...
static char const * | shortDimensionUnit (UInt const dim)
| Unit of measurement (abbreviated form) More...
static char const * | shortDimensionUnitRT ()
| Unit of measurement (abbreviated form) More...
static char const * | shortDimensionUnitMZ ()
| Unit of measurement (abbreviated form) More...
static char const * | fullDimensionUnit (UInt const dim)
| Unit of measurement (self-explanatory form) More...
static char const * | fullDimensionUnitRT ()
| Unit of measurement (self-explanatory form) More...
static char const * | fullDimensionUnitMZ ()
| Unit of measurement (self-explanatory form) More...
Static Public Member Functions inherited from MetaInfoInterface
static MetaInfoRegistry & | metaRegistry ()
| Returns a reference to the MetaInfoRegistry. More...
Static Public Member Functions inherited from UniqueIdInterface
static bool | isValid (UInt64 unique_id)
| Returns true if the unique_id is valid, false otherwise. More...
Static Public Attributes inherited from BaseFeature
static const std::string | NamesOfAnnotationState [SIZE_OF_ANNOTATIONSTATE]
Protected Member Functions inherited from MetaInfoInterface
void | createIfNotExists_ ()
| Creates the MetaInfo object if it does not exist. More...
Protected Attributes inherited from BaseFeature
QualityType | quality_
| Overall quality measure of the feature. More...
ChargeType | charge_
| Charge of the peptide represented by this feature. The default value is 0, which represents an unknown charge state. More...
WidthType | width_
| Width (FWHM) for the feature. The default value is 0.0, a feature finding algorithm can compute this form the model. More...
std::vector< PeptideIdentification > | peptides_
| Peptide PeptideIdentifications belonging to the feature. More...
Protected Attributes inherited from Peak2D
PositionType | position_
| The data point position. More...
IntensityType | intensity_
| The data point intensity. More...
Protected Attributes inherited from MetaInfoInterface
MetaInfo * | meta_
| Pointer to the MetaInfo object (0 by default) More...
Protected Attributes inherited from UniqueIdInterface
UInt64 | unique_id_
| the unique id More...
Static Protected Attributes inherited from Peak2D
static char const *const | dimension_name_short_ [DIMENSION]
| Short name of the dimension (abbreviated form) More...
static char const *const | dimension_name_full_ [DIMENSION]
| Full name of the dimension (self-explanatory form) More...
static char const *const | dimension_unit_short_ [DIMENSION]
| Unit of measurement (abbreviated form) More...
static char const *const | dimension_unit_full_ [DIMENSION]
| Unit of measurement (self-explanatory form) More...

## Detailed Description

A consensus feature spanning multiple LC-MS/MS experiments.

A ConsensusFeature represents analytes that have been quantified across multiple LC-MS/MS experiments. Each analyte in a ConsensusFeature is linked to its original LC-MS/MS run through a unique identifier.

A consensus feature represents corresponding features in multiple feature maps. The corresponding features are represented a set of FeatureHandle instances. Each ConsensusFeature "contains" zero or more FeatureHandles.

See also
  ConsensusMap

## Member Typedef Documentation

## ◆ const_iterator

typedef HandleSetType::const_iterator const_iterator

## ◆ const_reverse_iterator

typedef HandleSetType::const_reverse_iterator const_reverse_iterator

## ◆ HandleSetType

typedef std::set<FeatureHandle, FeatureHandle::IndexLess> HandleSetType

Type definitions.

## ◆ iterator

typedef HandleSetType::iterator iterator

## ◆ reverse_iterator

typedef HandleSetType::reverse_iterator reverse_iterator

## Constructor & Destructor Documentation

## ◆ ConsensusFeature() [1/6]

ConsensusFeature | ( |  | ) |

Default constructor.

## ◆ ConsensusFeature() [2/6]

ConsensusFeature | ( | const ConsensusFeature & | rhs | ) |

default

Copy constructor.

## ◆ ConsensusFeature() [3/6]

ConsensusFeature | ( | ConsensusFeature && | rhs | ) |

default

Move constructor.

## ◆ ConsensusFeature() [4/6]

ConsensusFeature | ( | const BaseFeature & | feature | ) |

explicit

Constructor from basic feature.

## ◆ ConsensusFeature() [5/6]

ConsensusFeature | ( | UInt64 | map_index,
|  | const Peak2D & | element,
|  | UInt64 | element_index
| ) |  |

Constructor with map and element index for a singleton consensus feature.

Sets the consensus feature position and intensity to the values of `element` as well.

## ◆ ConsensusFeature() [6/6]

ConsensusFeature | ( | UInt64 | map_index,
|  | const BaseFeature & | element
| ) |  |

Constructor with map index for a singleton consensus feature.

Sets the consensus feature position, intensity, charge, quality, and peptide identifications to the values of `element` as well.

## ◆ ~ConsensusFeature()

~ConsensusFeature | ( |  | ) |

override

Destructor.

## Member Function Documentation

## ◆ addRatio()

void addRatio | ( | const Ratio & | r | ) |

Add a ratio.

Connects a ratio to the ConsensusFeature.

Note
  still experimental. consensusfeaturehandler will ignore it.

## ◆ begin() [1/2]

const_iterator begin | ( |  | ) | const

Referenced by TOPPGNPSExport::main_(), and ConsensusFeature::MapsLess::operator()().

## ◆ begin() [2/2]

iterator begin | ( |  | ) |

## ◆ clear()

void clear | ( |  | ) |

## ◆ computeConsensus()

void computeConsensus | ( |  | ) |

Computes and updates the consensus position, intensity, and charge.

The position and intensity of the contained feature handles is averaged. The most frequent charge state wins, while the tie breaking prefers smaller (absolute) charges.

Note
  This method has to be called explicitly, after adding the feature handles.

## ◆ computeDechargeConsensus()

void computeDechargeConsensus | ( | const FeatureMap & | fm,
|  | bool | intensity_weighted_averaging = `false`
| ) |  |

Computes the uncharged parent RT & mass, assuming the handles are charge variants.

The position of the feature handles (decharged) is averaged (using intensity as weights if `intensity_weighted_averaging` is true). Intensities are summed up. Charge is set to 0. Mass calculation: If the given features contain a metavalue "dc_charge_adduct_mass" then this will be used as adduct mass instead of weight(H+) * charge.

Note
  This method has to be called explicitly, after adding the feature handles.

Parameters

  fm | Input feature map, which provides additional information on the features
  intensity_weighted_averaging | Use unweighted averaging (default) or weighted by intensity

## ◆ computeMonoisotopicConsensus()

void computeMonoisotopicConsensus | ( |  | ) |

Computes and updates the consensus position, intensity, and charge.

The m/z position is the lowest m/z value of the feature handles. The RT position and intensity of the contained feature handles is averaged. The most frequent charge state wins, while the tie breaking prefers smaller (absolute) charges.

Note
  This method has to be called explicitly, after adding the feature handles.

## ◆ empty()

bool empty | ( |  | ) | const

## ◆ end() [1/2]

const_iterator end | ( |  | ) | const

Referenced by TOPPGNPSExport::main_(), and ConsensusFeature::MapsLess::operator()().

## ◆ end() [2/2]

iterator end | ( |  | ) |

## ◆ getFeatureList()

std::vector<FeatureHandle> getFeatureList | ( |  | ) | const

Mutable access to a copy of the contained feature handles.

## ◆ getFeatures()

const HandleSetType& getFeatures | ( |  | ) | const

Non-mutable access to the contained feature handles.

## ◆ getIntensityRange()

DRange<1> getIntensityRange | ( |  | ) | const

Returns the intensity range of the contained elements.

## ◆ getPositionRange()

DRange<2> getPositionRange | ( |  | ) | const

Returns the position range of the contained elements.

## ◆ getRatios() [1/2]

std::vector<Ratio> getRatios | ( |  | ) | const

Get the ratio vector.

## ◆ getRatios() [2/2]

std::vector<Ratio>& getRatios | ( |  | ) |

Get the ratio vector.

## ◆ insert() [1/5]

void insert | ( | const ConsensusFeature & | cf | ) |

Adds all feature handles (of the CF) into the consensus feature.

## ◆ insert() [2/5]

void insert | ( | const FeatureHandle & | handle | ) |

Adds an feature handle into the consensus feature.

Exceptions

  Exception::InvalidValue | is thrown if a handle with the same map index and unique id already exists.

## ◆ insert() [3/5]

void insert | ( | const HandleSetType & | handle_set | ) |

Adds all feature handles in `handle_set` to this consensus feature.

## ◆ insert() [4/5]

void insert | ( | UInt64 | map_index,
|  | const Peak2D & | element,
|  | UInt64 | element_index
| ) |  |

Creates a FeatureHandle and adds it.

Exceptions

  Exception::InvalidValue | is thrown if a handle with the same map index and unique id already exists.

## ◆ insert() [5/5]

void insert | ( | UInt64 | map_index,
|  | const BaseFeature & | element
| ) |  |

Creates a FeatureHandle and adds it.

Exceptions

  Exception::InvalidValue | is thrown if a handle with the same map index and unique id already exists.

## ◆ operator=() [1/2]

ConsensusFeature& operator= | ( | const ConsensusFeature & | rhs | ) |

default

Assignment operator.

## ◆ operator=() [2/2]

ConsensusFeature& operator= | ( | ConsensusFeature && | rhs | ) |

default

Move Assignment operator.

## ◆ rbegin() [1/2]

const_reverse_iterator rbegin | ( |  | ) | const

## ◆ rbegin() [2/2]

reverse_iterator rbegin | ( |  | ) |

## ◆ rend() [1/2]

const_reverse_iterator rend | ( |  | ) | const

## ◆ rend() [2/2]

reverse_iterator rend | ( |  | ) |

## ◆ setFeatures()

void setFeatures | ( | HandleSetType | h | ) |

Set the feature set to a new one.

## ◆ setRatios()

void setRatios | ( | std::vector< Ratio > & | rs | ) |

Add a ratio vector.

Connects the ratios to the ConsensusFeature.

Note
  still experimental. consensusfeaturehandler will ignore it.

## ◆ size()

Size size | ( |  | ) | const

Referenced by ConsensusFeature::SizeLess::operator()().

## Member Data Documentation

## ◆ handles_

HandleSetType handles_

private

## ◆ ratios_

std::vector<Ratio> ratios_

private