18 class ConsensusFeature;
57 : field(type), op(op), value(val), value_string(), meta_name(meta_name), value_is_numerical(true)
61 : field(type), op(op), value(0.0), value_string(val), meta_name(meta_name), value_is_numerical(false)
74 bool value_is_numerical{
false };
149 if (!is_active_)
return true;
151 for (
Size i = 0; i < filters_.size(); i++)
154 if (filter.
field == INTENSITY)
159 if (spectrum[peak_index].getIntensity() < filter.
value)
return false;
164 if (spectrum[peak_index].getIntensity() != filter.
value)
return false;
169 if (spectrum[peak_index].getIntensity() > filter.
value)
return false;
177 else if (filter.
field == META_DATA)
182 for (
Size j = 0; j < f_arrays.size(); ++j)
184 if (f_arrays[j].getName() == filter.
meta_name)
193 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
194 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
195 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
202 for (
Size j = 0; j < i_arrays.size(); ++j)
204 if (i_arrays[j].getName() == filter.
meta_name)
213 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
214 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
215 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
219 if (f_index == -1 && i_index == -1)
return false;
228 if (!is_active_)
return true;
230 for (
Size i = 0; i < filters_.size(); i++)
233 if (filter.
field == INTENSITY)
238 if (chrom[peak_index].getIntensity() < filter.
value)
244 if (chrom[peak_index].getIntensity() != filter.
value)
250 if (chrom[peak_index].getIntensity() > filter.
value)
259 else if (filter.
field == META_DATA)
264 for (
Size j = 0; j < f_arrays.size(); ++j)
266 if (f_arrays[j].getName() == filter.
meta_name)
275 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
276 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
277 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
284 for (
Size j = 0; j < i_arrays.size(); ++j)
286 if (i_arrays[j].getName() == filter.
meta_name)
295 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
296 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
297 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
301 if (f_index == -1 && i_index == -1)
return false;
315 for (
Size i = 0; i < filters_.size(); i++)
318 if (filter.
field == INTENSITY)
323 if (mobilogram[peak_index].getIntensity() < filter.
value)
329 if (mobilogram[peak_index].getIntensity() != filter.
value)
335 if (mobilogram[peak_index].getIntensity() > filter.
value)
344 else if (filter.
field == META_DATA)
359 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:26
const DataFilter & operator[](Size index) const
Filter accessor.
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:135
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:308
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:226
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:35
@ INTENSITY
Filter the intensity value.
Definition DataFilters.h:36
@ SIZE
Filter the number of subordinates/elements.
Definition DataFilters.h:39
@ QUALITY
Filter the overall quality value.
Definition DataFilters.h:37
@ CHARGE
Filter the charge value.
Definition DataFilters.h:38
FilterOperation
Filter operation.
Definition DataFilters.h:44
@ GREATER_EQUAL
Greater than the value or equal to the value.
Definition DataFilters.h:45
@ EQUAL
Equal to the value.
Definition DataFilters.h:46
@ LESS_EQUAL
Less than the value or equal to the value.
Definition DataFilters.h:47
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:147
std::vector< DataFilter > filters_
Array of DataFilters.
Definition DataFilters.h:354
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.
std::vector< Size > meta_indices_
Vector of meta indices acting as index cache.
Definition DataFilters.h:356
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:112
The representation of a 1D ion mobilogram.
Definition Mobilogram.h:32
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:53
DataFilter(const FilterType type, const FilterOperation op, const std::string &val, const std::string &meta_name="")
ctor for common case of string filter
Definition DataFilters.h:60
std::string toString() const
Returns a string representation of the filter.
bool operator==(const DataFilter &rhs) const
Equality operator.
DataFilter()
Definition DataFilters.h:54
DataFilter(const FilterType type, const FilterOperation op, const double val, const std::string &meta_name="")
ctor for common case of numerical filter
Definition DataFilters.h:56
void fromString(const std::string &filter)
Parses filter and sets the filter properties accordingly.
FilterType field
Field to filter.
Definition DataFilters.h:64
bool operator!=(const DataFilter &rhs) const
Inequality operator.
std::string meta_name
Name of the considered meta information (key)
Definition DataFilters.h:72
std::string value_string
std::string value for comparison (for meta data)
Definition DataFilters.h:70
FilterOperation op
Filter operation.
Definition DataFilters.h:66
double value
Value for comparison.
Definition DataFilters.h:68