43 class ConsensusFeature;
79 : field(type), op(op), value(val), value_string(), meta_name(meta_name), value_is_numerical(true)
83 : field(type), op(op), value(0.0), value_string(val), meta_name(meta_name), value_is_numerical(false)
96 bool value_is_numerical{
false };
171 if (!is_active_)
return true;
173 for (
Size i = 0; i < filters_.size(); i++)
176 if (filter.
field == INTENSITY)
181 if (spectrum[peak_index].getIntensity() < filter.
value)
return false;
186 if (spectrum[peak_index].getIntensity() != filter.
value)
return false;
191 if (spectrum[peak_index].getIntensity() > filter.
value)
return false;
199 else if (filter.
field == META_DATA)
204 for (
Size j = 0; j < f_arrays.size(); ++j)
206 if (f_arrays[j].getName() == filter.
meta_name)
215 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
216 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
217 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
224 for (
Size j = 0; j < i_arrays.size(); ++j)
226 if (i_arrays[j].getName() == filter.
meta_name)
235 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
236 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
237 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
241 if (f_index == -1 && i_index == -1)
return false;
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:71
DataFilter array providing some convenience functions.
Definition: DataFilters.h:51
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:157
void add(const DataFilter &filter)
Adds a filter.
void replace(Size index, const DataFilter &filter)
Replaces the filter corresponding to index.
void remove(Size index)
Removes the filter corresponding to index.
bool is_active_
Determines if the filters are activated.
Definition: DataFilters.h:254
void setActive(bool is_active)
Enables/disables the all the filters.
FilterType
Information to filter.
Definition: DataFilters.h:57
@ INTENSITY
Filter the intensity value.
Definition: DataFilters.h:58
@ SIZE
Filter the number of subordinates/elements.
Definition: DataFilters.h:61
@ QUALITY
Filter the overall quality value.
Definition: DataFilters.h:59
@ CHARGE
Filter the charge value.
Definition: DataFilters.h:60
FilterOperation
Filter operation.
Definition: DataFilters.h:66
@ GREATER_EQUAL
Greater than the value or equal to the value.
Definition: DataFilters.h:67
@ EQUAL
Equal to the value.
Definition: DataFilters.h:68
@ LESS_EQUAL
Less than the value or equal to the value.
Definition: DataFilters.h:69
bool passes(const MSSpectrum &spectrum, Size peak_index) const
Returns if the peak fulfills the current filter criteria.
Definition: DataFilters.h:169
std::vector< DataFilter > filters_
Array of DataFilters.
Definition: DataFilters.h:249
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:251
An LC-MS feature.
Definition: Feature.h:72
The representation of a 1D spectrum.
Definition: MSSpectrum.h:71
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< FloatDataArray > FloatDataArrays
Definition: MSSpectrum.h:114
std::vector< IntegerDataArray > IntegerDataArrays
Definition: MSSpectrum.h:120
A more convenient string class.
Definition: String.h:61
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:47
Representation of a peak/feature filter combining FilterType, FilterOperation and a value (either dou...
Definition: DataFilters.h:75
DataFilter(const FilterType type, const FilterOperation op, const String &val, const String &meta_name="")
ctor for common case of string filter
Definition: DataFilters.h:82
String toString() const
Returns a string representation of the filter.
bool operator==(const DataFilter &rhs) const
Equality operator.
DataFilter()
Definition: DataFilters.h:76
FilterType field
Field to filter.
Definition: DataFilters.h:86
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:94
bool operator!=(const DataFilter &rhs) const
Inequality operator.
String value_string
String value for comparison (for meta data)
Definition: DataFilters.h:92
DataFilter(const FilterType type, const FilterOperation op, const double val, const String &meta_name="")
ctor for common case of numerical filter
Definition: DataFilters.h:78
FilterOperation op
Filter operation.
Definition: DataFilters.h:88
double value
Value for comparison.
Definition: DataFilters.h:90