35 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEAFIMODULE_H
36 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEAFIMODULE_H
55 template <
typename FeaFiModuleType>
57 std::binary_function<typename FeatureFinderDefs::IndexPair, typename FeatureFinderDefs::IndexPair, bool>
74 return module_.getPeakIntensity(left) <
module_.getPeakIntensity(right);
87 template <
typename FeaFiModuleType>
89 FeatureFinderDefs::IndexSet::const_iterator
91 IntensityIterator(
const FeatureFinderDefs::IndexSet::const_iterator & iter,
const FeaFiModuleType * module) :
97 typename FeaFiModuleType::IntensityType
operator*()
const
99 return module_->getPeakIntensity(FeatureFinderDefs::IndexSet::const_iterator::operator*());
109 template <
typename FeaFiModuleType>
111 FeatureFinderDefs::IndexSet::const_iterator
113 MzIterator(
const FeatureFinderDefs::IndexSet::const_iterator & iter,
const FeaFiModuleType * module) :
119 typename FeaFiModuleType::IntensityType
operator*()
const
121 return module_->getPeakMz(FeatureFinderDefs::IndexSet::const_iterator::operator*());
131 template <
typename FeaFiModuleType>
133 FeatureFinderDefs::IndexSet::const_iterator
135 RtIterator(
const FeatureFinderDefs::IndexSet::const_iterator & iter,
const FeaFiModuleType * module) :
141 typename FeaFiModuleType::IntensityType
operator*()
const
143 return module_->getPeakRt(FeatureFinderDefs::IndexSet::const_iterator::operator*());
156 template <
class PeakType>
194 return (*
map_)[index.first][index.second].getIntensity();
204 return (*
map_)[index.first][index.second].getMZ();
214 return (*
map_)[index.first].getRT();
230 if (index.second + 1 >= (*
map_)[index.first].size())
251 if (index.second == 0)
271 CoordinateType mz_pos = (*map_)[index.first][index.second].getMZ();
272 Size index_first_tmp = index.first;
275 while (index.first <
map_->
size() &&
276 (*map_)[index.first].empty())
291 if (it == (*
map_)[index.first].end())
293 index.second = (*map_)[index.first].size() - 1;
296 else if (it == (*
map_)[index.first].begin())
304 if (it->getMZ() - mz_pos < mz_pos - (it - 1)->getMZ())
306 index.second = it - (*map_)[index.first].begin();
310 index.second = --it - (*map_)[index.first].begin();
330 std::cout <<
"Scan index outside of map!" << std::endl;
331 std::cout << index.first <<
" " << index.second << std::endl;
334 if (index.second >= (*
map_)[index.first].size())
336 std::cout <<
"Peak index outside of scan!" << std::endl;
337 std::cout << index.first <<
" " << index.second << std::endl;
341 CoordinateType mz_pos = (*map_)[index.first][index.second].getMZ();
342 Size index_first_tmp = index.first;
345 if (index.first == 0)
351 while ((index.first > 0) && ((*
map_)[index.first].empty()))
361 (*map_)[index.first].end(),
362 (*map_)[index_first_tmp][index.second],
366 if (it == (*
map_)[index.first].end())
368 index.second = (*map_)[index.first].size() - 1;
371 else if (it == (*
map_)[index.first].begin())
379 if (it->getMZ() - mz_pos < mz_pos - (it - 1)->getMZ())
381 index.second = it - (*map_)[index.first].begin();
385 index.second = --it - (*map_)[index.first].begin();
393 std::vector<DPosition<2> > points;
394 points.reserve(set.size());
396 for (FeatureFinderDefs::IndexSet::const_iterator it = set.begin(); it != set.end(); ++it)
398 tmp[
Peak2D::MZ] = (*map_)[it->first][it->second].getMZ();
400 points.push_back(tmp);
427 #endif // OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEAFIMODULE_H
Implements a module of the FeatureFinder algorithm.
Definition: FeaFiModule.h:157
IsotopeCluster::IndexPair IndexPair
Index to peak consisting of two UInts (scan index / peak index)
Definition: FeatureFinderDefs.h:54
void getNextMz(FeatureFinderDefs::IndexPair &index) const
fills index with the index of next peak in m/z dimension
Definition: FeaFiModule.h:223
CoordinateType getPeakRt(const FeatureFinderDefs::IndexPair &index) const
Returns the retention time of a peak.
Definition: FeaFiModule.h:208
IntensityIterator(const FeatureFinderDefs::IndexSet::const_iterator &iter, const FeaFiModuleType *module)
Definition: FeaFiModule.h:91
Size size() const
Definition: MSExperiment.h:117
IntensityType getPeakIntensity(const FeatureFinderDefs::IndexPair &index) const
Returns the intensity of a peak.
Definition: FeaFiModule.h:188
IntensityLess(const IntensityLess &rhs)
Copy ctor.
Definition: FeaFiModule.h:66
Retention time dimension id (0 if used as a const int)
Definition: Peak2D.h:76
void getNextRt(FeatureFinderDefs::IndexPair &index)
fills index with the index of the nearest peak in the next scan
Definition: FeaFiModule.h:265
PeakType::IntensityType IntensityType
Input intensity type.
Definition: FeaFiModule.h:166
A container for features.
Definition: FeatureMap.h:93
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:107
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:123
IntensityLess()
Default ctor undefined since we cannot compare without a FeaFiModule.
Mass-to-charge dimension id (1 if used as a const int)
Definition: Peak2D.h:77
FeaFiModuleType::IntensityType operator*() const
Definition: FeaFiModule.h:141
void getPrevMz(FeatureFinderDefs::IndexPair &index) const
fills index with the index of previous peak in m/z dimension
Definition: FeaFiModule.h:244
FeatureFinder * ff_
Pointer to the calling FeatureFinder that is used to access the feature flags and report progress...
Definition: FeaFiModule.h:413
The purpose of this struct is to provide definitions of classes and typedefs which are used throughou...
Definition: FeatureFinderDefs.h:51
const MapType * map_
Input data pointer.
Definition: FeaFiModule.h:409
Comparator by position. Lexicographical comparison (first RT then m/z) is done.
Definition: Peak2D.h:327
FeaFiModule & operator=(const FeaFiModule &)
Not implemented.
RtIterator(const FeatureFinderDefs::IndexSet::const_iterator &iter, const FeaFiModuleType *module)
Definition: FeaFiModule.h:135
FeaFiModuleType::IntensityType operator*() const
Definition: FeaFiModule.h:119
CoordinateType getPeakMz(const FeatureFinderDefs::IndexPair &index) const
Returns the m/z of a peak.
Definition: FeaFiModule.h:198
FeatureMap * features_
Output data pointer.
Definition: FeaFiModule.h:411
void getPrevRt(FeatureFinderDefs::IndexPair &index)
fills index with the index of the nearest peak in the previous scan
Definition: FeaFiModule.h:321
const FeaFiModuleType & module_
Reference to the FeaFiModule.
Definition: FeaFiModule.h:79
const std::vector< ConvexHull2D > & getConvexHulls() const
Non-mutable access to the convex hulls.
IsotopeCluster::IndexSet IndexSet
A set of peak indices.
Definition: FeatureFinderDefs.h:60
void addConvexHull(const FeatureFinderDefs::IndexSet &set, Feature &feature) const
Calculates the convex hull of a index set and adds it to the feature.
Definition: FeaFiModule.h:391
const FeaFiModuleType * module_
Definition: FeaFiModule.h:125
Retention time iterator for a FeatureFinderDefs::IndexSet.
Definition: FeaFiModule.h:132
Comparator that allows to compare the indices of two peaks by their intensity.
Definition: FeaFiModule.h:56
FeaFiModuleType::IntensityType operator*() const
Definition: FeaFiModule.h:97
Exception that is thrown if a method an invalid IndexPair is given.
Definition: FeatureFinderDefs.h:66
An LC-MS feature.
Definition: Feature.h:70
FeaFiModule(const MSExperiment< PeakType > *map, FeatureMap *features, FeatureFinder *ff)
Constructor.
Definition: FeaFiModule.h:171
MzIterator(const FeatureFinderDefs::IndexSet::const_iterator &iter, const FeaFiModuleType *module)
Definition: FeaFiModule.h:113
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:69
m/z iterator for a FeatureFinderDefs::IndexSet
Definition: FeaFiModule.h:110
PeakType::CoordinateType CoordinateType
Input coordinate type.
Definition: FeaFiModule.h:168
Intensity iterator for a FeatureFinderDefs::IndexSet.
Definition: FeaFiModule.h:88
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:103
FeaFiModule()
Not implemented.
IntensityLess(const FeaFiModuleType &module)
Constructor that takes a FeaFiModule reference.
Definition: FeaFiModule.h:60
The main feature finder class.
Definition: FeatureFinder.h:57
virtual ~FeaFiModule()
destructor
Definition: FeaFiModule.h:183
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
MSExperiment< PeakType > MapType
Input map type.
Definition: FeaFiModule.h:162
MapType::SpectrumType SpectrumType
Input spectrum type.
Definition: FeaFiModule.h:164
const FeaFiModuleType * module_
Definition: FeaFiModule.h:147
const FeaFiModuleType * module_
Definition: FeaFiModule.h:103
bool operator()(const typename FeatureFinderDefs::IndexPair &left, const typename FeatureFinderDefs::IndexPair &right) const
Compare with respect to intensity.
Definition: FeaFiModule.h:72