OpenMS
Feature Class Reference

An LC-MS feature. More...

#include <OpenMS/KERNEL/Feature.h>

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

Public Member Functions

Constructors and Destructor
 Feature ()
 Default constructor. More...
 
 Feature (const BaseFeature &base)
 explicit C'tor from BaseFeature More...
 
 Feature (const Feature &feature)
 Copy constructor. More...
 
 Feature (Feature &&) noexcept
 Move constructor. More...
 
 ~Feature () override
 Destructor. More...
 
- 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 ChargeTypegetCharge () const
 Non-mutable access to charge state. More...
 
void setCharge (const ChargeType &ch)
 Set charge state. More...
 
BaseFeatureoperator= (const BaseFeature &rhs)=default
 Assignment operator. More...
 
BaseFeatureoperator= (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...
 
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 ()
 
 BaseFeature (const BaseFeature &feature)=default
 Copy constructor. More...
 
 BaseFeature (BaseFeature &&feature) noexcept
 
 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 (const FeatureHandle &fh)
 Constructor from a featurehandle. More...
 
 ~BaseFeature () override
 Destructor. More...
 
QualityType getQuality () const
 
void setQuality (QualityType q)
 Set the overall quality. More...
 
const std::vector< PeptideIdentification > & getPeptideIdentifications () const
 
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...
 
void sortPeptideIdentifications ()
 sorts PeptideIdentifications, assuming they have the same scoreType. More...
 
bool hasPrimaryID () const
 
const IdentificationData::IdentifiedMoleculegetPrimaryID () const
 Return the primary ID (peptide, RNA, compound) assigned to this feature. More...
 
void clearPrimaryID ()
 clear any primary ID that was assigned More...
 
void setPrimaryID (const IdentificationData::IdentifiedMolecule &id)
 set the primary ID (peptide, RNA, compound) for this feature More...
 
const std::set< IdentificationData::ObservationMatchRef > & getIDMatches () const
 immutable access to the set of matches (e.g. PSMs) with IDs for this feature More...
 
std::set< IdentificationData::ObservationMatchRef > & getIDMatches ()
 mutable access to the set of matches (e.g. PSMs) with IDs for this feature More...
 
void addIDMatch (IdentificationData::ObservationMatchRef ref)
 add an ID match (e.g. PSM) for this feature More...
 
void updateIDReferences (const IdentificationData::RefTranslator &trans)
 Update ID references (primary ID, matches) for this feature. 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...
 
RichPeak2Doperator= (const RichPeak2D &rhs)=default
 Assignment operator. More...
 
RichPeak2Doperator= (RichPeak2D &&rhs) &=default
 Move Assignment operator. More...
 
RichPeak2Doperator= (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
bool operator== (const Peak2D &rhs) const
 Equality operator. More...
 
bool operator!= (const Peak2D &rhs) const
 Equality operator. More...
 
 Peak2D ()=default
 
 Peak2D (const PositionType &pos, const IntensityType in)
 Member constructor. More...
 
 Peak2D (const Peak2D &p)=default
 Copy constructor. More...
 
 Peak2D (Peak2D &&) noexcept=default
 Move constructor. More...
 
Peak2Doperator= (const Peak2D &rhs)=default
 Assignment operator. More...
 
Peak2Doperator= (Peak2D &&) noexcept=default
 Move assignment operator. More...
 
 ~Peak2D () noexcept=default
 Destructor. More...
 
IntensityType getIntensity () const
 
void setIntensity (IntensityType intensity)
 Sets data point intensity (height) More...
 
PositionType const & getPosition () const
 Non-mutable access to the position. More...
 
PositionTypegetPosition ()
 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...
 
MetaInfoInterfaceoperator= (const MetaInfoInterface &rhs)
 Assignment operator. More...
 
MetaInfoInterfaceoperator= (MetaInfoInterface &&) noexcept
 Move assignment operator. More...
 
void swap (MetaInfoInterface &rhs)
 Swap contents. More...
 
bool operator== (const MetaInfoInterface &rhs) const
 Equality operator. More...
 
bool operator!= (const MetaInfoInterface &rhs) const
 Equality operator. More...
 
const DataValuegetMetaValue (const String &name) const
 Returns the value corresponding to a string, or DataValue::EMPTY if not found. More...
 
DataValue getMetaValue (const String &name, const DataValue &default_value) const
 Returns the value corresponding to a string, or a default value (e.g.: DataValue::EMPTY) if not found. More...
 
const DataValuegetMetaValue (UInt index) const
 Returns the value corresponding to the index, or DataValue::EMPTY if not found. More...
 
DataValue getMetaValue (UInt index, const DataValue &default_value) const
 Returns the value corresponding to the index, or a default value (e.g.: 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 addMetaValues (const MetaInfoInterface &from)
 function to copy all meta values from one object to this one 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...
 
UniqueIdInterfaceoperator= (UniqueIdInterface const &rhs)=default
 Assignment operator - copies the unique id. More...
 
UniqueIdInterfaceoperator= (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...
 

Model and quality methods

typedef QualityLess OverallQualityLess
 Compare by quality. More...
 
QualityType getOverallQuality () const
 Non-mutable access to the overall quality. More...
 
void setOverallQuality (QualityType q)
 Set the overall quality. More...
 
QualityType getQuality (Size index) const
 Non-mutable access to the quality in dimension c. More...
 
void setQuality (Size index, QualityType q)
 Set the quality in dimension c. More...
 

Convex hulls and bounding box

QualityType qualities_ [2]
 Quality measures for each dimension. More...
 
std::vector< ConvexHull2Dconvex_hulls_
 Array of convex hulls (one for each mass trace) More...
 
bool convex_hulls_modified_ {}
 Flag that indicates if the overall convex hull needs to be recomputed (i.e. mass trace convex hulls were modified) More...
 
ConvexHull2D convex_hull_
 Overall convex hull of the feature. More...
 
std::vector< Featuresubordinates_
 subordinate features (e.g. features that represent alternative explanations, usually with lower quality) More...
 
const std::vector< ConvexHull2D > & getConvexHulls () const
 Non-mutable access to the convex hulls. More...
 
std::vector< ConvexHull2D > & getConvexHulls ()
 Mutable access to the convex hulls of single mass traces. More...
 
void setConvexHulls (const std::vector< ConvexHull2D > &hulls)
 Set the convex hulls of single mass traces. More...
 
ConvexHull2DgetConvexHull () const
 Returns the overall convex hull of the feature (calculated from the convex hulls of the mass traces) More...
 
bool encloses (double rt, double mz) const
 Returns if the mass trace convex hulls of the feature enclose the position specified by rt and mz. More...
 
Featureoperator= (const Feature &rhs)
 Assignment operator. More...
 
Featureoperator= (Feature &&) &noexcept
 Move assignment operator. More...
 
bool operator== (const Feature &rhs) const
 Equality operator. More...
 
const std::vector< Feature > & getSubordinates () const
 immutable access to subordinate features More...
 
std::vector< Feature > & getSubordinates ()
 mutable access to subordinate features More...
 
void setSubordinates (const std::vector< Feature > &rhs)
 mutable access to subordinate features More...
 
template<typename Type >
Size applyMemberFunction (Size(Type::*member_function)())
 Applies a member function of Type to the feature (including subordinates). The returned values are accumulated. More...
 
template<typename Type >
Size applyMemberFunction (Size(Type::*member_function)() const) const
 The "const" variant. More...
 
void updateAllIDReferences (const IdentificationData::RefTranslator &trans)
 Update ID references (primary ID, input matches) for this feature and any subfeatures. More...
 

Additional Inherited Members

- 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 getAnnotationState() to query it More...
 
typedef float QualityType
 
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...
 
- 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 MetaInfoRegistrymetaRegistry ()
 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< PeptideIdentificationpeptides_
 PeptideIdentifications belonging to the feature. More...
 
std::optional< IdentificationData::IdentifiedMoleculeprimary_id_
 primary ID (peptide, RNA, compound) assigned to this feature More...
 
std::set< IdentificationData::ObservationMatchRefid_matches_
 set of observation matches (e.g. PSMs) with IDs for this 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
MetaInfometa_
 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

An LC-MS feature.

The Feature class is used to describe the two-dimensional signal caused by an analyte. It can store a charge state and a list of peptide identifications (for peptides). The area occupied by the Feature in the LC-MS data set is represented by a list of convex hulls (one for each isotopic peak). There is also a convex hull for the entire Feature. The model description can store the parameters of a two-dimensional theoretical model of the underlying signal in LC-MS. Currently, non-peptide compounds are also represented as features.

By convention in OpenMS, the position of a feature is defined as maximum position of the model for the retention time dimension and the mass of the monoisotopic peak for the m/z dimension. The intensity of a feature is (proportional to) its total ion count.

Feature is derived from RichPeak2D. Also inherited is a MetaInfoInterface. Features as usually are contained in a FeatureMap. See also FeatureHandle and ConsensusFeature.

Member Typedef Documentation

◆ OverallQualityLess

Compare by quality.

Constructor & Destructor Documentation

◆ Feature() [1/4]

Feature ( )

Default constructor.

◆ Feature() [2/4]

Feature ( const BaseFeature base)
explicit

explicit C'tor from BaseFeature

◆ Feature() [3/4]

Feature ( const Feature feature)

Copy constructor.

◆ Feature() [4/4]

Feature ( Feature &&  )
noexcept

Move constructor.

◆ ~Feature()

~Feature ( )
override

Destructor.

Member Function Documentation

◆ applyMemberFunction() [1/2]

Size applyMemberFunction ( Size(Type::*)() const  member_function) const
inline

The "const" variant.

◆ applyMemberFunction() [2/2]

Size applyMemberFunction ( Size(Type::*)()  member_function)
inline

Applies a member function of Type to the feature (including subordinates). The returned values are accumulated.

Example: The following will print the number of features (parent feature and subordinates) with invalid unique ids:

(...)
std::cout << f.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId) << std::endl;
Feature()
Default constructor.
Size hasInvalidUniqueId() const
Returns whether the unique id is invalid. Returns 1 if the unique id is invalid, 0 otherwise.
Definition: UniqueIdInterface.h:112

See e.g. UniqueIdInterface for what else can be done this way.

References Feature::applyMemberFunction().

Referenced by Feature::applyMemberFunction().

◆ encloses()

bool encloses ( double  rt,
double  mz 
) const

Returns if the mass trace convex hulls of the feature enclose the position specified by rt and mz.

◆ getConvexHull()

ConvexHull2D& getConvexHull ( ) const

Returns the overall convex hull of the feature (calculated from the convex hulls of the mass traces)

Note
the bounding box of the feature can be accessed through the returned convex hull

◆ getConvexHulls() [1/2]

std::vector<ConvexHull2D>& getConvexHulls ( )

Mutable access to the convex hulls of single mass traces.

◆ getConvexHulls() [2/2]

const std::vector<ConvexHull2D>& getConvexHulls ( ) const

◆ getOverallQuality()

QualityType getOverallQuality ( ) const

◆ getQuality()

QualityType getQuality ( Size  index) const

Non-mutable access to the quality in dimension c.

◆ getSubordinates() [1/2]

std::vector<Feature>& getSubordinates ( )

mutable access to subordinate features

◆ getSubordinates() [2/2]

const std::vector<Feature>& getSubordinates ( ) const

immutable access to subordinate features

◆ operator=() [1/2]

Feature& operator= ( const Feature rhs)

Assignment operator.

◆ operator=() [2/2]

Feature& operator= ( Feature &&  ) &
noexcept

Move assignment operator.

◆ operator==()

bool operator== ( const Feature rhs) const

Equality operator.

◆ setConvexHulls()

void setConvexHulls ( const std::vector< ConvexHull2D > &  hulls)

Set the convex hulls of single mass traces.

Referenced by IsotopeWaveletTransform< PeakType >::mapSeeds2Features().

◆ setOverallQuality()

◆ setQuality()

void setQuality ( Size  index,
QualityType  q 
)

◆ setSubordinates()

void setSubordinates ( const std::vector< Feature > &  rhs)

mutable access to subordinate features

◆ updateAllIDReferences()

void updateAllIDReferences ( const IdentificationData::RefTranslator trans)

Update ID references (primary ID, input matches) for this feature and any subfeatures.

This is needed e.g. after the IdentificationData instance containing the referenced data has been copied.

Member Data Documentation

◆ convex_hull_

ConvexHull2D convex_hull_
mutableprotected

Overall convex hull of the feature.

◆ convex_hulls_

std::vector<ConvexHull2D> convex_hulls_
protected

Array of convex hulls (one for each mass trace)

◆ convex_hulls_modified_

bool convex_hulls_modified_ {}
mutableprotected

Flag that indicates if the overall convex hull needs to be recomputed (i.e. mass trace convex hulls were modified)

◆ qualities_

QualityType qualities_[2]
protected

Quality measures for each dimension.

◆ subordinates_

std::vector<Feature> subordinates_
protected

subordinate features (e.g. features that represent alternative explanations, usually with lower quality)