35 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEATUREFINDER_IMPL_H
36 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEATUREFINDER_IMPL_H
46 template <
class PeakType,
class FeatureType>
50 if ((algorithm_name !=
"mrm" && input_map.
empty()) || (algorithm_name ==
"mrm" && input_map.
getChromatograms().empty()))
59 if (algorithm_name !=
"mrm" && input_map.
getSize() == 0)
61 throw Exception::IllegalArgument(__FILE__, __LINE__, __PRETTY_FUNCTION__,
"FeatureFinder needs updated ranges on input map. Aborting.");
67 throw Exception::IllegalArgument(__FILE__, __LINE__, __PRETTY_FUNCTION__,
"FeatureFinder can only operate on MS level 1 data. Please do not use MS/MS data. Aborting.");
73 LOG_WARN <<
"Input map is not sorted by RT and m/z! This is done now, before applying the algorithm!" << std::endl;
77 for (
Size s = 0; s < input_map.
size(); ++s)
79 if (input_map[s].empty())
81 if (input_map[s][0].getMZ() < 0)
83 throw Exception::IllegalArgument(__FILE__, __LINE__, __PRETTY_FUNCTION__,
"FeatureFinder can only operate on spectra that contain peaks with positive m/z values. Filter the data accordingly beforehand! Aborting.");
89 if (algorithm_name !=
"mrm" && algorithm_name !=
"centroided")
93 for (
Size i = 0; i < input_map.
size(); ++i)
100 if (algorithm_name !=
"none")
104 algorithm->
setData(input_map, features, *
this);
110 if (algorithm_name !=
"mrm")
113 for (
Size i = 0; i < features.size(); ++i)
116 Size spectrum_index = input_map.
RTBegin(features[i].getRT()) - input_map.
begin();
117 features[i].setMetaValue(
"spectrum_index", spectrum_index);
119 if (spectrum_index < input_map.
size())
121 String native_id = input_map[spectrum_index].getNativeID();
122 features[i].setMetaValue(
"spectrum_native_id", native_id);
127 std::cerr <<
"FeatureFinderAlgorithm_impl, line=" << __LINE__ <<
"; FixMe this cannot be, but happens" << std::endl;
135 #endif // OPENMS_TRANSFORMATIONS_FEATUREFINDER_FEATUREFINDER_IMPL_H
A more convenient string class.
Definition: String.h:56
Size size() const
Definition: MSExperiment.h:117
Definition: FeatureFinderDefs.h:63
A container for features.
Definition: FeatureMap.h:111
Abstract base class for FeatureFinder algorithms.
Definition: FeatureFinderAlgorithm.h:74
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct. ...
Definition: Factory.h:62
Iterator begin()
Definition: MSExperiment.h:147
void sortSpectra(bool sort_mz=true)
Sorts the data points by retention time.
Definition: MSExperiment.h:575
void setParameters(const Param ¶m)
Sets the parameters.
#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
ConstIterator RTBegin(CoordinateType rt) const
Fast search for spectrum range begin.
Definition: MSExperiment.h:349
void sortChromatograms(bool sort_rt=true)
Sorts the data points of the chromatograms by m/z.
Definition: MSExperiment.h:594
A method or algorithm argument contains illegal values.
Definition: Exception.h:634
virtual void run()=0
Main method that implements the actual algorithm.
void run(const String &algorithm_name, MSExperiment< PeakType > &input_map, FeatureMap< FeatureType > &features, const Param ¶m, const FeatureMap< FeatureType > &seeds)
Executes the FeatureFinder using the given algorithm.
Definition: FeatureFinder_impl.h:47
virtual void setSeeds(const FeatureMapType &seeds)
Sets a reference to the calling FeatureFinder.
Definition: FeatureFinderAlgorithm.h:130
const std::vector< UInt > & getMSLevels() const
returns an array of MS levels
Definition: MSExperiment.h:561
Management and storage of parameters / INI files.
Definition: Param.h:69
Representation of a mass spectrometry experiment.
Definition: MSExperiment.h:68
bool isSorted(bool check_mz=true) const
Checks if all spectra are sorted with respect to ascending RT.
Definition: MSExperiment.h:613
UInt64 getSize() const
returns the total number of peaks
Definition: MSExperiment.h:555
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
std::vector< std::vector< Flag > > flags_
Container for flags attached to input data.
Definition: FeatureFinder.h:108
bool empty() const
Definition: MSExperiment.h:127
void clear(bool clear_meta_data=true)
Clears all data and meta data.
Definition: FeatureMap.h:468
void setData(const MapType &map, FeatureMapType &features, FeatureFinder &ff)
Sets a reference to the calling FeatureFinder.
Definition: FeatureFinderAlgorithm.h:118
const std::vector< MSChromatogram< ChromatogramPeakType > > & getChromatograms() const
returns the chromatogram list
Definition: MSExperiment.h:768