OpenMS
DataFilters Class Reference

DataFilter array providing some convenience functions. More...

#include <OpenMS/FILTERING/DATAREDUCTION/DataFilters.h>

Collaboration diagram for DataFilters:
[legend]

Classes

struct  DataFilter
 Representation of a peak/feature filter combining FilterType, FilterOperation and a value (either double or String) More...
 

Public Types

enum  FilterType {
  INTENSITY , QUALITY , CHARGE , SIZE ,
  META_DATA
}
 Information to filter. More...
 
enum  FilterOperation { GREATER_EQUAL , EQUAL , LESS_EQUAL , EXISTS }
 Filter operation. More...
 

Public Member Functions

 DataFilters ()=default
 
Size size () const
 Filter count. More...
 
const DataFilteroperator[] (Size index) const
 Filter accessor. More...
 
void add (const DataFilter &filter)
 Adds a filter. More...
 
void remove (Size index)
 Removes the filter corresponding to index. More...
 
void replace (Size index, const DataFilter &filter)
 Replaces the filter corresponding to index. More...
 
void clear ()
 Removes all filters. More...
 
void setActive (bool is_active)
 Enables/disables the all the filters. More...
 
bool isActive () const
 Returns if the filters are enabled. More...
 
bool passes (const Feature &feature) const
 Returns if the feature fulfills the current filter criteria. More...
 
bool passes (const ConsensusFeature &consensus_feature) const
 Returns if the consensus_feature fulfills the current filter criteria. More...
 
bool passes (const MSSpectrum &spectrum, Size peak_index) const
 Returns if the a peak in a spectrum at peak_index fulfills the current filter criteria. More...
 
bool passes (const MSChromatogram &chrom, Size peak_index) const
 Returns if the a peak in a chrom at peak_index fulfills the current filter criteria. More...
 
bool passes (const Mobilogram &mobilogram, Size peak_index) const
 Returns if the a peak in a mobilogram at peak_index fulfills the current filter criteria. More...
 

Protected Member Functions

bool metaPasses_ (const MetaInfoInterface &meta_interface, const DataFilters::DataFilter &filter, Size index) const
 Returns if the meta value at index of meta_interface (a peak or feature) passes the filter. More...
 

Protected Attributes

std::vector< DataFilterfilters_
 Array of DataFilters. More...
 
std::vector< Sizemeta_indices_
 Vector of meta indices acting as index cache. More...
 
bool is_active_ = false
 Determines if the filters are activated. More...
 

Detailed Description

DataFilter array providing some convenience functions.

Note
For features the meta data filtering works on the MetaDataInterface of the Feature. For peaks it works on the FloatDataArrays defined in MSSpectrum.

Member Enumeration Documentation

◆ FilterOperation

Filter operation.

Enumerator
GREATER_EQUAL 

Greater than the value or equal to the value.

EQUAL 

Equal to the value.

LESS_EQUAL 

Less than the value or equal to the value.

EXISTS 

Only for META_DATA filter type, tests if meta data exists.

◆ FilterType

enum FilterType

Information to filter.

Enumerator
INTENSITY 

Filter the intensity value.

QUALITY 

Filter the overall quality value.

CHARGE 

Filter the charge value.

SIZE 

Filter the number of subordinates/elements.

META_DATA 

Filter meta data.

Constructor & Destructor Documentation

◆ DataFilters()

DataFilters ( )
default

Member Function Documentation

◆ add()

void add ( const DataFilter filter)

Adds a filter.

◆ clear()

void clear ( )

Removes all filters.

◆ isActive()

bool isActive ( ) const
inline

Returns if the filters are enabled.

They are automatically enabled when a filter is added and automatically disabled when the last filter is removed

◆ metaPasses_()

bool metaPasses_ ( const MetaInfoInterface meta_interface,
const DataFilters::DataFilter filter,
Size  index 
) const
protected

Returns if the meta value at index of meta_interface (a peak or feature) passes the filter.

◆ operator[]()

const DataFilter& operator[] ( Size  index) const

Filter accessor.

Exceptions
Exception::IndexOverflowis thrown for invalid indices

◆ passes() [1/5]

bool passes ( const ConsensusFeature consensus_feature) const

Returns if the consensus_feature fulfills the current filter criteria.

◆ passes() [2/5]

bool passes ( const Feature feature) const

Returns if the feature fulfills the current filter criteria.

◆ passes() [3/5]

bool passes ( const Mobilogram mobilogram,
Size  peak_index 
) const
inline

Returns if the a peak in a mobilogram at peak_index fulfills the current filter criteria.

References DataFilters::DataFilter::field, DataFilters::DataFilter::op, and DataFilters::DataFilter::value.

◆ passes() [4/5]

bool passes ( const MSChromatogram chrom,
Size  peak_index 
) const
inline

◆ passes() [5/5]

bool passes ( const MSSpectrum spectrum,
Size  peak_index 
) const
inline

◆ remove()

void remove ( Size  index)

Removes the filter corresponding to index.

Exceptions
Exception::IndexOverflowis thrown for invalid indices

◆ replace()

void replace ( Size  index,
const DataFilter filter 
)

Replaces the filter corresponding to index.

Exceptions
Exception::IndexOverflowis thrown for invalid indices

◆ setActive()

void setActive ( bool  is_active)

Enables/disables the all the filters.

◆ size()

Size size ( ) const

Filter count.

Member Data Documentation

◆ filters_

std::vector<DataFilter> filters_
protected

Array of DataFilters.

◆ is_active_

bool is_active_ = false
protected

Determines if the filters are activated.

◆ meta_indices_

std::vector<Size> meta_indices_
protected

Vector of meta indices acting as index cache.