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();
170 template <
class SpectrumType>
172 std::unary_function<SpectrumType, bool>
189 Int tmp = s.getMSLevel();
206 template <
class SpectrumType>
208 std::unary_function<SpectrumType, bool>
226 return reverse_ ^ (s.getInstrumentSettings().getScanMode() ==
mode_);
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>
326 return reverse_ ^ s.getInstrumentSettings().getZoomScan();
342 template <
class SpectrumType>
344 std::unary_function<SpectrumType, bool>
361 for (std::vector<Precursor>::const_iterator it = s.getPrecursors().begin(); it != s.getPrecursors().end(); ++it)
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>
414 for (std::vector<Precursor>::const_iterator it = s.getPrecursors().begin(); it != s.getPrecursors().end(); ++it)
417 if (!(mz_left_ <= it->getMZ() && it->getMZ() <=
mz_right_))
443 template <
class SpectrumType>
445 std::unary_function<SpectrumType, bool>
463 for (std::vector<Precursor>::const_iterator it = s.getPrecursors().begin(); it != s.getPrecursors().end(); ++it)
465 Int tmp = it->getCharge();
488 template <
class PeakType>
490 std::unary_function<PeakType, bool>
501 InMzRange(
double min,
double max,
bool reverse =
false) :
526 template <
class PeakType>
528 std::unary_function<PeakType, bool>
563 template <
class SpectrumType>
565 std::unary_function<SpectrumType, bool>
584 if (s.getMSLevel() == 1)
return false;
587 bool hasCollisionEnergy =
false;
588 for (std::vector<Precursor>::const_iterator it = s.getPrecursors().begin(); it != s.getPrecursors().end(); ++it)
590 if (it->metaValueExists(
"collision energy"))
592 hasCollisionEnergy =
true;
593 double cE = it->getMetaValue(
"collision energy");
599 if (!hasCollisionEnergy)
return false;
616 template <
class SpectrumType>
618 std::unary_function<SpectrumType, bool>
638 if (s.getMSLevel() == 1)
return false;
641 for (std::vector<Precursor>::const_iterator it = s.getPrecursors().begin(); it != s.getPrecursors().end(); ++it)
643 const double isolationWindowSize = it->getIsolationWindowUpperOffset() + it->getIsolationWindowLowerOffset();
662 template <
class SpectrumType>
664 std::unary_function<SpectrumType, bool>
684 if (s.getMSLevel() == 1)
return false;
687 for (std::vector<Precursor>::const_iterator it = s.getPrecursors().begin(); it != s.getPrecursors().end(); ++it)
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);
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
PositionType const & getPosition() const
Non-mutable access to the position.
Definition: Peak2D.h:179
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
double max_size_
Definition: RangeUtils.h:652
IntensityType getIntensity() const
Definition: Peak2D.h:167
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 operator()(const SpectrumType &s) const
Definition: RangeUtils.h:359
bool reverse_
Definition: RangeUtils.h:382
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:412
bool reverse_
Definition: RangeUtils.h:231
bool reverse_
Definition: RangeUtils.h:653
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:59
double min_energy_
Definition: RangeUtils.h:606
bool operator()(const PeakType &p) const
Definition: RangeUtils.h:544
double max_energy_
Definition: RangeUtils.h:606
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
bool operator()(const PeakType &p) const
Definition: RangeUtils.h:507
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:635
static const std::string NamesOfActivationMethod[SIZE_OF_ACTIVATIONMETHOD]
Names of activation methods.
Definition: Precursor.h:82
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
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:291
#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 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
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:151
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
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 reverse_
Definition: RangeUtils.h:708
double max_
Definition: RangeUtils.h:515
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:681
double max_
Definition: RangeUtils.h:552
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
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:223
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:460
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:258
Predicate that determines if a spectrum has a certain scan polarity.
Definition: RangeUtils.h:242
Int mode_
Definition: RangeUtils.h:230
bool reverse_
Definition: RangeUtils.h:553
double mz_right_
Definition: RangeUtils.h:430
IntList charges_
Definition: RangeUtils.h:474
StringList methods_
Definition: RangeUtils.h:381
double max_
Definition: RangeUtils.h:159
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:323
InIntensityRange(double min, double max, bool reverse=false)
Constructor.
Definition: RangeUtils.h:538
HasActivationMethod(const StringList &methods, bool reverse=false)
Constructor.
Definition: RangeUtils.h:354
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
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:581
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
bool operator()(const SpectrumType &s) const
Definition: RangeUtils.h:187
int Int
Signed integer type.
Definition: Types.h:103
double min_
Definition: RangeUtils.h:159
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