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,
class FeatureType>
196 return (*
map_)[index.first][index.second].getIntensity();
206 return (*
map_)[index.first][index.second].getMZ();
216 return (*
map_)[index.first].getRT();
232 if (index.second + 1 >= (*
map_)[index.first].size())
253 if (index.second == 0)
273 CoordinateType mz_pos = (*map_)[index.first][index.second].getMZ();
274 Size index_first_tmp = index.first;
277 while (index.first <
map_->
size() &&
278 (*map_)[index.first].empty())
293 if (it == (*
map_)[index.first].end())
295 index.second = (*map_)[index.first].size() - 1;
298 else if (it == (*
map_)[index.first].begin())
306 if (it->getMZ() - mz_pos < mz_pos - (it - 1)->getMZ())
308 index.second = it - (*map_)[index.first].begin();
312 index.second = --it - (*map_)[index.first].begin();
332 std::cout <<
"Scan index outside of map!" << std::endl;
333 std::cout << index.first <<
" " << index.second << std::endl;
336 if (index.second >= (*
map_)[index.first].size())
338 std::cout <<
"Peak index outside of scan!" << std::endl;
339 std::cout << index.first <<
" " << index.second << std::endl;
343 CoordinateType mz_pos = (*map_)[index.first][index.second].getMZ();
344 Size index_first_tmp = index.first;
347 if (index.first == 0)
353 while ((index.first > 0) && ((*
map_)[index.first].empty()))
363 (*map_)[index.first].end(),
364 (*map_)[index_first_tmp][index.second],
368 if (it == (*
map_)[index.first].end())
370 index.second = (*map_)[index.first].size() - 1;
373 else if (it == (*
map_)[index.first].begin())
381 if (it->getMZ() - mz_pos < mz_pos - (it - 1)->getMZ())
383 index.second = it - (*map_)[index.first].begin();
387 index.second = --it - (*map_)[index.first].begin();
395 std::vector<DPosition<2> > points;
396 points.reserve(set.size());
398 for (FeatureFinderDefs::IndexSet::const_iterator it = set.begin(); it != set.end(); ++it)
400 tmp[
Peak2D::MZ] = (*map_)[it->first][it->second].getMZ();
402 points.push_back(tmp);
429 #endif // OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEAFIMODULE_H
Implements a module of the FeatureFinder algorithm.
Definition: FeaFiModule.h:157
Real IntensityType
Intensity type.
Definition: Peak2D.h:63
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:225
CoordinateType getPeakRt(const FeatureFinderDefs::IndexPair &index) const
Returns the retention time of a peak.
Definition: FeaFiModule.h:210
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:190
IntensityLess(const IntensityLess &rhs)
Copy ctor.
Definition: FeaFiModule.h:66
FeatureMapType * features_
Output data pointer.
Definition: FeaFiModule.h:413
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:267
PeakType::IntensityType IntensityType
Input intensity type.
Definition: FeaFiModule.h:168
A container for features.
Definition: FeatureMap.h:111
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: Macros.h:107
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:125
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:246
FeatureFinder * ff_
Pointer to the calling FeatureFinder that is used to access the feature flags and report progress...
Definition: FeaFiModule.h:415
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:411
Comparator by position. Lexicographical comparison (first RT then m/z) is done.
Definition: Peak2D.h:324
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:200
void getPrevRt(FeatureFinderDefs::IndexPair &index)
fills index with the index of the nearest peak in the previous scan
Definition: FeaFiModule.h:323
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:393
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:66
MzIterator(const FeatureFinderDefs::IndexSet::const_iterator &iter, const FeaFiModuleType *module)
Definition: FeaFiModule.h:113
Representation of a mass spectrometry experiment.
Definition: MSExperiment.h:68
m/z iterator for a FeatureFinderDefs::IndexSet
Definition: FeaFiModule.h:110
PeakType::CoordinateType CoordinateType
Input coordinate type.
Definition: FeaFiModule.h:170
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.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
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:185
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:90
MSExperiment< PeakType > MapType
Input map type.
Definition: FeaFiModule.h:164
MapType::SpectrumType SpectrumType
Input spectrum type.
Definition: FeaFiModule.h:166
const FeaFiModuleType * module_
Definition: FeaFiModule.h:147
FeatureMap< FeatureType > FeatureMapType
Output feature map type.
Definition: FeaFiModule.h:162
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
FeaFiModule(const MSExperiment< PeakType > *map, FeatureMap< FeatureType > *features, FeatureFinder *ff)
Constructor.
Definition: FeaFiModule.h:173