35 #ifndef OPENMS_FILTERING_DATAREDUCTION_DATAFILTERS_H 36 #define OPENMS_FILTERING_DATAREDUCTION_DATAFILTERS_H 44 class ConsensusFeature;
103 void fromString(
const String & filter);
106 bool operator==(
const DataFilter & rhs)
const;
109 bool operator!=(
const DataFilter & rhs)
const;
131 void remove(
Size index);
144 void setActive(
bool is_active);
158 bool passes(
const Feature & feature)
const;
164 template <
class PeakType>
167 if (!is_active_)
return true;
169 for (
Size i = 0; i < filters_.size(); i++)
172 if (filter.
field == INTENSITY)
177 if (spectrum[peak_index].getIntensity() < filter.
value)
return false;
182 if (spectrum[peak_index].getIntensity() != filter.
value)
return false;
187 if (spectrum[peak_index].getIntensity() > filter.
value)
return false;
195 else if (filter.
field == META_DATA)
200 for (
Size j = 0; j < f_arrays.size(); ++j)
202 if (f_arrays[j].getName() == filter.
meta_name)
211 if (filter.
op == EQUAL && f_arrays[f_index][peak_index] != filter.
value)
return false;
212 else if (filter.
op == LESS_EQUAL && f_arrays[f_index][peak_index] > filter.
value)
return false;
213 else if (filter.
op == GREATER_EQUAL && f_arrays[f_index][peak_index] < filter.
value)
return false;
220 for (
Size j = 0; j < i_arrays.size(); ++j)
222 if (i_arrays[j].getName() == filter.
meta_name)
231 if (filter.
op == EQUAL && i_arrays[i_index][peak_index] != filter.
value)
return false;
232 else if (filter.
op == LESS_EQUAL && i_arrays[i_index][peak_index] > filter.
value)
return false;
233 else if (filter.
op == GREATER_EQUAL && i_arrays[i_index][peak_index] < filter.
value)
return false;
237 if (f_index == -1 && i_index == -1)
return false;
256 else if (filter.
op != EXISTS)
265 if (filter.
op != EQUAL)
return false;
274 if (filter.
op == EQUAL && (
double)data_value != filter.
value)
return false;
275 else if (filter.
op == LESS_EQUAL && (
double)data_value > filter.
value)
return false;
276 else if (filter.
op == GREATER_EQUAL && (
double)data_value < filter.
value)
return false;
bool passes(const MSSpectrum< PeakType > &spectrum, Size peak_index) const
Returns if the peak fulfills the current filter criteria.
Definition: DataFilters.h:165
Filter the intensity value.
Definition: DataFilters.h:59
A more convenient string class.
Definition: String.h:57
FilterOperation
Filter operation.
Definition: DataFilters.h:66
String toString() const
Conversion to String.
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:128
std::vector< Size > meta_indices_
Vector of meta indices acting as index cache.
Definition: DataFilters.h:247
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
const IntegerDataArrays & getIntegerDataArrays() const
Returns a const reference to the integer meta data arrays.
Definition: MSSpectrum.h:322
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:57
FilterType
Information to filter.
Definition: DataFilters.h:57
Representation of a peak/feature filter combining FilterType, FilterOperation and a value...
Definition: DataFilters.h:75
Equal to the value.
Definition: DataFilters.h:69
DataType valueType() const
returns the type of value stored
Definition: DataValue.h:351
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...
Definition: DataFilters.h:253
FilterType field
Field to filter.
Definition: DataFilters.h:81
double value
Value for comparison.
Definition: DataFilters.h:85
std::vector< DataFilter > filters_
Array of DataFilters.
Definition: DataFilters.h:245
string value
Definition: DataValue.h:68
An LC-MS feature.
Definition: Feature.h:70
Filter the charge value.
Definition: DataFilters.h:61
bool isActive() const
Returns if the filters are enabled.
Definition: DataFilters.h:152
String value_string
String value for comparison (for meta data)
Definition: DataFilters.h:87
FilterOperation op
Filter operation.
Definition: DataFilters.h:83
String meta_name
Name of the considered meta information.
Definition: DataFilters.h:89
Filter the overall quality value.
Definition: DataFilters.h:60
DataFilter array providing some convenience functions.
Definition: DataFilters.h:51
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
Definition: MSSpectrum.h:298
String toString(T i)
toString functions (single argument)
Definition: StringUtils.h:68
Greater than the value or equal to the value.
Definition: DataFilters.h:68
bool value_is_numerical
Bool value that indicates if the specified value is numerical.
Definition: DataFilters.h:91
bool is_active_
Determines if the filters are activated.
Definition: DataFilters.h:250
Less than the value or equal to the value.
Definition: DataFilters.h:70
A 2-dimensional consensus feature.
Definition: ConsensusFeature.h:65
empty value
Definition: DataValue.h:74
Filter the number of subordinates/elements.
Definition: DataFilters.h:62