19 class ConsensusFeature;
55 : field(type), op(op), value(val), value_string(), meta_name(meta_name), value_is_numerical(true)
59 : field(type), op(op), value(0.0), value_string(val), meta_name(meta_name), value_is_numerical(false)
72 bool value_is_numerical{
false };
147 if (!is_active_)
return true;
149 for (
Size i = 0; i < filters_.size(); i++)
152 if (filter.
field == INTENSITY)
157 if (spectrum[peak_index].getIntensity() < filter.
value)
return false;
162 if (spectrum[peak_index].getIntensity() != filter.
value)
return false;
167 if (spectrum[peak_index].getIntensity() > filter.
value)
return false;
175 else if (filter.
field == META_DATA)
180 for (
Size j = 0; j < f_arrays.size(); ++j)
182 if (f_arrays[j].getName() == filter.
meta_name)
191 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
192 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
193 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
200 for (
Size j = 0; j < i_arrays.size(); ++j)
202 if (i_arrays[j].getName() == filter.
meta_name)
211 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
212 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
213 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
217 if (f_index == -1 && i_index == -1)
return false;
226 if (!is_active_)
return true;
228 for (
Size i = 0; i < filters_.size(); i++)
231 if (filter.
field == INTENSITY)
236 if (chrom[peak_index].getIntensity() < filter.
value)
242 if (chrom[peak_index].getIntensity() != filter.
value)
248 if (chrom[peak_index].getIntensity() > filter.
value)
257 else if (filter.
field == META_DATA)
262 for (
Size j = 0; j < f_arrays.size(); ++j)
264 if (f_arrays[j].getName() == filter.
meta_name)
273 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
274 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
275 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
282 for (
Size j = 0; j < i_arrays.size(); ++j)
284 if (i_arrays[j].getName() == filter.
meta_name)
293 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
294 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
295 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
299 if (f_index == -1 && i_index == -1)
return false;
313 for (
Size i = 0; i < filters_.size(); i++)
316 if (filter.
field == INTENSITY)
321 if (mobilogram[peak_index].getIntensity() < filter.
value)
327 if (mobilogram[peak_index].getIntensity() != filter.
value)
333 if (mobilogram[peak_index].getIntensity() > filter.
value)
342 else if (filter.
field == META_DATA)
357 bool is_active_ =
false;
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:45
DataFilter array providing some convenience functions.
Definition: DataFilters.h:27
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:133
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:306
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:224
void setActive(bool is_active)
Enables/disables the all the filters.
FilterType
Information to filter.
Definition: DataFilters.h:33
@ INTENSITY
Filter the intensity value.
Definition: DataFilters.h:34
@ SIZE
Filter the number of subordinates/elements.
Definition: DataFilters.h:37
@ QUALITY
Filter the overall quality value.
Definition: DataFilters.h:35
@ CHARGE
Filter the charge value.
Definition: DataFilters.h:36
FilterOperation
Filter operation.
Definition: DataFilters.h:42
@ GREATER_EQUAL
Greater than the value or equal to the value.
Definition: DataFilters.h:43
@ EQUAL
Equal to the value.
Definition: DataFilters.h:44
@ LESS_EQUAL
Less than the value or equal to the value.
Definition: DataFilters.h:45
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:145
std::vector< DataFilter > filters_
Array of DataFilters.
Definition: DataFilters.h:352
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:354
An LC-MS feature.
Definition: Feature.h:46
The representation of a chromatogram.
Definition: MSChromatogram.h:31
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:44
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:102
The representation of a 1D ion mobilogram.
Definition: Mobilogram.h:29
A more convenient string class.
Definition: String.h:34
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:108
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Representation of a peak/feature filter combining FilterType, FilterOperation and a value (either dou...
Definition: DataFilters.h:51
DataFilter(const FilterType type, const FilterOperation op, const String &val, const String &meta_name="")
ctor for common case of string filter
Definition: DataFilters.h:58
String toString() const
Returns a string representation of the filter.
bool operator==(const DataFilter &rhs) const
Equality operator.
DataFilter()
Definition: DataFilters.h:52
FilterType field
Field to filter.
Definition: DataFilters.h:62
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:70
bool operator!=(const DataFilter &rhs) const
Inequality operator.
String value_string
String value for comparison (for meta data)
Definition: DataFilters.h:68
DataFilter(const FilterType type, const FilterOperation op, const double val, const String &meta_name="")
ctor for common case of numerical filter
Definition: DataFilters.h:54
FilterOperation op
Filter operation.
Definition: DataFilters.h:64
double value
Value for comparison.
Definition: DataFilters.h:66