45 class ConsensusFeature;
81 : field(type), op(op), value(val), value_string(), meta_name(meta_name), value_is_numerical(true)
85 : field(type), op(op), value(0.0), value_string(val), meta_name(meta_name), value_is_numerical(false)
98 bool value_is_numerical{
false };
173 if (!is_active_)
return true;
175 for (
Size i = 0; i < filters_.size(); i++)
178 if (filter.
field == INTENSITY)
183 if (spectrum[peak_index].getIntensity() < filter.
value)
return false;
188 if (spectrum[peak_index].getIntensity() != filter.
value)
return false;
193 if (spectrum[peak_index].getIntensity() > filter.
value)
return false;
201 else if (filter.
field == META_DATA)
206 for (
Size j = 0; j < f_arrays.size(); ++j)
208 if (f_arrays[j].getName() == filter.
meta_name)
217 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
218 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
219 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
226 for (
Size j = 0; j < i_arrays.size(); ++j)
228 if (i_arrays[j].getName() == filter.
meta_name)
237 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
238 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
239 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
243 if (f_index == -1 && i_index == -1)
return false;
252 if (!is_active_)
return true;
254 for (
Size i = 0; i < filters_.size(); i++)
257 if (filter.
field == INTENSITY)
262 if (chrom[peak_index].getIntensity() < filter.
value)
268 if (chrom[peak_index].getIntensity() != filter.
value)
274 if (chrom[peak_index].getIntensity() > filter.
value)
283 else if (filter.
field == META_DATA)
288 for (
Size j = 0; j < f_arrays.size(); ++j)
290 if (f_arrays[j].getName() == filter.
meta_name)
299 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
300 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
301 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
308 for (
Size j = 0; j < i_arrays.size(); ++j)
310 if (i_arrays[j].getName() == filter.
meta_name)
319 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
320 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
321 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
325 if (f_index == -1 && i_index == -1)
return false;
339 for (
Size i = 0; i < filters_.size(); i++)
342 if (filter.
field == INTENSITY)
347 if (mobilogram[peak_index].getIntensity() < filter.
value)
353 if (mobilogram[peak_index].getIntensity() != filter.
value)
359 if (mobilogram[peak_index].getIntensity() > filter.
value)
368 else if (filter.
field == META_DATA)
383 bool is_active_ =
false;
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:71
DataFilter array providing some convenience functions.
Definition: DataFilters.h:53
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.
bool passes(const ConsensusFeature &consensus_feature) const
Returns if the consensus_feature fulfills the current filter criteria.
bool isActive() const
Returns if the filters are enabled.
Definition: DataFilters.h:159
void add(const DataFilter &filter)
Adds a filter.
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.
Definition: DataFilters.h:332
void replace(Size index, const DataFilter &filter)
Replaces the filter corresponding to index.
void remove(Size index)
Removes the filter corresponding to index.
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.
Definition: DataFilters.h:250
void setActive(bool is_active)
Enables/disables the all the filters.
FilterType
Information to filter.
Definition: DataFilters.h:59
@ INTENSITY
Filter the intensity value.
Definition: DataFilters.h:60
@ SIZE
Filter the number of subordinates/elements.
Definition: DataFilters.h:63
@ QUALITY
Filter the overall quality value.
Definition: DataFilters.h:61
@ CHARGE
Filter the charge value.
Definition: DataFilters.h:62
FilterOperation
Filter operation.
Definition: DataFilters.h:68
@ GREATER_EQUAL
Greater than the value or equal to the value.
Definition: DataFilters.h:69
@ EQUAL
Equal to the value.
Definition: DataFilters.h:70
@ LESS_EQUAL
Less than the value or equal to the value.
Definition: DataFilters.h:71
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.
Definition: DataFilters.h:171
std::vector< DataFilter > filters_
Array of DataFilters.
Definition: DataFilters.h:378
void clear()
Removes all filters.
Size size() const
Filter count.
bool passes(const Feature &feature) const
Returns if the feature fulfills the current filter criteria.
const DataFilter & operator[](Size index) const
Filter accessor.
std::vector< Size > meta_indices_
Vector of meta indices acting as index cache.
Definition: DataFilters.h:380
An LC-MS feature.
Definition: Feature.h:72
The representation of a chromatogram.
Definition: MSChromatogram.h:57
const IntegerDataArrays & getIntegerDataArrays() const
Returns a const reference to the integer meta data arrays.
const FloatDataArrays & getFloatDataArrays() const
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
const IntegerDataArrays & getIntegerDataArrays() const
Returns a const reference to the integer meta data arrays.
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
std::vector< IntegerDataArray > IntegerDataArrays
Definition: MSSpectrum.h:128
The representation of a 1D ion mobilogram.
Definition: Mobilogram.h:55
A more convenient string class.
Definition: String.h:60
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
Representation of a peak/feature filter combining FilterType, FilterOperation and a value (either dou...
Definition: DataFilters.h:77
DataFilter(const FilterType type, const FilterOperation op, const String &val, const String &meta_name="")
ctor for common case of string filter
Definition: DataFilters.h:84
String toString() const
Returns a string representation of the filter.
bool operator==(const DataFilter &rhs) const
Equality operator.
DataFilter()
Definition: DataFilters.h:78
FilterType field
Field to filter.
Definition: DataFilters.h:88
void fromString(const String &filter)
Parses filter and sets the filter properties accordingly.
String meta_name
Name of the considered meta information (key)
Definition: DataFilters.h:96
bool operator!=(const DataFilter &rhs) const
Inequality operator.
String value_string
String value for comparison (for meta data)
Definition: DataFilters.h:94
DataFilter(const FilterType type, const FilterOperation op, const double val, const String &meta_name="")
ctor for common case of numerical filter
Definition: DataFilters.h:80
FilterOperation op
Filter operation.
Definition: DataFilters.h:90
double value
Value for comparison.
Definition: DataFilters.h:92