19 class ConsensusFeature;
58 : field(type), op(op), value(val), value_string(), meta_name(meta_name), value_is_numerical(true)
62 : field(type), op(op), value(0.0), value_string(val), meta_name(meta_name), value_is_numerical(false)
75 bool value_is_numerical{
false };
150 if (!is_active_)
return true;
152 for (
Size i = 0; i < filters_.size(); i++)
155 if (filter.
field == INTENSITY)
160 if (spectrum[peak_index].getIntensity() < filter.
value)
return false;
165 if (spectrum[peak_index].getIntensity() != filter.
value)
return false;
170 if (spectrum[peak_index].getIntensity() > filter.
value)
return false;
178 else if (filter.
field == META_DATA)
183 for (
Size j = 0; j < f_arrays.size(); ++j)
185 if (f_arrays[j].getName() == filter.
meta_name)
194 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
195 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
196 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
203 for (
Size j = 0; j < i_arrays.size(); ++j)
205 if (i_arrays[j].getName() == filter.
meta_name)
214 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
215 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
216 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
220 if (f_index == -1 && i_index == -1)
return false;
229 if (!is_active_)
return true;
231 for (
Size i = 0; i < filters_.size(); i++)
234 if (filter.
field == INTENSITY)
239 if (chrom[peak_index].getIntensity() < filter.
value)
245 if (chrom[peak_index].getIntensity() != filter.
value)
251 if (chrom[peak_index].getIntensity() > filter.
value)
260 else if (filter.
field == META_DATA)
265 for (
Size j = 0; j < f_arrays.size(); ++j)
267 if (f_arrays[j].getName() == filter.
meta_name)
276 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
277 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
278 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
285 for (
Size j = 0; j < i_arrays.size(); ++j)
287 if (i_arrays[j].getName() == filter.
meta_name)
296 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
297 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
298 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
302 if (f_index == -1 && i_index == -1)
return false;
316 for (
Size i = 0; i < filters_.size(); i++)
319 if (filter.
field == INTENSITY)
324 if (mobilogram[peak_index].getIntensity() < filter.
value)
330 if (mobilogram[peak_index].getIntensity() != filter.
value)
336 if (mobilogram[peak_index].getIntensity() > filter.
value)
345 else if (filter.
field == META_DATA)
360 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:136
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:309
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:227
bool operator==(const DataFilters &) const =default
Equality operator.
void setActive(bool is_active)
Enables/disables the all the filters.
FilterType
Information to filter.
Definition: DataFilters.h:36
@ INTENSITY
Filter the intensity value.
Definition: DataFilters.h:37
@ SIZE
Filter the number of subordinates/elements.
Definition: DataFilters.h:40
@ QUALITY
Filter the overall quality value.
Definition: DataFilters.h:38
@ CHARGE
Filter the charge value.
Definition: DataFilters.h:39
FilterOperation
Filter operation.
Definition: DataFilters.h:45
@ GREATER_EQUAL
Greater than the value or equal to the value.
Definition: DataFilters.h:46
@ EQUAL
Equal to the value.
Definition: DataFilters.h:47
@ LESS_EQUAL
Less than the value or equal to the value.
Definition: DataFilters.h:48
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:148
std::vector< DataFilter > filters_
Array of DataFilters.
Definition: DataFilters.h:355
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:357
An LC-MS feature.
Definition: Feature.h:46
The representation of a chromatogram.
Definition: MSChromatogram.h:30
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:32
A more convenient string class.
Definition: String.h:34
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:104
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Representation of a peak/feature filter combining FilterType, FilterOperation and a value (either dou...
Definition: DataFilters.h:54
DataFilter(const FilterType type, const FilterOperation op, const String &val, const String &meta_name="")
ctor for common case of string filter
Definition: DataFilters.h:61
String toString() const
Returns a string representation of the filter.
bool operator==(const DataFilter &rhs) const
Equality operator.
DataFilter()
Definition: DataFilters.h:55
FilterType field
Field to filter.
Definition: DataFilters.h:65
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:73
bool operator!=(const DataFilter &rhs) const
Inequality operator.
String value_string
String value for comparison (for meta data)
Definition: DataFilters.h:71
DataFilter(const FilterType type, const FilterOperation op, const double val, const String &meta_name="")
ctor for common case of numerical filter
Definition: DataFilters.h:57
FilterOperation op
Filter operation.
Definition: DataFilters.h:67
double value
Value for comparison.
Definition: DataFilters.h:69