35 #ifndef OPENMS_FILTERING_TRANSFORMERS_PARENTPEAKMOWER_H 36 #define OPENMS_FILTERING_TRANSFORMERS_PARENTPEAKMOWER_H 83 template <
typename SpectrumType>
88 clean_all_charge_states_ = (
Int)param_.getValue(
"clean_all_charge_states");
89 consider_NH3_loss_ = (
Int)param_.getValue(
"consider_NH3_loss");
90 consider_H2O_loss_ = (
Int)param_.getValue(
"consider_H2O_loss");
91 window_size_ = (
double)param_.getValue(
"window_size");
92 reduce_by_factor_ = (
Int)param_.getValue(
"reduce_by_factor");
93 factor_ = (
double)param_.getValue(
"factor");
94 set_to_zero_ = (
Int)param_.getValue(
"set_to_zero");
98 std::cerr <<
"Error: ParentPeakMower cannot be applied to MS level 1" << std::endl;
103 double pre_pos = 0.0;
108 std::cerr <<
"ParentPeakMower: Warning, Precursor Position not set" << std::endl;
115 default_charge_ = (
Size)param_.getValue(
"default_charge");
116 std::cerr <<
"ParentPeakMower: Warning, Precursor charge not set, assuming default charge (" << default_charge_ <<
")" << std::endl;
117 pre_charge = default_charge_;
120 pre_pos *= pre_charge;
123 std::vector<DRange<1> > ranges;
124 for (
Size z = 1; z <= pre_charge; ++z)
126 if (clean_all_charge_states_ || z == pre_charge)
134 range =
DRange<1>(pre_z_pos - window_size_, pre_z_pos + window_size_);
135 ranges.push_back(range);
137 if (consider_NH3_loss_)
140 range =
DRange<1>(pos - window_size_, pos + window_size_);
141 ranges.push_back(range);
143 if (consider_H2O_loss_)
146 range =
DRange<1>(pos - window_size_, pos + window_size_);
147 ranges.push_back(range);
158 for (Iterator it = spectrum.begin(); it != spectrum.end(); ++it)
160 for (std::vector<
DRange<1> >::const_iterator rit = ranges.begin(); rit != ranges.end(); ++rit)
162 if (rit->encloses(it->getPosition()))
164 if (reduce_by_factor_)
166 it->setIntensity(it->getIntensity() / factor_);
172 it->setIntensity(0.0);
184 void filterPeakMap(
PeakMap& exp);
203 #endif // OPENMS_FILTERING/TRANSFORMERS_PARENTPEAKMOWER_H ParentPeakMower gets rid of high peaks that could stem from unfragmented precursor ions...
Definition: ParentPeakMower.h:55
double factor_
Definition: ParentPeakMower.h:197
bool clean_all_charge_states_
Definition: ParentPeakMower.h:192
double window_size_
Definition: ParentPeakMower.h:195
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:102
bool reduce_by_factor_
Definition: ParentPeakMower.h:196
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
void filterSpectrum(SpectrumType &spectrum)
Definition: ParentPeakMower.h:84
bool consider_H2O_loss_
Definition: ParentPeakMower.h:194
bool consider_NH3_loss_
Definition: ParentPeakMower.h:193
bool set_to_zero_
Definition: ParentPeakMower.h:198
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
Size default_charge_
Definition: ParentPeakMower.h:191
UInt getMSLevel() const
Returns the MS level.
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
int Int
Signed integer type.
Definition: Types.h:103