Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes

MSSpectrum< PeakT > Class Template Reference
[Kernel]

The representation of a 1D spectrum. More...

#include <OpenMS/KERNEL/MSSpectrum.h>

Inheritance diagram for MSSpectrum< PeakT >:
RangeManager< 1 > SpectrumSettings PersistentObject MetaInfoInterface

List of all members.

Classes

class  FloatDataArray
 Float data array class. More...
class  IntegerDataArray
 Integer data array class. More...
struct  RTLess
 Comparator for the retention time. More...
class  StringDataArray
 String data array class. More...

Public Types

Base type definitions

typedef PeakT PeakType
 Peak type.
typedef PeakType::CoordinateType CoordinateType
 Coordinate (m/z) type.
typedef std::vector< PeakTypeContainerType
 Spectrum base type.
typedef std::vector
< FloatDataArray
FloatDataArrays
 Float data array vector type.
typedef std::vector
< StringDataArray
StringDataArrays
 String data array vector type.
typedef std::vector
< IntegerDataArray
IntegerDataArrays
 Integer data array vector type.
Peak container iterator type definitions

typedef ContainerType::iterator Iterator
 Mutable iterator.
typedef
ContainerType::const_iterator 
ConstIterator
 Non-mutable iterator.
typedef
ContainerType::reverse_iterator 
ReverseIterator
 Mutable reverse iterator.
typedef
ContainerType::const_reverse_iterator 
ConstReverseIterator
 Non-mutable reverse iterator.

Public Member Functions

 MSSpectrum ()
 Constructor.
 MSSpectrum (const MSSpectrum &source)
 Copy constructor.
 ~MSSpectrum ()
 Destructor.
MSSpectrumoperator= (const MSSpectrum &source)
 Assignment operator.
bool operator== (const MSSpectrum &rhs) const
 Equality operator.
bool operator!= (const MSSpectrum &rhs) const
 Equality operator.
virtual void updateRanges ()
void clear (bool clear_meta_data)
 Clears all data and meta data.
Accessors for meta information

Returns the absolute retention time (is seconds)

DoubleReal getRT () const
void setRT (DoubleReal rt)
 Sets the absolute retention time (is seconds).
UInt getMSLevel () const
 Returns the MS level.
void setMSLevel (UInt ms_level)
 Sets the MS level.
const StringgetName () const
 Returns the name.
void setName (const String &name)
 Sets the name.
Peak data array methods

These methods are used to annotate each peak in a spectrum with meta information. It is an intermediate way between storing the information in the peak's MetaInfoInterface and deriving a new peak type with members for this information.

These statements should help you chose which approach to use

  • Access to meta info arrays is slower than to a member variable
  • Access to meta info arrays is faster than to a MetaInfoInterface
  • Meta info arrays are stored when using mzML format for storing
const FloatDataArraysgetFloatDataArrays () const
 Returns a const reference to the float meta data arrays.
FloatDataArraysgetFloatDataArrays ()
 Returns a mutable reference to the float meta data arrays.
const StringDataArraysgetStringDataArrays () const
 Returns a const reference to the string meta data arrays.
StringDataArraysgetStringDataArrays ()
 Returns a mutable reference to the string meta data arrays.
const IntegerDataArraysgetIntegerDataArrays () const
 Returns a const reference to the integer meta data arrays.
IntegerDataArraysgetIntegerDataArrays ()
 Returns a mutable reference to the integer meta data arrays.
Sorting peaks

void sortByIntensity (bool reverse=false)
 Lexicographically sorts the peaks by their intensity.
void sortByPosition ()
 Lexicographically sorts the peaks by their position.
bool isSorted () const
 Checks if all peaks are sorted with respect to ascending m/z.
Searching a peak or peak range

Size findNearest (CoordinateType mz) const
 Binary search for the peak nearest to a specific m/z.
Iterator MZBegin (CoordinateType mz)
 Binary search for peak range begin.
Iterator MZBegin (Iterator begin, CoordinateType mz, Iterator end)
 Binary search for peak range begin.
Iterator MZEnd (CoordinateType mz)
 Binary search for peak range end (returns the past-the-end iterator).
Iterator MZEnd (Iterator begin, CoordinateType mz, Iterator end)
 Binary search for peak range end (returns the past-the-end iterator).
ConstIterator MZBegin (CoordinateType mz) const
 Binary search for peak range begin.
ConstIterator MZBegin (ConstIterator begin, CoordinateType mz, ConstIterator end) const
 Binary search for peak range begin.
ConstIterator MZEnd (CoordinateType mz) const
 Binary search for peak range end (returns the past-the-end iterator).
ConstIterator MZEnd (ConstIterator begin, CoordinateType mz, ConstIterator end) const
 Binary search for peak range end (returns the past-the-end iterator).

Protected Member Functions

virtual void clearChildIds_ ()
 Clears the persistence id of all sub-objects.

Protected Attributes

DoubleReal retention_time_
 Retention time.
UInt ms_level_
 MS level.
String name_
 Name.
FloatDataArrays float_data_arrays_
 Float data arrays.
StringDataArrays string_data_arrays_
 String data arrays.
IntegerDataArrays integer_data_arrays_
 Intager data arrays.

Detailed Description

template<typename PeakT = Peak1D>
class OpenMS::MSSpectrum< PeakT >

The representation of a 1D spectrum.

It contains peak data and metadata about specific instrument settings, acquisition settings, description of the meta values used in the peaks and precursor info (SpectrumSettings).

Several MSSpectrum instances are contained in a peak map (MSExperiment), which is essentially a vector of spectra with additional information about the experiment.

Precursor info from SpectrumSettings should only be used if this spectrum is a tandem-MS spectrum. The precursor spectrum is the first spectrum in MSExperiment, that has a lower MS-level than the current spectrum.

Note:
For range operations, see RangeUtils module!

Member Typedef Documentation

typedef ContainerType::const_iterator ConstIterator

Non-mutable iterator.

typedef ContainerType::const_reverse_iterator ConstReverseIterator

Non-mutable reverse iterator.

typedef std::vector<PeakType> ContainerType

Spectrum base type.

Coordinate (m/z) type.

typedef std::vector<FloatDataArray> FloatDataArrays

Float data array vector type.

typedef std::vector<IntegerDataArray> IntegerDataArrays

Integer data array vector type.

typedef ContainerType::iterator Iterator

Mutable iterator.

typedef PeakT PeakType

Peak type.

typedef ContainerType::reverse_iterator ReverseIterator

Mutable reverse iterator.

typedef std::vector<StringDataArray> StringDataArrays

String data array vector type.


Constructor & Destructor Documentation

MSSpectrum (  )  [inline]

Constructor.

MSSpectrum ( const MSSpectrum< PeakT > &  source  )  [inline]

Copy constructor.

~MSSpectrum (  )  [inline]

Destructor.


Member Function Documentation

void clear ( bool  clear_meta_data  )  [inline]

Clears all data and meta data.

Parameters:
clear_meta_data If true, all meta data is cleared in addition to the data.

Referenced by MSSpectrum< RichPeak1D >::clear(), IDEvaluationBase::getPoints(), XMassFile::load(), TwoDOptimization::optimizeRegionsScanwise_(), and PeakPickerHiRes::pick().

virtual void clearChildIds_ (  )  [inline, protected, virtual]

Clears the persistence id of all sub-objects.

Implements PersistentObject.

Reimplemented in BinnedSpectrum.

Size findNearest ( CoordinateType  mz  )  const [inline]

Binary search for the peak nearest to a specific m/z.

Parameters:
mz The searched for mass-to-charge ratio searched
Returns:
Returns the index of the peak.
Note:
Make sure the spectrum is sorted with respect to m/z! Otherwise the result is undefined.
Exceptions:
Exception::Precondition is thrown if the spectrum is empty (not only in debug mode)

Referenced by FeatureFinderAlgorithmPicked< PeakType, FeatureType >::findIsotope_(), and FeatureFinderAlgorithmPicked< PeakType, FeatureType >::run().

FloatDataArrays& getFloatDataArrays (  )  [inline]

Returns a mutable reference to the float meta data arrays.

IntegerDataArrays& getIntegerDataArrays (  )  [inline]

Returns a mutable reference to the integer meta data arrays.

const IntegerDataArrays& getIntegerDataArrays (  )  const [inline]

Returns a const reference to the integer meta data arrays.

Referenced by MetaDataBrowser::add(), MzMLHandler< MapType >::fillData_(), DataFilters::passes(), and MzMLHandler< MapType >::writeTo().

const String& getName (  )  const [inline]

Returns the name.

Referenced by PeakPickerHiRes::pick().

const StringDataArrays& getStringDataArrays (  )  const [inline]

Returns a const reference to the string meta data arrays.

Referenced by MetaDataBrowser::add(), MzMLHandler< MapType >::fillData_(), and MzMLHandler< MapType >::writeTo().

StringDataArrays& getStringDataArrays (  )  [inline]

Returns a mutable reference to the string meta data arrays.

bool isSorted (  )  const [inline]

Checks if all peaks are sorted with respect to ascending m/z.

Referenced by MRMTransitionGroupPicker::pickTransitionGroup().

ConstIterator MZBegin ( ConstIterator  begin,
CoordinateType  mz,
ConstIterator  end 
) const [inline]

Binary search for peak range begin.

Note:
Make sure the spectrum is sorted with respect to m/z! Otherwise the result is undefined.
Iterator MZBegin ( Iterator  begin,
CoordinateType  mz,
Iterator  end 
) [inline]

Binary search for peak range begin.

Note:
Make sure the spectrum is sorted with respect to m/z! Otherwise the result is undefined.
ConstIterator MZBegin ( CoordinateType  mz  )  const [inline]

Binary search for peak range begin.

Note:
Make sure the spectrum is sorted with respect to m/z! Otherwise the result is undefined.
Iterator MZEnd ( CoordinateType  mz  )  [inline]

Binary search for peak range end (returns the past-the-end iterator).

Note:
Make sure the spectrum is sorted with respect to m/z. Otherwise the result is undefined.

Referenced by IsotopeWaveletTransform< PeakType >::identifyCharge(), IsotopeWaveletTransform< PeakType >::initializeScan(), and IsotopeWaveletTransform< PeakType >::TransSpectrum::MZEnd().

ConstIterator MZEnd ( CoordinateType  mz  )  const [inline]

Binary search for peak range end (returns the past-the-end iterator).

Note:
Make sure the spectrum is sorted with respect to m/z. Otherwise the result is undefined.
Iterator MZEnd ( Iterator  begin,
CoordinateType  mz,
Iterator  end 
) [inline]

Binary search for peak range end (returns the past-the-end iterator).

Note:
Make sure the spectrum is sorted with respect to m/z. Otherwise the result is undefined.
ConstIterator MZEnd ( ConstIterator  begin,
CoordinateType  mz,
ConstIterator  end 
) const [inline]

Binary search for peak range end (returns the past-the-end iterator).

Note:
Make sure the spectrum is sorted with respect to m/z. Otherwise the result is undefined.
bool operator!= ( const MSSpectrum< PeakT > &  rhs  )  const [inline]

Equality operator.

MSSpectrum& operator= ( const MSSpectrum< PeakT > &  source  )  [inline]
bool operator== ( const MSSpectrum< PeakT > &  rhs  )  const [inline]
void setName ( const String name  )  [inline]

Sets the name.

Referenced by XMassFile::load(), TOPPRNPxl::main_(), and PeakPickerHiRes::pick().

void sortByIntensity ( bool  reverse = false  )  [inline]

Lexicographically sorts the peaks by their intensity.

Sorts the peaks according to ascending intensity. Meta data arrays will be sorted accordingly.

Referenced by IsotopeWaveletTransform< PeakType >::identifyCharge(), OfflinePrecursorIonSelection::makePrecursorSelectionForKnownLCMSMap(), and MRMTransitionGroupPicker::pickTransitionGroup().

void sortByPosition (  )  [inline]

Lexicographically sorts the peaks by their position.

The spectrum is sorted with respect to position. Meta data arrays will be sorted accordingly.

Referenced by FeatureFinderAlgorithmIsotopeWavelet< PeakType, FeatureType >::createHRData(), MarkerIonExtractor::extractMarkerIons(), and MRMTransitionGroupPicker::pickTransitionGroup().

virtual void updateRanges (  )  [inline, virtual]

Member Data Documentation


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:55 using doxygen 1.7.1