35 #ifndef OPENMS_KERNEL_RANGEUTILS_H 36 #define OPENMS_KERNEL_RANGEUTILS_H 96 template <
class MetaContainer>
98 std::unary_function<MetaContainer, bool>
132 template <
class SpectrumType>
134 std::unary_function<SpectrumType, bool>
145 InRTRange(
double min,
double max,
bool reverse =
false) :
153 double tmp = s.
getRT();
155 return reverse_ ^ (min_ <= tmp && tmp <= max_);
170 template <
class SpectrumType>
172 std::unary_function<SpectrumType, bool>
191 return reverse_ ^ std::find(levels_.begin(), levels_.end(), tmp) != levels_.end();
206 template <
class SpectrumType>
208 std::unary_function<SpectrumType, bool>
241 template <
class SpectrumType>
243 std::unary_function<SpectrumType, bool>
277 template <
class SpectrumType>
279 std::unary_function<SpectrumType, bool>
308 template <
class SpectrumType>
310 std::unary_function<SpectrumType, bool>
342 template <
class SpectrumType>
344 std::unary_function<SpectrumType, bool>
363 for (std::set<Precursor::ActivationMethod>::const_iterator it_a = it->getActivationMethods().begin();
364 it_a != it->getActivationMethods().end();
394 template <
class SpectrumType>
396 std::unary_function<SpectrumType, bool>
417 if (!(mz_left_ <= it->getMZ() && it->getMZ() <= mz_right_))
443 template <
class SpectrumType>
445 std::unary_function<SpectrumType, bool>
465 Int tmp = it->getCharge();
466 match = match || (std::find(charges_.begin(), charges_.end(), tmp) != charges_.end());
488 template <
class PeakType>
490 std::unary_function<PeakType, bool>
501 InMzRange(
double min,
double max,
bool reverse =
false) :
511 return reverse_ ^ (min_ <= tmp && tmp <= max_);
526 template <
class PeakType>
528 std::unary_function<PeakType, bool>
548 return reverse_ ^ (min_ <= tmp && tmp <= max_);
563 template <
class SpectrumType>
565 std::unary_function<SpectrumType, bool>
587 bool hasCollisionEnergy =
false;
590 if (it->metaValueExists(
"collision energy"))
592 hasCollisionEnergy =
true;
593 double cE = it->getMetaValue(
"collision energy");
594 isIn |= !(cE > max_energy_ || cE < min_energy_);
599 if (!hasCollisionEnergy)
return false;
616 template <
class SpectrumType>
618 std::unary_function<SpectrumType, bool>
643 const double isolationWindowSize = it->getIsolationWindowUpperOffset() + it->getIsolationWindowLowerOffset();
644 isIn |= !(isolationWindowSize > max_size_ || isolationWindowSize < min_size_);
662 template <
class SpectrumType>
664 std::unary_function<SpectrumType, bool>
678 std::sort(vec_mz_.begin(), vec_mz_.end());
689 if (it->getIsolationWindowLowerOffset() == 0 || it->getIsolationWindowLowerOffset() == 0)
691 LOG_WARN <<
"IsInIsolationWindow(): Lower/Upper Offset for Precursor Isolation Window is Zero! Filtering will probably be too strict (unless you hit the exact precursor m/z)!" << std::endl;
693 const double lower_mz = it->getMZ() - it->getIsolationWindowLowerOffset();
694 std::vector<double>::const_iterator it_mz = std::lower_bound(vec_mz_.begin(), vec_mz_.end(), lower_mz);
695 if (it_mz != vec_mz_.end())
697 const double upper_mz = it->getMZ() + it->getIsolationWindowUpperOffset();
698 isIn |= (*it_mz <= upper_mz);
713 #endif // OPENMS_KERNEL_RANGEUTILS_H
IsInIsolationWindowSizeRange(double min_size, double max_size, bool reverse=false)
Constructor.
Definition: RangeUtils.h:629
IntList levels_
Definition: RangeUtils.h:195
Predicate that determines if a spectrum lies inside/outside a specific retention time range...
Definition: RangeUtils.h:133
double min_
Definition: RangeUtils.h:515
bool reverse_
Definition: RangeUtils.h:607
InMSLevelRange(const IntList &levels, bool reverse=false)
Constructor.
Definition: RangeUtils.h:182
bool reverse_
Definition: RangeUtils.h:298
A more convenient string class.
Definition: String.h:57
A 2-dimensional raw data point or peak.
Definition: Peak2D.h:55
HasScanPolarity(Int polarity, bool reverse=false)
Constructor.
Definition: RangeUtils.h:253
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:323
IsInCollisionEnergyRange(double min, double max, bool reverse=false)
Constructor.
Definition: RangeUtils.h:575
std::vector< double > vec_mz_
Definition: RangeUtils.h:707
Predicate that determines if a spectrum has a certain scan mode.
Definition: RangeUtils.h:207
bool reverse_
Definition: RangeUtils.h:382
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:151
ScanMode getScanMode() const
returns the scan mode
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:359
bool reverse_
Definition: RangeUtils.h:231
const InstrumentSettings & getInstrumentSettings() const
returns a const reference to the instrument settings of the current spectrum
bool reverse_
Definition: RangeUtils.h:653
bool operator()(const PeakType &p) const
Definition: RangeUtils.h:544
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:59
bool getZoomScan() const
return if this scan is a zoom (enhanced resolution) scan
double min_energy_
Definition: RangeUtils.h:606
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
IntensityType getIntensity() const
Definition: Peak2D.h:167
static const std::string NamesOfActivationMethod[SIZE_OF_ACTIVATIONMETHOD]
Names of activation methods.
Definition: Precursor.h:85
Predicate that determines if the isolation window covers ANY of the given m/z values.
Definition: RangeUtils.h:663
InMzRange(double min, double max, bool reverse=false)
Constructor.
Definition: RangeUtils.h:501
#define LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged...
Definition: LogStream.h:451
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:460
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:291
bool reverse_
Definition: RangeUtils.h:431
InRTRange(double min, double max, bool reverse=false)
Constructor.
Definition: RangeUtils.h:145
HasScanMode(Int mode, bool reverse=false)
Constructor.
Definition: RangeUtils.h:218
IsInIsolationWindow(std::vector< double > vec_mz, bool reverse=false)
Constructor.
Definition: RangeUtils.h:674
IsZoomSpectrum(bool reverse=false)
Constructor.
Definition: RangeUtils.h:319
Predicate that determines if a spectrum lies inside/outside a specific MS level set.
Definition: RangeUtils.h:171
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
double min_size_
Definition: RangeUtils.h:652
IsEmptySpectrum(bool reverse=false)
Constructor.
Definition: RangeUtils.h:287
bool reverse_
Definition: RangeUtils.h:160
double min_
Definition: RangeUtils.h:552
bool operator()(const PeakType &p) const
Definition: RangeUtils.h:507
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:635
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:412
bool reverse_
Definition: RangeUtils.h:708
Predicate that determines if a spectrum has a certain precursor charge as given in the constructor li...
Definition: RangeUtils.h:444
bool reverse_
Definition: RangeUtils.h:266
bool reverse_
Definition: RangeUtils.h:330
Predicate that determines if a peak lies inside/outside a specific intensity range.
Definition: RangeUtils.h:527
InPrecursorMZRange(const double &mz_left, const double &mz_right, bool reverse=false)
Constructor.
Definition: RangeUtils.h:406
bool reverse_
Definition: RangeUtils.h:196
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:74
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:581
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
Predicate that determines if a spectrum has a certain scan polarity.
Definition: RangeUtils.h:242
Int mode_
Definition: RangeUtils.h:230
PositionType const & getPosition() const
Non-mutable access to the position.
Definition: Peak2D.h:179
bool reverse_
Definition: RangeUtils.h:553
IonSource::Polarity getPolarity() const
returns the polarity
double mz_right_
Definition: RangeUtils.h:430
IntList charges_
Definition: RangeUtils.h:474
StringList methods_
Definition: RangeUtils.h:381
InIntensityRange(double min, double max, bool reverse=false)
Constructor.
Definition: RangeUtils.h:538
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:223
HasActivationMethod(const StringList &methods, bool reverse=false)
Constructor.
Definition: RangeUtils.h:354
UInt getMSLevel() const
Returns the MS level.
Predicate that determines if the width of the isolation window of an MSn spectrum is in the given ran...
Definition: RangeUtils.h:617
bool reverse_
Definition: RangeUtils.h:475
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:187
HasPrecursorCharge(const IntList &charges, bool reverse=false)
Constructor.
Definition: RangeUtils.h:455
Predicate that determines if a peak lies inside/outside a specific m/z range.
Definition: RangeUtils.h:489
Predicate that determines if a spectrum's precursor is within a certain m/z range.
Definition: RangeUtils.h:395
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:258
bool reverse_
Definition: RangeUtils.h:516
Predicate that determines if a spectrum is a zoom (enhanced resolution) spectrum. ...
Definition: RangeUtils.h:309
static bool contains(const std::vector< T > &container, const E &elem)
Checks whether the element elem is contained in the given container.
Definition: ListUtils.h:150
double mz_left_
Definition: RangeUtils.h:429
int Int
Signed integer type.
Definition: Types.h:103
double min_
Definition: RangeUtils.h:159
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:681
Predicate that determines if a spectrum was generated using any activation method given in the constr...
Definition: RangeUtils.h:343
Predicate that determines if an MSn spectrum was generated with a collision energy in the given range...
Definition: RangeUtils.h:564
Predicate that determines if a spectrum is empty.
Definition: RangeUtils.h:278
Int polarity_
Definition: RangeUtils.h:265