ProteoWizard
Public Types | Public Member Functions | Public Attributes | List of all members
ralab::base::ms::PeakPicker< TReal, TIntegrator > Struct Template Reference

resamples spectrum, apply smoothing, determines zero crossings, integrates peaks. More...

#include <peakpickerqtof.hpp>

Public Types

typedef TReal value_type
 
typedef TIntegrator< value_typePeakIntegrator
 

Public Member Functions

 PeakPicker (TReal resolution, std::pair< TReal, TReal > &massrange, TReal width=2., TReal intwidth=2., TReal intensitythreshold=10., bool area=true, uint32_t maxnumberofpeaks=0, double c2d=1e-5)
 
template<typename Tmass , typename Tintensity >
void operator() (Tmass begmz, Tmass endmz, Tintensity begint)
 
TReal getNToppeaks ()
 get min instensity of peak to qualify for max-intensity; More...
 
void filter (TReal threshold)
 clean the masses using the threshold More...
 
const std::vector< TReal > & getPeakMass ()
 
const std::vector< TReal > & getPeakArea ()
 
const std::vector< TReal > & getResampledMZ ()
 
const std::vector< TReal > & getResampledIntensity ()
 
const std::vector< TReal > & getSmoothedIntensity ()
 

Public Attributes

TReal resolution_
 
ralab::base::resample::Convert2Dense c2d_
 
std::vector< TReal > resampledmz_
 
std::vector< TReal > resampledintensity_
 
std::vector< TReal > filter_
 
std::vector< TReal > zerocross_
 
std::vector< TReal > smoothedintensity_
 
std::vector< TReal > peakmass_
 
std::vector< TReal > peakarea_
 
TReal smoothwith_
 
TReal integrationWidth_
 
ralab::base::ms::SimplePicker< TReal > simplepicker_
 
ralab::base::resample::SamplingWith sw_
 
PeakIntegrator integrator_
 
TReal intensitythreshold_
 
bool area_
 
uint32_t maxnumbersofpeaks_
 

Detailed Description

template<typename TReal, template< typename B > class TIntegrator>
struct ralab::base::ms::PeakPicker< TReal, TIntegrator >

resamples spectrum, apply smoothing, determines zero crossings, integrates peaks.

Definition at line 159 of file peakpickerqtof.hpp.

Member Typedef Documentation

§ value_type

template<typename TReal , template< typename B > class TIntegrator>
typedef TReal ralab::base::ms::PeakPicker< TReal, TIntegrator >::value_type

Definition at line 160 of file peakpickerqtof.hpp.

§ PeakIntegrator

template<typename TReal , template< typename B > class TIntegrator>
typedef TIntegrator<value_type> ralab::base::ms::PeakPicker< TReal, TIntegrator >::PeakIntegrator

Definition at line 161 of file peakpickerqtof.hpp.

Constructor & Destructor Documentation

§ PeakPicker()

template<typename TReal , template< typename B > class TIntegrator>
ralab::base::ms::PeakPicker< TReal, TIntegrator >::PeakPicker ( TReal  resolution,
std::pair< TReal, TReal > &  massrange,
TReal  width = 2.,
TReal  intwidth = 2.,
TReal  intensitythreshold = 10.,
bool  area = true,
uint32_t  maxnumberofpeaks = 0,
double  c2d = 1e-5 
)
inline
Parameters
resolutioninstrument resolution
massrangemass range of spectrum
widthsmooth width
intwidthintegration width used for area compuation
areacompute area or height? default - height.
maxnumberofpeaksmaximum of peaks returned by picker
c2dinstrument resampling with small default dissables automatic determination

Definition at line 177 of file peakpickerqtof.hpp.

References ralab::base::resample::Convert2Dense::defBreak(), ralab::base::filter::getGaussianFilterQuantile(), ralab::base::resample::Convert2Dense::getMids(), and ralab::base::resample::resolution2ppm().

185  : resolution_(resolution),c2d_( c2d ) ,smoothwith_(width),
187  intensitythreshold_(intensitythreshold),area_(area),maxnumbersofpeaks_(maxnumberofpeaks)
188  {
189  c2d_.defBreak(massrange,ralab::base::resample::resolution2ppm(resolution));
192  }
ralab::base::resample::SamplingWith sw_
TReal getGaussianFilterQuantile(std::vector< TReal > &gauss, TReal fwhm=20, TReal quantile=0.01)
generate the gauss filter function for filtering of peaks with fwhm (full width at half max) ...
Definition: gaussfilter.hpp:59
ralab::base::resample::Convert2Dense c2d_
std::vector< TReal > filter_
std::vector< TReal > resampledmz_
std::size_t defBreak(std::pair< double, double > &mzrange, double ppm)
computes split points of an map.
void getMids(std::vector< double > &mids)
double resolution2ppm(double resolution)

Member Function Documentation

§ operator()()

template<typename TReal , template< typename B > class TIntegrator>
template<typename Tmass , typename Tintensity >
void ralab::base::ms::PeakPicker< TReal, TIntegrator >::operator() ( Tmass  begmz,
Tmass  endmz,
Tintensity  begint 
)
inline

Definition at line 196 of file peakpickerqtof.hpp.

References ralab::base::resample::Convert2Dense::am_, ralab::base::resample::Convert2Dense::convert2dense(), ralab::base::filter::filter(), ralab::base::base::interpolate_cubic(), and ralab::base::base::interpolate_linear().

197  {
198  typename std::iterator_traits<Tintensity>::value_type minint = *std::upper_bound(begint,begint+std::distance(begmz,endmz),0.1);
199 
200  //determine sampling with
201  double a = sw_(begmz,endmz);
202  //resmpale the spectrum
203  c2d_.am_ = a;
204  c2d_.convert2dense(begmz,endmz, begint, resampledintensity_);
205 
206  //smooth the resampled spectrum
208  //determine zero crossings
209  zerocross_.resize( smoothedintensity_.size()/2 );
210  size_t nrzerocross = simplepicker_( smoothedintensity_.begin( ) , smoothedintensity_.end() , zerocross_.begin(), zerocross_.size());
211 
212  peakmass_.resize(nrzerocross);
213  //determine mass of zerocrossing
215  zerocross_.begin(), zerocross_.begin()+nrzerocross ,
216  peakmass_.begin());
217 
218  //determine peak area
219  if(area_){
220  peakarea_.resize(nrzerocross);
221  integrator_( zerocross_.begin(), zerocross_.begin() + nrzerocross ,
222  smoothedintensity_.begin(),resampledintensity_.begin(), peakarea_.begin() );
223  }else{
224  //determine intensity
225  peakarea_.resize(nrzerocross);
227  zerocross_.begin(), zerocross_.begin()+nrzerocross ,
228  peakarea_.begin());
229  }
230 
231  TReal threshold = static_cast<TReal>(minint) * intensitythreshold_;
232 
233  if(maxnumbersofpeaks_ > 0){
234  double threshmax = getNToppeaks();
235  if(threshmax > threshold)
236  threshold = threshmax;
237  }
238 
239 
240  if(threshold > 0.01){
241  filter(threshold);
242  }
243  }
std::vector< TReal > peakarea_
void interpolate_cubic(YInputIterator begY, YInputIterator endY, XInputIterator begX, XInputIterator endX, OutputIterator out, int start_index=0, typename std::iterator_traits< OutputIterator >::value_type epsilon=std::numeric_limits< typename std::iterator_traits< OutputIterator >::value_type >::epsilon())
cubic interpolation on equidistantly spaced y&#39;s.
TReal getNToppeaks()
get min instensity of peak to qualify for max-intensity;
ralab::base::resample::SamplingWith sw_
void convert2dense(Tmass beginMass, Tmass endMass, Tintens intens, Tout ass)
Converts a sparse spec to a dense spec.
std::vector< TReal > smoothedintensity_
ralab::base::resample::Convert2Dense c2d_
void filter(TReal threshold)
clean the masses using the threshold
std::vector< TReal > filter_
std::vector< TReal > peakmass_
std::vector< TReal > zerocross_
std::vector< TReal > resampledmz_
std::vector< TReal > resampledintensity_
void interpolate_linear(YInputIterator begY, YInputIterator endY, XInputIterator begX, XInputIterator endX, OutputIterator out, int start_index=0, typename std::iterator_traits< OutputIterator >::value_type epsilon=std::numeric_limits< typename std::iterator_traits< OutputIterator >::value_type >::epsilon())
affine interpolation on equidistantly spaced y.
Definition: interpolate.hpp:58
void filter(const TContainer &data, const TContainer &filter, TContainer &result, bool circular=false, uint32_t sides=2)
Applies linear convolution (filtering) to a univariate time series.
Definition: filter.hpp:112
ralab::base::ms::SimplePicker< TReal > simplepicker_

§ getNToppeaks()

template<typename TReal , template< typename B > class TIntegrator>
TReal ralab::base::ms::PeakPicker< TReal, TIntegrator >::getNToppeaks ( )
inline

get min instensity of peak to qualify for max-intensity;

Definition at line 246 of file peakpickerqtof.hpp.

246  {
247  TReal intthres = 0.;
248  if(maxnumbersofpeaks_ < peakarea_.size())
249  {
250  std::vector<TReal> tmparea( peakarea_.begin() , peakarea_.end() );
251  std::nth_element(tmparea.begin(),tmparea.end() - maxnumbersofpeaks_ , tmparea.end());
252  intthres = *(tmparea.end() - maxnumbersofpeaks_);
253  }
254  return intthres;
255  }
std::vector< TReal > peakarea_

§ filter()

template<typename TReal , template< typename B > class TIntegrator>
void ralab::base::ms::PeakPicker< TReal, TIntegrator >::filter ( TReal  threshold)
inline

clean the masses using the threshold

Definition at line 259 of file peakpickerqtof.hpp.

References ralab::base::utils::copy_if().

259  {
260  typename std::vector<TReal>::iterator a = ralab::base::utils::copy_if(peakarea_.begin(),peakarea_.end(),peakmass_.begin(),
261  peakmass_.begin(),boost::bind(std::greater<TReal>(),_1,threshold));
262  peakmass_.resize(std::distance(peakmass_.begin(),a));
263  typename std::vector<TReal>::iterator b = ralab::base::utils::copy_if(peakarea_.begin(),peakarea_.end(),
264  peakarea_.begin(),boost::bind(std::greater<TReal>(),_1,threshold));
265  peakarea_.resize(std::distance(peakarea_.begin(),b));
266  //int x = 1;
267  }
std::vector< TReal > peakarea_
std::vector< TReal > peakmass_
OutputIterator copy_if(InputIterator first, InputIterator last, InputIterator2 source, OutputIterator result, Predicate pred)
Definition: copyif.hpp:35

§ getPeakMass()

template<typename TReal , template< typename B > class TIntegrator>
const std::vector<TReal>& ralab::base::ms::PeakPicker< TReal, TIntegrator >::getPeakMass ( )
inline

Definition at line 269 of file peakpickerqtof.hpp.

269  {
270  return peakmass_;
271  }
std::vector< TReal > peakmass_

§ getPeakArea()

template<typename TReal , template< typename B > class TIntegrator>
const std::vector<TReal>& ralab::base::ms::PeakPicker< TReal, TIntegrator >::getPeakArea ( )
inline

Definition at line 273 of file peakpickerqtof.hpp.

273  {
274  return peakarea_;
275  }
std::vector< TReal > peakarea_

§ getResampledMZ()

template<typename TReal , template< typename B > class TIntegrator>
const std::vector<TReal>& ralab::base::ms::PeakPicker< TReal, TIntegrator >::getResampledMZ ( )
inline

Definition at line 277 of file peakpickerqtof.hpp.

277  {
278  return resampledmz_;
279  }
std::vector< TReal > resampledmz_

§ getResampledIntensity()

template<typename TReal , template< typename B > class TIntegrator>
const std::vector<TReal>& ralab::base::ms::PeakPicker< TReal, TIntegrator >::getResampledIntensity ( )
inline

Definition at line 281 of file peakpickerqtof.hpp.

281  {
282  return resampledintensity_;
283  }
std::vector< TReal > resampledintensity_

§ getSmoothedIntensity()

template<typename TReal , template< typename B > class TIntegrator>
const std::vector<TReal>& ralab::base::ms::PeakPicker< TReal, TIntegrator >::getSmoothedIntensity ( )
inline

Definition at line 285 of file peakpickerqtof.hpp.

285  {
286  return smoothedintensity_;
287  }
std::vector< TReal > smoothedintensity_

Member Data Documentation

§ resolution_

template<typename TReal , template< typename B > class TIntegrator>
TReal ralab::base::ms::PeakPicker< TReal, TIntegrator >::resolution_

Definition at line 163 of file peakpickerqtof.hpp.

§ c2d_

template<typename TReal , template< typename B > class TIntegrator>
ralab::base::resample::Convert2Dense ralab::base::ms::PeakPicker< TReal, TIntegrator >::c2d_

Definition at line 164 of file peakpickerqtof.hpp.

§ resampledmz_

template<typename TReal , template< typename B > class TIntegrator>
std::vector<TReal> ralab::base::ms::PeakPicker< TReal, TIntegrator >::resampledmz_

Definition at line 165 of file peakpickerqtof.hpp.

§ resampledintensity_

template<typename TReal , template< typename B > class TIntegrator>
std::vector<TReal> ralab::base::ms::PeakPicker< TReal, TIntegrator >::resampledintensity_

Definition at line 165 of file peakpickerqtof.hpp.

§ filter_

template<typename TReal , template< typename B > class TIntegrator>
std::vector<TReal> ralab::base::ms::PeakPicker< TReal, TIntegrator >::filter_

Definition at line 166 of file peakpickerqtof.hpp.

§ zerocross_

template<typename TReal , template< typename B > class TIntegrator>
std::vector<TReal> ralab::base::ms::PeakPicker< TReal, TIntegrator >::zerocross_

Definition at line 166 of file peakpickerqtof.hpp.

§ smoothedintensity_

template<typename TReal , template< typename B > class TIntegrator>
std::vector<TReal> ralab::base::ms::PeakPicker< TReal, TIntegrator >::smoothedintensity_

Definition at line 166 of file peakpickerqtof.hpp.

§ peakmass_

template<typename TReal , template< typename B > class TIntegrator>
std::vector<TReal> ralab::base::ms::PeakPicker< TReal, TIntegrator >::peakmass_

Definition at line 167 of file peakpickerqtof.hpp.

§ peakarea_

template<typename TReal , template< typename B > class TIntegrator>
std::vector<TReal> ralab::base::ms::PeakPicker< TReal, TIntegrator >::peakarea_

Definition at line 167 of file peakpickerqtof.hpp.

§ smoothwith_

template<typename TReal , template< typename B > class TIntegrator>
TReal ralab::base::ms::PeakPicker< TReal, TIntegrator >::smoothwith_

Definition at line 168 of file peakpickerqtof.hpp.

§ integrationWidth_

template<typename TReal , template< typename B > class TIntegrator>
TReal ralab::base::ms::PeakPicker< TReal, TIntegrator >::integrationWidth_

Definition at line 169 of file peakpickerqtof.hpp.

§ simplepicker_

template<typename TReal , template< typename B > class TIntegrator>
ralab::base::ms::SimplePicker<TReal> ralab::base::ms::PeakPicker< TReal, TIntegrator >::simplepicker_

Definition at line 170 of file peakpickerqtof.hpp.

§ sw_

template<typename TReal , template< typename B > class TIntegrator>
ralab::base::resample::SamplingWith ralab::base::ms::PeakPicker< TReal, TIntegrator >::sw_

Definition at line 171 of file peakpickerqtof.hpp.

§ integrator_

template<typename TReal , template< typename B > class TIntegrator>
PeakIntegrator ralab::base::ms::PeakPicker< TReal, TIntegrator >::integrator_

Definition at line 172 of file peakpickerqtof.hpp.

§ intensitythreshold_

template<typename TReal , template< typename B > class TIntegrator>
TReal ralab::base::ms::PeakPicker< TReal, TIntegrator >::intensitythreshold_

Definition at line 173 of file peakpickerqtof.hpp.

§ area_

template<typename TReal , template< typename B > class TIntegrator>
bool ralab::base::ms::PeakPicker< TReal, TIntegrator >::area_

Definition at line 174 of file peakpickerqtof.hpp.

§ maxnumbersofpeaks_

template<typename TReal , template< typename B > class TIntegrator>
uint32_t ralab::base::ms::PeakPicker< TReal, TIntegrator >::maxnumbersofpeaks_

Definition at line 175 of file peakpickerqtof.hpp.


The documentation for this struct was generated from the following file: