35 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEAFIMODULE_H 36 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEAFIMODULE_H 56 template <
typename FeaFiModuleType>
58 std::binary_function<typename FeatureFinderDefs::IndexPair, typename FeatureFinderDefs::IndexPair, bool>
75 return module_.getPeakIntensity(left) <
module_.getPeakIntensity(right);
88 template <
typename FeaFiModuleType>
90 FeatureFinderDefs::IndexSet::const_iterator
92 IntensityIterator(
const FeatureFinderDefs::IndexSet::const_iterator & iter,
const FeaFiModuleType * module) :
98 typename FeaFiModuleType::IntensityType
operator*()
const 100 return module_->getPeakIntensity(FeatureFinderDefs::IndexSet::const_iterator::operator*());
110 template <
typename FeaFiModuleType>
112 FeatureFinderDefs::IndexSet::const_iterator
114 MzIterator(
const FeatureFinderDefs::IndexSet::const_iterator & iter,
const FeaFiModuleType * module) :
120 typename FeaFiModuleType::IntensityType
operator*()
const 122 return module_->getPeakMz(FeatureFinderDefs::IndexSet::const_iterator::operator*());
132 template <
typename FeaFiModuleType>
134 FeatureFinderDefs::IndexSet::const_iterator
136 RtIterator(
const FeatureFinderDefs::IndexSet::const_iterator & iter,
const FeaFiModuleType * module) :
142 typename FeaFiModuleType::IntensityType
operator*()
const 144 return module_->getPeakRt(FeatureFinderDefs::IndexSet::const_iterator::operator*());
157 template <
class PeakType>
179 features_ = features;
193 OPENMS_PRECONDITION(index.second < (*map_)[index.first].size(),
"Peak index outside of scan!");
195 return (*map_)[index.first][index.second].getIntensity();
203 OPENMS_PRECONDITION(index.second < (*map_)[index.first].size(),
"Peak index outside of scan!");
205 return (*map_)[index.first][index.second].getMZ();
213 OPENMS_PRECONDITION(index.second < (*map_)[index.first].size(),
"Peak index outside of scan!");
215 return (*map_)[index.first].getRT();
228 OPENMS_PRECONDITION(index.second < (*map_)[index.first].size(),
"Peak index outside of scan!");
231 if (index.second + 1 >= (*map_)[index.first].size())
249 OPENMS_PRECONDITION(index.second < (*map_)[index.first].size(),
"Peak index outside of scan!");
252 if (index.second == 0)
270 OPENMS_PRECONDITION(index.second < (*map_)[index.first].size(),
"Peak index outside of scan!");
272 CoordinateType mz_pos = (*map_)[index.first][index.second].getMZ();
273 Size index_first_tmp = index.first;
276 while (index.first < map_->size() &&
277 (*map_)[index.first].empty())
282 if (index.first >= map_->size())
292 if (it == (*map_)[index.first].end())
294 index.second = (*map_)[index.first].size() - 1;
297 else if (it == (*map_)[index.first].begin())
305 if (it->getMZ() - mz_pos < mz_pos - (it - 1)->getMZ())
307 index.second = it - (*map_)[index.first].begin();
311 index.second = --it - (*map_)[index.first].begin();
326 OPENMS_PRECONDITION(index.second < (*map_)[index.first].size(),
"Peak index outside of scan!");
329 if (index.first >= map_->size())
331 std::cout <<
"Scan index outside of map!" << std::endl;
332 std::cout << index.first <<
" " << index.second << std::endl;
335 if (index.second >= (*map_)[index.first].size())
337 std::cout <<
"Peak index outside of scan!" << std::endl;
338 std::cout << index.first <<
" " << index.second << std::endl;
342 CoordinateType mz_pos = (*map_)[index.first][index.second].getMZ();
343 Size index_first_tmp = index.first;
346 if (index.first == 0)
352 while ((index.first > 0) && ((*map_)[index.first].empty()))
362 (*map_)[index.first].end(),
363 (*map_)[index_first_tmp][index.second],
367 if (it == (*map_)[index.first].end())
369 index.second = (*map_)[index.first].size() - 1;
372 else if (it == (*map_)[index.first].begin())
380 if (it->getMZ() - mz_pos < mz_pos - (it - 1)->getMZ())
382 index.second = it - (*map_)[index.first].begin();
386 index.second = --it - (*map_)[index.first].begin();
394 std::vector<DPosition<2> > points;
395 points.reserve(
set.size());
397 for (FeatureFinderDefs::IndexSet::const_iterator it =
set.begin(); it !=
set.end(); ++it)
399 tmp[
Peak2D::MZ] = (*map_)[it->first][it->second].getMZ();
401 points.push_back(tmp);
428 #endif // OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEAFIMODULE_H CoordinateType getPeakMz(const FeatureFinderDefs::IndexPair &index) const
Returns the m/z of a peak.
Definition: FeaFiModule.h:199
Implements a module of the FeatureFinder algorithm.
Definition: FeaFiModule.h:158
IsotopeCluster::IndexPair IndexPair
Index to peak consisting of two UInts (scan index / peak index)
Definition: FeatureFinderDefs.h:54
IntensityIterator(const FeatureFinderDefs::IndexSet::const_iterator &iter, const FeaFiModuleType *module)
Definition: FeaFiModule.h:92
FeaFiModuleType::IntensityType operator*() const
Definition: FeaFiModule.h:98
FeaFiModuleType::IntensityType operator*() const
Definition: FeaFiModule.h:142
IntensityLess(const IntensityLess &rhs)
Copy ctor.
Definition: FeaFiModule.h:67
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:266
PeakType::IntensityType IntensityType
Input intensity type.
Definition: FeaFiModule.h:167
void getPrevMz(FeatureFinderDefs::IndexPair &index) const
fills index with the index of previous peak in m/z dimension
Definition: FeaFiModule.h:245
A container for features.
Definition: FeatureMap.h:94
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:107
IntensityType getPeakIntensity(const FeatureFinderDefs::IndexPair &index) const
Returns the intensity of a peak.
Definition: FeaFiModule.h:189
FeaFiModule(const PeakMap *map, FeatureMap *features, FeatureFinder *ff)
Constructor.
Definition: FeaFiModule.h:172
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:104
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
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
const std::vector< ConvexHull2D > & getConvexHulls() const
Non-mutable access to the convex hulls.
PeakMap MapType
Input map type.
Definition: FeaFiModule.h:163
FeatureFinder * ff_
Pointer to the calling FeatureFinder that is used to access the feature flags and report progress...
Definition: FeaFiModule.h:414
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:410
void getNextMz(FeatureFinderDefs::IndexPair &index) const
fills index with the index of next peak in m/z dimension
Definition: FeaFiModule.h:224
Comparator by position. Lexicographical comparison (first RT then m/z) is done.
Definition: Peak2D.h:333
RtIterator(const FeatureFinderDefs::IndexSet::const_iterator &iter, const FeaFiModuleType *module)
Definition: FeaFiModule.h:136
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:392
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
FeatureMap * features_
Output data pointer.
Definition: FeaFiModule.h:412
void getPrevRt(FeatureFinderDefs::IndexPair &index)
fills index with the index of the nearest peak in the previous scan
Definition: FeaFiModule.h:322
const FeaFiModuleType & module_
Reference to the FeaFiModule.
Definition: FeaFiModule.h:80
IsotopeCluster::IndexSet IndexSet
A set of peak indices.
Definition: FeatureFinderDefs.h:60
const FeaFiModuleType * module_
Definition: FeaFiModule.h:126
Retention time iterator for a FeatureFinderDefs::IndexSet.
Definition: FeaFiModule.h:133
bool operator()(const typename FeatureFinderDefs::IndexPair &left, const typename FeatureFinderDefs::IndexPair &right) const
Compare with respect to intensity.
Definition: FeaFiModule.h:73
Comparator that allows to compare the indices of two peaks by their intensity.
Definition: FeaFiModule.h:57
FeaFiModuleType::IntensityType operator*() const
Definition: FeaFiModule.h:120
Exception that is thrown if a method an invalid IndexPair is given.
Definition: FeatureFinderDefs.h:66
An LC-MS feature.
Definition: Feature.h:70
MzIterator(const FeatureFinderDefs::IndexSet::const_iterator &iter, const FeaFiModuleType *module)
Definition: FeaFiModule.h:114
CoordinateType getPeakRt(const FeatureFinderDefs::IndexPair &index) const
Returns the retention time of a peak.
Definition: FeaFiModule.h:209
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
m/z iterator for a FeatureFinderDefs::IndexSet
Definition: FeaFiModule.h:111
PeakType::CoordinateType CoordinateType
Input coordinate type.
Definition: FeaFiModule.h:169
Intensity iterator for a FeatureFinderDefs::IndexSet.
Definition: FeaFiModule.h:89
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:118
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
IntensityLess(const FeaFiModuleType &module)
Constructor that takes a FeaFiModule reference.
Definition: FeaFiModule.h:61
The main feature finder class.
Definition: FeatureFinder.h:57
virtual ~FeaFiModule()
destructor
Definition: FeaFiModule.h:184
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
MapType::SpectrumType SpectrumType
Input spectrum type.
Definition: FeaFiModule.h:165
const FeaFiModuleType * module_
Definition: FeaFiModule.h:148
const FeaFiModuleType * module_
Definition: FeaFiModule.h:104