82 template <
typename SpectrumType>
87 clean_all_charge_states_ = (
Int)param_.getValue(
"clean_all_charge_states");
88 consider_NH3_loss_ = (
Int)param_.getValue(
"consider_NH3_loss");
89 consider_H2O_loss_ = (
Int)param_.getValue(
"consider_H2O_loss");
90 window_size_ = (double)param_.getValue(
"window_size");
91 reduce_by_factor_ = (
Int)param_.getValue(
"reduce_by_factor");
92 factor_ = (double)param_.getValue(
"factor");
93 set_to_zero_ = (
Int)param_.getValue(
"set_to_zero");
97 std::cerr <<
"Error: ParentPeakMower cannot be applied to MS level 1" << std::endl;
102 double pre_pos = 0.0;
107 std::cerr <<
"ParentPeakMower: Warning, Precursor Position not set" << std::endl;
114 default_charge_ = (
Size)param_.getValue(
"default_charge");
115 std::cerr <<
"ParentPeakMower: Warning, Precursor charge not set, assuming default charge (" << default_charge_ <<
")" << std::endl;
116 pre_charge = default_charge_;
119 pre_pos *= pre_charge;
122 std::vector<DRange<1> > ranges;
123 for (
Size z = 1; z <= pre_charge; ++z)
125 if (clean_all_charge_states_ || z == pre_charge)
133 range =
DRange<1>(pre_z_pos - window_size_, pre_z_pos + window_size_);
134 ranges.push_back(range);
136 if (consider_NH3_loss_)
139 range =
DRange<1>(pos - window_size_, pos + window_size_);
140 ranges.push_back(range);
142 if (consider_H2O_loss_)
145 range =
DRange<1>(pos - window_size_, pos + window_size_);
146 ranges.push_back(range);
157 for (
Iterator it = spectrum.begin(); it != spectrum.end(); ++it)
159 for (std::vector<
DRange<1> >::const_iterator rit = ranges.begin(); rit != ranges.end(); ++rit)
161 if (rit->encloses(it->getPosition()))
163 if (reduce_by_factor_)
165 it->setIntensity(it->getIntensity() / factor_);
171 it->setIntensity(0.0);
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:72
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:134
UInt getMSLevel() const
Returns the MS level.
ParentPeakMower gets rid of high peaks that could stem from unfragmented precursor ions.
Definition: ParentPeakMower.h:56
ParentPeakMower(const ParentPeakMower &source)
copy constructor
bool reduce_by_factor_
Definition: ParentPeakMower.h:195
double window_size_
Definition: ParentPeakMower.h:194
ParentPeakMower()
default constructor
bool consider_H2O_loss_
Definition: ParentPeakMower.h:193
void filterPeakSpectrum(PeakSpectrum &spectrum)
void filterPeakMap(PeakMap &exp)
bool consider_NH3_loss_
Definition: ParentPeakMower.h:192
ParentPeakMower & operator=(const ParentPeakMower &source)
assignment operator
void filterSpectrum(SpectrumType &spectrum)
Definition: ParentPeakMower.h:83
bool set_to_zero_
Definition: ParentPeakMower.h:197
double factor_
Definition: ParentPeakMower.h:196
~ParentPeakMower() override
destructor
Size default_charge_
Definition: ParentPeakMower.h:190
bool clean_all_charge_states_
Definition: ParentPeakMower.h:191
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
int Int
Signed integer type.
Definition: Types.h:102
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48