35 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_SIMPLEEXTENDER_H 
   36 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_SIMPLEEXTENDER_H 
   78   template <
class PeakType, 
class FeatureType>
 
   95       Base(map, features, ff),
 
   98       this->
setName(
"SimpleExtender");
 
  100       this->
defaults_.
setValue(
"dist_mz_up", 6.0, 
"Maximum high m/z distance of peak in the region/boundary from the seed.");
 
  102       this->
defaults_.
setValue(
"dist_mz_down", 2.0, 
"Maximum low m/z distance of peak in the region/boundary from the seed.");
 
  104       this->
defaults_.
setValue(
"dist_rt_up", 5.0, 
"Maximum high RT distance of peak in the region/boundary from the seed.");
 
  106       this->
defaults_.
setValue(
"dist_rt_down", 5.0, 
"Maximum low RT distance of peak in the region/boundary from the seed.");
 
  112       this->
defaults_.
setValue(
"priority_thr", -0.1, 
"Minimum priority for data points to be included into the boundary of the feature (default 0.0). The priority of a data point is a function of its intensity and its distance to the last point included into the feature region. Setting this threshold to zero or a very small value is usually a good idea.", 
StringList::create(
"advanced"));
 
  114       this->
defaults_.
setValue(
"intensity_factor", 0.03, 
"Influences for intensity (ion count) threshold in the feature extension. We include only raw data points into this region if their intensity is larger than [intensity_factor * (intensity of the seed)].");
 
  130       result_region.clear();
 
  135 #ifdef DEBUG_FEATUREFINDER 
  136       std::vector<IndexPair> debug_vector;
 
  142       for (IndexSet::const_iterator citer = seed_region.begin(); citer != seed_region.end(); ++citer)
 
  156       for (IndexSet::const_iterator citer = seed_region.begin(); citer != seed_region.end(); ++citer)
 
  168 #ifdef DEBUG_FEATUREFINDER 
  170       std::cout << 
"Extending from " << this->
getPeakRt(seed) << 
"/" << this->
getPeakMz(seed) << std::endl;
 
  172       std::cout << 
" (" << seed.first << 
"/" << seed.second << 
")" << std::endl;
 
  183         OPENMS_PRECONDITION(current_index.first < (*this->map_).size(), 
"Scan index outside of map!");
 
  184         OPENMS_PRECONDITION(current_index.second < (*this->map_)[current_index.first].size(), 
"Peak index outside of scan!");
 
  204 #ifdef DEBUG_FEATUREFINDER 
  205         debug_vector.push_back(current_index);
 
  207         result_region.insert(current_index);
 
  211 #ifdef DEBUG_FEATUREFINDER 
  212       std::cout << 
"Feature region size: " << result_region.size() << std::endl;
 
  215 #ifdef DEBUG_FEATUREFINDER 
  216       static UInt number = 1;
 
  218       debug_vector.clear();
 
  273       std::ofstream file(filename.c_str());
 
  274       for (
Size i = 0; i < peaks.size(); ++i)
 
  276         file << this->
getPeakRt(peaks[i]) << 
" " << this->
getPeakMz(peaks[i]) << 
" " << peaks.size() - i << std::endl;
 
  286       OPENMS_PRECONDITION(index.second < (*this->map_)[index.first].size(), 
"Peak index outside of scan!");
 
  379       return (*this->
map_)[index.first][index.second].getIntensity();
 
  387       OPENMS_PRECONDITION(index.second < (*this->map_)[index.first].size(), 
"Peak index outside of scan!");
 
  448 #endif // OPENMS_TRANSFORMATIONS_FEATUREFINDER_SIMPLEEXTENDER_H 
void extend(const ChargedIndexSet &seed_region, ChargedIndexSet &result_region)
return next seed 
Definition: SimpleExtender.h:127
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
Definition: FeatureFinderDefs.h:63
Param defaults_
Container for default parameters. This member should be filled in the constructor of derived classes!...
Definition: DefaultParamHandler.h:155
void setValue(const String &key, const DataValue &value, const String &description="", const StringList &tags=StringList())
Sets a value. 
A more convenient string class. 
Definition: String.h:56
Base::IntensityType IntensityType
Intensity of a data point. 
Definition: SimpleExtender.h:87
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
void clear()
Reset everything. (Note that update() will cause a division by zero after that.) 
Definition: AveragePosition.h:104
A helper structure to sort indizes by their priority. 
Definition: SimpleExtender.h:236
Base::CoordinateType CoordinateType
Coordinates of a point (m/z and rt) 
Definition: SimpleExtender.h:89
IntensityType getPeakIntensity(const FeatureFinderDefs::IndexPair &index) const 
Returns the intensity of a peak. 
Definition: FeaFiModule.h:190
void moveRtUp_(const IndexPair &index)
Extension into positive rt dimension. 
Definition: SimpleExtender.h:340
std::map< IndexPair, ProbabilityType > priorities_
Keeps track of peaks already included in the boundary (value is priority of peak) ...
Definition: SimpleExtender.h:412
Param param_
Container for current parameters. 
Definition: DefaultParamHandler.h:148
Definition: FeatureFinderDefs.h:63
Compares two indizes by priority. 
Definition: SimpleExtender.h:248
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
SimpleExtender()
Not implemented. 
Mass-to-charge dimension id (1 if used as a const int) 
Definition: Peak2D.h:77
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
DPosition< 2 > last_pos_extracted_
Position of last peak extracted from the boundary (used to compute the priority of neighbouring peaks...
Definition: SimpleExtender.h:415
std::priority_queue< IndexWithPriority, std::vector< IndexWithPriority >, typename IndexWithPriority::PriorityLess > boundary_
Represents the boundary of a feature. 
Definition: SimpleExtender.h:418
ProbabilityType priority
Definition: SimpleExtender.h:245
SimpleExtender & operator=(const SimpleExtender &)
Not implemented. 
CoordinateType getPeakMz(const FeatureFinderDefs::IndexPair &index) const 
Returns the m/z of a peak. 
Definition: FeaFiModule.h:200
const DataValue & getValue(const String &key) const 
Returns a value of a parameter. 
ChargedIndexSet region_
charged index set 
Definition: SimpleExtender.h:436
void getPrevRt(FeatureFinderDefs::IndexPair &index)
fills index with the index of the nearest peak in the previous scan 
Definition: FeaFiModule.h:323
IndexPair index
Definition: SimpleExtender.h:244
PositionType const & getPosition() const 
Returns the current average position. 
Definition: AveragePosition.h:92
FeaFiModule< PeakType, FeatureType > Base
Definition: SimpleExtender.h:84
void writeDebugFile_(const std::vector< IndexPair > &peaks, UInt nr_feat)
write DTA2D debug file for the feature with index nr_feat 
Definition: SimpleExtender.h:270
CoordinateType dist_rt_down_
Maximum distance to seed in negative retention time. 
Definition: SimpleExtender.h:430
ProbabilityType computePeakPriority_(const IndexPair &index)
Computes the priority of a peak as function of intensity and distance from seed. 
Definition: SimpleExtender.h:377
Simple feature extension algorithm. 
Definition: SimpleExtender.h:79
static StringList create(const String &list, const char splitter= ',')
Returns a list that is created by splitting the given (comma-separated) string (String are not trimme...
CoordinateType dist_rt_up_
Maximum distance to seed in positive retention time. 
Definition: SimpleExtender.h:428
Exception that is thrown if a method an invalid IndexPair is given. 
Definition: FeatureFinderDefs.h:66
String & fillLeft(char c, UInt size)
Adds c on the left side until the size of the string is size. 
Representation of a mass spectrometry experiment. 
Definition: MSExperiment.h:68
CoordinateType dist_mz_down_
Maximum distance to seed in negative m/z. 
Definition: SimpleExtender.h:426
void add(PositionType position, CoordinateType const weight=1)
Add a position. 
Definition: AveragePosition.h:113
IndexWithPriority(const FeatureFinderDefs::IndexPair &i, DoubleReal p)
Definition: SimpleExtender.h:238
virtual void updateMembers_()
This method is used to update extra member variables at the end of the setParameters() method...
Definition: SimpleExtender.h:260
SimpleExtender(const MSExperiment< PeakType > *map, FeatureMap< FeatureType > *features, FeatureFinder *ff)
Constructor. 
Definition: SimpleExtender.h:94
bool operator()(const IndexWithPriority &x, const IndexWithPriority &y) const 
Definition: SimpleExtender.h:250
index set with associated charge estimate 
Definition: IsotopeCluster.h:53
size_t Size
Size type e.g. used as variable which can hold result of size() 
Definition: Types.h:144
void moveMzUp_(const IndexPair &index)
Extends the seed into positive m/z direction. 
Definition: SimpleExtender.h:304
void moveMzDown_(const IndexPair &index)
Extends the seed into negative m/z direction. 
Definition: SimpleExtender.h:322
void checkNeighbour_(const IndexPair &index)
Checks the neighbours of the current for insertion into the boundary. 
Definition: SimpleExtender.h:383
bool isTooFarFromCentroid_(const IndexPair &index)
Checks if the current peak is too far from the centroid. 
Definition: SimpleExtender.h:282
Int charge
charge estimate (convention: zero means "no charge estimate") 
Definition: IsotopeCluster.h:62
CoordinateType dist_mz_up_
Maximum distance to seed in positive m/z. 
Definition: SimpleExtender.h:424
The main feature finder class. 
Definition: FeatureFinder.h:57
void moveRtDown_(const IndexPair &index)
Extends the seed into negative retention time direction. 
Definition: SimpleExtender.h:359
void setName(const String &name)
Mutable access to the name. 
DoubleReal ProbabilityType
Priority of a point (see below) 
Definition: SimpleExtender.h:91
const Flag & getPeakFlag(const IndexPair &index) const 
Returns a non-mutable reference to a peak flag. 
Definition: FeatureFinder.h:91
Math::AveragePosition< 2 > running_avg_
keeps an running average of the peak coordinates weighted by the intensities 
Definition: SimpleExtender.h:409
void setMinFloat(const String &key, DoubleReal min)
Sets the minimum value for the floating point or floating point list parameter key. 
ProbabilityType priority_threshold_
Minium priority for points in the feature region (priority is function of intensity and distance to s...
Definition: SimpleExtender.h:433
virtual ~SimpleExtender()
destructor 
Definition: SimpleExtender.h:122
void defaultsToParam_()
Updates the parameters after the defaults have been set in the constructor. 
void setMaxFloat(const String &key, DoubleReal max)
Sets the maximum value for the floating point or floating point list parameter key. 
IntensityType intensity_threshold_
Mininum intensity of a boundary point. Calculated from 'intensity_factor' and the seed intensity...
Definition: SimpleExtender.h:421
double DoubleReal
Double-precision real type. 
Definition: Types.h:118