OpenMS
Mobilogram Class Referencefinal

The representation of a 1D ion mobilogram. More...

#include <OpenMS/KERNEL/Mobilogram.h>

Inheritance diagram for Mobilogram:
[legend]
Collaboration diagram for Mobilogram:
[legend]

Classes

struct  RTLess
 Comparator for the RT of the mobilogram. More...
 

Public Types

Base type definitions
using PeakType = MobilityPeak1D
 Peak type. More...
 
using CoordinateType = PeakType::CoordinateType
 Coordinate (mobility) type. More...
 
using ContainerType = std::vector< PeakType >
 Mobilogram base type. More...
 
using RangeManagerContainerType = RangeManagerContainer< RangeMobility, RangeIntensity >
 RangeManager. More...
 
using RangeManagerType = RangeManager< RangeMobility, RangeIntensity >
 
- Public Types inherited from RangeManagerContainer< RangeMobility, RangeIntensity >
using ThisRangeType = typename RangeManager< RangeBases... >::ThisRangeType
 
- Public Types inherited from RangeManager< RangeBases... >
using ThisRangeType = RangeManager< RangeBases... >
 

Public Member Functions

Export methods for std::vector<MobilityPeak1D>
MobilityPeak1Doperator[] (Size i) noexcept
 
const MobilityPeak1Doperator[] (Size i) const noexcept
 
MobilityPeak1Dfront () noexcept
 
const MobilityPeak1Dfront () const noexcept
 
MobilityPeak1Dback () noexcept
 
const MobilityPeak1Dback () const noexcept
 
Iterator begin () noexcept
 
ConstIterator begin () const noexcept
 
ConstIterator cbegin () const noexcept
 
Iterator end () noexcept
 
ConstIterator end () const noexcept
 
ConstIterator cend () const noexcept
 
ReverseIterator rbegin () noexcept
 
ConstReverseIterator crbegin () const
 
ReverseIterator rend () noexcept
 
ConstReverseIterator crend () const
 
bool empty () const noexcept
 
ConstIterator erase (ConstIterator where) noexcept
 
void push_back (MobilityPeak1D mb)
 
MobilityPeak1Demplace_back (MobilityPeak1D mb)
 
template<class... Args>
void emplace_back (Args &&... args)
 
void pop_back ()
 
Iterator insert (ConstIterator where, ConstIterator first, ConstIterator last)
 
void resize (size_t new_size)
 
void reserve (size_t new_size)
 
size_t size () const noexcept
 
void swap (Mobilogram &mb) noexcept
 
void updateRanges () override
 
Accessors for meta information

Returns the retention time (in seconds)

double getRT () const noexcept
 
void setRT (double rt) noexcept
 Sets the retention time (in seconds) More...
 
DriftTimeUnit getDriftTimeUnit () const noexcept
 Returns the ion mobility drift time unit. More...
 
String getDriftTimeUnitAsString () const
 returns the ion mobility drift time unit as string More...
 
void setDriftTimeUnit (DriftTimeUnit dt) noexcept
 Sets the ion mobility drift time unit. More...
 
Sorting peaks
void sortByIntensity (bool reverse=false)
 Lexicographically sorts the peaks by their intensity. More...
 
void sortByPosition ()
 Lexicographically sorts the peaks by their position (mobility). More...
 
bool isSorted () const
 Checks if all peaks are sorted with respect to ascending mobility. More...
 
template<class Predicate >
bool isSorted (const Predicate &lambda) const
 
- Public Member Functions inherited from RangeManagerContainer< RangeMobility, RangeIntensity >
virtual ~RangeManagerContainer ()=default
 D'tor. More...
 
const ThisRangeTypegetRange () const
 get range of current data (call updateRanges() before to ensure the range is accurate) More...
 
ThisRangeTypegetRange ()
 get mutable range, provided for efficiency reasons (avoid updateRanges(), if only minor changes were made) More...
 
- Public Member Functions inherited from RangeManager< RangeBases... >
bool operator== (const RangeManager &rhs) const
 
bool operator!= (const RangeManager &rhs) const
 
bool assignUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
auto & assign (const RangeManager< RangeBasesOther... > &rhs)
 
bool extendUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
void extend (const RangeManager< RangeBasesOther... > &rhs)
 
void scaleBy (const double factor)
 calls RangeBase::scale() for each dimension More...
 
void minSpanIfSingular (const double min_span)
 If any dimension is a single point, e.g. min==max, then extend this dimension by min_span / 2 on either side. More...
 
bool pushIntoUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
void pushInto (const RangeManager< RangeBasesOther... > &sandbox)
 
bool clampToUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
void clampTo (const RangeManager< RangeBasesOther... > &rhs)
 
const RangeBasegetRangeForDim (MSDim dim) const
 obtain a range dimension at runtime using dim More...
 
RangeBasegetRangeForDim (MSDim dim)
 obtain a range dimension at runtime using dim More...
 
HasRangeType hasRange () const
 is any/some/all dimension in this range populated? More...
 
bool containsAll (const RangeManager< RangeBasesOther... > &rhs) const
 
void clearRanges ()
 Resets all ranges. More...
 
ThisRangeTypeclear (const DIM_UNIT range)
 
void printRange (std::ostream &out) const
 print each dimension (base classes) to a stream More...
 

Peak container iterator type definitions

using Iterator = ContainerType::iterator
 Mutable iterator. More...
 
using iterator = Iterator
 
using ConstIterator = ContainerType::const_iterator
 Non-mutable iterator. More...
 
using const_iterator = ConstIterator
 
using ReverseIterator = ContainerType::reverse_iterator
 Mutable reverse iterator. More...
 
using reverse_iterator = ReverseIterator
 
using ConstReverseIterator = ContainerType::const_reverse_iterator
 Non-mutable reverse iterator. More...
 
using const_reverse_iterator = ConstReverseIterator
 
 Mobilogram ()=default
 Constructor. More...
 
 Mobilogram (const Mobilogram &source)=default
 Copy constructor. More...
 
 Mobilogram (Mobilogram &&) noexcept=default
 Move constructor. More...
 
Mobilogramoperator= (const Mobilogram &source)=default
 Assignment operator. More...
 
Mobilogramoperator= (Mobilogram &&) noexcept=default
 Move assignment operator. More...
 
 ~Mobilogram ()=default
 Destructor. More...
 
bool operator== (const Mobilogram &rhs) const
 Equality operator. More...
 
bool operator!= (const Mobilogram &rhs) const
 Equality operator. More...
 

Searching a peak or peak range

std::vector< MobilityPeak1Ddata_
 the actual peaks More...
 
double retention_time_ = -1
 Retention time. More...
 
DriftTimeUnit drift_time_unit_ = DriftTimeUnit::NONE
 Drift time unit. More...
 
Size findNearest (CoordinateType mb) const
 Binary search for the peak nearest to a specific mobility. More...
 
Int findNearest (CoordinateType mb, CoordinateType tolerance) const
 Binary search for the peak nearest to a specific mobility given a +/- tolerance windows. More...
 
Int findNearest (CoordinateType mb, CoordinateType tolerance_left, CoordinateType tolerance_right) const
 Search for the peak nearest to a specific mobility given two +/- tolerance windows. More...
 
Int findHighestInWindow (CoordinateType mb, CoordinateType tolerance_left, CoordinateType tolerance_right) const
 Search for the peak with highest intensity among the peaks near to a specific mobility given two +/- tolerance windows in Th. More...
 
Iterator MBBegin (CoordinateType mb)
 Binary search for peak range begin. More...
 
Iterator MBBegin (Iterator begin, CoordinateType mb, Iterator end)
 Binary search for peak range begin. More...
 
Iterator MBEnd (CoordinateType mb)
 Binary search for peak range end (returns the past-the-end iterator) More...
 
Iterator MBEnd (Iterator begin, CoordinateType mb, Iterator end)
 Binary search for peak range end (returns the past-the-end iterator) More...
 
ConstIterator MBBegin (CoordinateType mb) const
 Binary search for peak range begin. More...
 
ConstIterator MBBegin (ConstIterator begin, CoordinateType mb, ConstIterator end) const
 Binary search for peak range begin. More...
 
ConstIterator MBEnd (CoordinateType mb) const
 Binary search for peak range end (returns the past-the-end iterator) More...
 
ConstIterator MBEnd (ConstIterator begin, CoordinateType mb, ConstIterator end) const
 Binary search for peak range end (returns the past-the-end iterator) More...
 
Iterator PosBegin (CoordinateType mb)
 Binary search for peak range begin. More...
 
Iterator PosBegin (Iterator begin, CoordinateType mb, Iterator end)
 Binary search for peak range begin. More...
 
ConstIterator PosBegin (CoordinateType mb) const
 Binary search for peak range begin. More...
 
ConstIterator PosBegin (ConstIterator begin, CoordinateType mb, ConstIterator end) const
 Binary search for peak range begin. More...
 
Iterator PosEnd (CoordinateType mb)
 Binary search for peak range end (returns the past-the-end iterator) More...
 
Iterator PosEnd (Iterator begin, CoordinateType mb, Iterator end)
 Binary search for peak range end (returns the past-the-end iterator) More...
 
ConstIterator PosEnd (CoordinateType mb) const
 Binary search for peak range end (returns the past-the-end iterator) More...
 
ConstIterator PosEnd (ConstIterator begin, CoordinateType mb, ConstIterator end) const
 Binary search for peak range end (returns the past-the-end iterator) More...
 
void clear () noexcept
 Clears all data and ranges. More...
 
ConstIterator getBasePeak () const
 
Iterator getBasePeak ()
 
PeakType::IntensityType calculateTIC () const
 compute the total ion count (sum of all peak intensities) More...
 

Additional Inherited Members

- Protected Member Functions inherited from RangeManager< RangeBases... >
void for_each_base_ (Visitor &&visitor)
 use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one More...
 
void for_each_base_ (Visitor &&visitor) const
 .. and a const version More...
 
- Static Protected Member Functions inherited from RangeManager< RangeBases... >
static void static_for_each_base_ (Visitor &&visitor)
 use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one (for static members) More...
 

Detailed Description

The representation of a 1D ion mobilogram.

It contains peak data of type MobilityPeak1D.

Note
For range operations, see RangeUtils module!

Member Typedef Documentation

◆ const_iterator

◆ const_reverse_iterator

◆ ConstIterator

using ConstIterator = ContainerType::const_iterator

Non-mutable iterator.

◆ ConstReverseIterator

using ConstReverseIterator = ContainerType::const_reverse_iterator

Non-mutable reverse iterator.

◆ ContainerType

using ContainerType = std::vector<PeakType>

Mobilogram base type.

◆ CoordinateType

Coordinate (mobility) type.

◆ Iterator

using Iterator = ContainerType::iterator

Mutable iterator.

◆ iterator

using iterator = Iterator

◆ PeakType

Peak type.

◆ RangeManagerContainerType

◆ RangeManagerType

◆ reverse_iterator

◆ ReverseIterator

using ReverseIterator = ContainerType::reverse_iterator

Mutable reverse iterator.

Constructor & Destructor Documentation

◆ Mobilogram() [1/3]

Mobilogram ( )
default

Constructor.

◆ Mobilogram() [2/3]

Mobilogram ( const Mobilogram source)
default

Copy constructor.

◆ Mobilogram() [3/3]

Mobilogram ( Mobilogram &&  )
defaultnoexcept

Move constructor.

◆ ~Mobilogram()

~Mobilogram ( )
default

Destructor.

Member Function Documentation

◆ back() [1/2]

const MobilityPeak1D& back ( ) const
inlinenoexcept

◆ back() [2/2]

MobilityPeak1D& back ( )
inlinenoexcept

◆ begin() [1/2]

ConstIterator begin ( ) const
inlinenoexcept

◆ begin() [2/2]

Iterator begin ( )
inlinenoexcept

◆ calculateTIC()

PeakType::IntensityType calculateTIC ( ) const

compute the total ion count (sum of all peak intensities)

◆ cbegin()

ConstIterator cbegin ( ) const
inlinenoexcept

◆ cend()

ConstIterator cend ( ) const
inlinenoexcept

◆ clear()

void clear ( )
noexcept

Clears all data and ranges.

Will delete (clear) all peaks contained in the mobilogram

◆ crbegin()

ConstReverseIterator crbegin ( ) const
inline

◆ crend()

ConstReverseIterator crend ( ) const
inline

◆ emplace_back() [1/2]

void emplace_back ( Args &&...  args)
inline

◆ emplace_back() [2/2]

MobilityPeak1D& emplace_back ( MobilityPeak1D  mb)
inline

◆ empty()

bool empty ( ) const
inlinenoexcept

◆ end() [1/2]

ConstIterator end ( ) const
inlinenoexcept

◆ end() [2/2]

Iterator end ( )
inlinenoexcept

◆ erase()

ConstIterator erase ( ConstIterator  where)
inlinenoexcept

◆ findHighestInWindow()

Int findHighestInWindow ( CoordinateType  mb,
CoordinateType  tolerance_left,
CoordinateType  tolerance_right 
) const

Search for the peak with highest intensity among the peaks near to a specific mobility given two +/- tolerance windows in Th.

Parameters
mbThe target mobility value
toleranceThe non-negative tolerance applied to both sides of mb
Returns
Returns the index of the peak or -1 if no peak present in tolerance window or if mobilogram is empty
Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.
Peaks exactly on borders are considered in tolerance window.

◆ findNearest() [1/3]

Size findNearest ( CoordinateType  mb) const

Binary search for the peak nearest to a specific mobility.

Parameters
mbThe target mobility value
Returns
Returns the index of the peak.
Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.
Exceptions
Exception::Preconditionis thrown if the mobilogram is empty (not only in debug mode)

◆ findNearest() [2/3]

Int findNearest ( CoordinateType  mb,
CoordinateType  tolerance 
) const

Binary search for the peak nearest to a specific mobility given a +/- tolerance windows.

Parameters
mbThe target mobility value
toleranceThe non-negative tolerance applied to both sides of mb
Returns
Returns the index of the peak or -1 if no peak present in tolerance window or if mobilogram is empty
Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.
Peaks exactly on borders are considered in tolerance window.

◆ findNearest() [3/3]

Int findNearest ( CoordinateType  mb,
CoordinateType  tolerance_left,
CoordinateType  tolerance_right 
) const

Search for the peak nearest to a specific mobility given two +/- tolerance windows.

Parameters
mbThe target mobility value
tolerance_leftThe non-negative tolerance applied left of mb
tolerance_rightThe non-negative tolerance applied right of mb
Returns
Returns the index of the peak or -1 if no peak present in tolerance window or if mobilogram is empty
Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.
Peaks exactly on borders are considered in tolerance window.
Search for the left border is done using a binary search followed by a linear scan

◆ front() [1/2]

const MobilityPeak1D& front ( ) const
inlinenoexcept

◆ front() [2/2]

MobilityPeak1D& front ( )
inlinenoexcept

◆ getBasePeak() [1/2]

Iterator getBasePeak ( )

return the peak with the highest intensity. If the peak is not unique, the first peak in the container is returned. The function works correctly, even if the mobilogram is unsorted.

◆ getBasePeak() [2/2]

ConstIterator getBasePeak ( ) const

return the peak with the highest intensity. If the peak is not unique, the first peak in the container is returned. The function works correctly, even if the mobilogram is unsorted.

◆ getDriftTimeUnit()

DriftTimeUnit getDriftTimeUnit ( ) const
inlinenoexcept

Returns the ion mobility drift time unit.

◆ getDriftTimeUnitAsString()

String getDriftTimeUnitAsString ( ) const

returns the ion mobility drift time unit as string

◆ getRT()

double getRT ( ) const
inlinenoexcept

Referenced by DimRT::map().

◆ insert()

Iterator insert ( ConstIterator  where,
ConstIterator  first,
ConstIterator  last 
)
inline

◆ isSorted() [1/2]

bool isSorted ( ) const

Checks if all peaks are sorted with respect to ascending mobility.

◆ isSorted() [2/2]

bool isSorted ( const Predicate &  lambda) const
inline

Checks if container is sorted by a certain user-defined property. You can pass any lambda function with [](Size index_1, Size index_2) –> bool which given two indices into Mobilogram (either for peaks or data arrays) returns a weak-ordering. (you need to capture the Mobilogram in the lambda and operate on it, based on the indices)

◆ MBBegin() [1/4]

ConstIterator MBBegin ( ConstIterator  begin,
CoordinateType  mb,
ConstIterator  end 
) const

Binary search for peak range begin.

Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.

◆ MBBegin() [2/4]

Iterator MBBegin ( CoordinateType  mb)

Binary search for peak range begin.

Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.

◆ MBBegin() [3/4]

ConstIterator MBBegin ( CoordinateType  mb) const

Binary search for peak range begin.

Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.

◆ MBBegin() [4/4]

Iterator MBBegin ( Iterator  begin,
CoordinateType  mb,
Iterator  end 
)

Binary search for peak range begin.

Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.

◆ MBEnd() [1/4]

ConstIterator MBEnd ( ConstIterator  begin,
CoordinateType  mb,
ConstIterator  end 
) const

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

Note
Make sure the mobilogram is sorted with respect to mobility. Otherwise the result is undefined.

◆ MBEnd() [2/4]

Iterator MBEnd ( CoordinateType  mb)

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

Note
Make sure the mobilogram is sorted with respect to mobility. Otherwise the result is undefined.

◆ MBEnd() [3/4]

ConstIterator MBEnd ( CoordinateType  mb) const

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

Note
Make sure the mobilogram is sorted with respect to mobility. Otherwise the result is undefined.

◆ MBEnd() [4/4]

Iterator MBEnd ( Iterator  begin,
CoordinateType  mb,
Iterator  end 
)

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

Note
Make sure the mobilogram is sorted with respect to mobility. Otherwise the result is undefined.

◆ operator!=()

bool operator!= ( const Mobilogram rhs) const
inline

Equality operator.

References OpenMS::Internal::operator==().

◆ operator=() [1/2]

Mobilogram& operator= ( const Mobilogram source)
default

Assignment operator.

◆ operator=() [2/2]

Mobilogram& operator= ( Mobilogram &&  )
defaultnoexcept

Move assignment operator.

◆ operator==()

bool operator== ( const Mobilogram rhs) const

Equality operator.

◆ operator[]() [1/2]

const MobilityPeak1D& operator[] ( Size  i) const
inlinenoexcept

◆ operator[]() [2/2]

MobilityPeak1D& operator[] ( Size  i)
inlinenoexcept

◆ pop_back()

void pop_back ( )
inline

◆ PosBegin() [1/4]

ConstIterator PosBegin ( ConstIterator  begin,
CoordinateType  mb,
ConstIterator  end 
) const

Binary search for peak range begin.

Alias for MBBegin()

Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.

◆ PosBegin() [2/4]

Iterator PosBegin ( CoordinateType  mb)

Binary search for peak range begin.

Alias for MBBegin()

Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.

◆ PosBegin() [3/4]

ConstIterator PosBegin ( CoordinateType  mb) const

Binary search for peak range begin.

Alias for MBBegin()

Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.

◆ PosBegin() [4/4]

Iterator PosBegin ( Iterator  begin,
CoordinateType  mb,
Iterator  end 
)

Binary search for peak range begin.

Alias for MBBegin()

Note
Make sure the mobilogram is sorted with respect to mobility! Otherwise the result is undefined.

◆ PosEnd() [1/4]

ConstIterator PosEnd ( ConstIterator  begin,
CoordinateType  mb,
ConstIterator  end 
) const

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

Alias for MBEnd()

Note
Make sure the mobilogram is sorted with respect to mobility. Otherwise the result is undefined.

◆ PosEnd() [2/4]

Iterator PosEnd ( CoordinateType  mb)

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

Alias for MBEnd()

Note
Make sure the mobilogram is sorted with respect to mobility. Otherwise the result is undefined.

◆ PosEnd() [3/4]

ConstIterator PosEnd ( CoordinateType  mb) const

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

Alias for MBEnd()

Note
Make sure the mobilogram is sorted with respect to mobility. Otherwise the result is undefined.

◆ PosEnd() [4/4]

Iterator PosEnd ( Iterator  begin,
CoordinateType  mb,
Iterator  end 
)

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

Alias for MBEnd()

Note
Make sure the mobilogram is sorted with respect to mobility. Otherwise the result is undefined.

◆ push_back()

void push_back ( MobilityPeak1D  mb)
inline

◆ rbegin()

ReverseIterator rbegin ( )
inlinenoexcept

◆ rend()

ReverseIterator rend ( )
inlinenoexcept

◆ reserve()

void reserve ( size_t  new_size)
inline

◆ resize()

void resize ( size_t  new_size)
inline

◆ setDriftTimeUnit()

void setDriftTimeUnit ( DriftTimeUnit  dt)
noexcept

Sets the ion mobility drift time unit.

◆ setRT()

void setRT ( double  rt)
inlinenoexcept

Sets the retention time (in seconds)

◆ size()

size_t size ( ) const
inlinenoexcept

◆ sortByIntensity()

void sortByIntensity ( bool  reverse = false)

Lexicographically sorts the peaks by their intensity.

Sorts the peaks according to ascending intensity.

◆ sortByPosition()

void sortByPosition ( )

Lexicographically sorts the peaks by their position (mobility).

The mobilogram is sorted with respect to position (mobility).

◆ swap()

void swap ( Mobilogram mb)
inlinenoexcept

◆ updateRanges()

void updateRanges ( )
overridevirtual

implement this function to reflect the underlying data of the derived class (e.g. an MSSpectrum) Usually, call clearRanges() internally and then populate the dimensions.

Implements RangeManagerContainer< RangeMobility, RangeIntensity >.

Member Data Documentation

◆ data_

std::vector<MobilityPeak1D> data_
protected

the actual peaks

◆ drift_time_unit_

DriftTimeUnit drift_time_unit_ = DriftTimeUnit::NONE
protected

Drift time unit.

◆ retention_time_

double retention_time_ = -1
protected

Retention time.