OpenMS
2.4.0
|
This is a binned representation of a PeakSpectrum. More...
#include <OpenMS/COMPARISON/SPECTRA/BinnedSpectrum.h>
Public Types | |
using | SparseVectorType = Eigen::SparseVector< float > |
typedef for the underlying sparse vector More... | |
using | SparseVectorIndexType = Eigen::SparseVector< float >::Index |
typedef for the index into the sparse vector More... | |
using | SparseVectorIteratorType = Eigen::SparseVector< float >::InnerIterator |
typedef for the index into the sparse vector More... | |
Public Member Functions | |
BinnedSpectrum () | |
default constructor More... | |
BinnedSpectrum (const PeakSpectrum &ps, float size, bool unit_ppm, UInt spread, float offset) | |
detailed constructor More... | |
BinnedSpectrum (const BinnedSpectrum &)=default | |
copy constructor More... | |
virtual | ~BinnedSpectrum () |
destructor More... | |
BinnedSpectrum & | operator= (const BinnedSpectrum &)=default |
assignment operator More... | |
bool | operator== (const BinnedSpectrum &rhs) const |
equality operator More... | |
bool | operator!= (const BinnedSpectrum &rhs) const |
inequality operator More... | |
float | getBinIntensity (double mz) |
returns the bin intensity at a given m/z position More... | |
SparseVectorIndexType | getBinIndex (float mz) const |
return the bin index of a given m/z position More... | |
float | getBinLowerMZ (size_t i) const |
return the lower m/z of a bin given its index More... | |
float | getBinSize () const |
get the bin size More... | |
size_t | getBinSpread () const |
get the bin spread More... | |
const SparseVectorType & | getBins () const |
immutable access to the bin container More... | |
SparseVectorType & | getBins () |
mutable access to the bin container More... | |
float | getOffset () const |
return offset More... | |
const std::vector< Precursor > & | getPrecursors () const |
immutable access to precursors More... | |
std::vector< Precursor > & | getPrecursors () |
mutable access to precursors More... | |
Static Public Member Functions | |
static bool | isCompatible (const BinnedSpectrum &a, const BinnedSpectrum &b) |
Check if two BinnedSpectrum objects have equally sized bins and offset. More... | |
Static Public Attributes | |
static constexpr const float | DEFAULT_BIN_WIDTH_LOWRES = 1.0005 |
static constexpr const float | DEFAULT_BIN_WIDTH_HIRES = 0.02 |
static constexpr const float | DEFAULT_BIN_OFFSET_HIRES = 0.0 |
default bin offset for high-resolution data (adapted from doi:10.1007/s13361-015-1179-x) More... | |
static constexpr const float | DEFAULT_BIN_OFFSET_LOWRES = 0.4 |
default bin offset for low-resolution data (adapted from doi:10.1007/s13361-015-1179-x) More... | |
static const SparseVectorType | EmptySparseVector |
the empty SparseVector More... | |
Private Member Functions | |
void | binSpectrum_ (const PeakSpectrum &ps) |
calculate binning of peak spectrum More... | |
Private Attributes | |
UInt | bin_spread_ |
the spread to left or right More... | |
float | bin_size_ |
the size of each bin More... | |
bool | unit_ppm_ |
absolute bin size or relative bin size More... | |
float | offset_ |
offset of bin start More... | |
SparseVectorType | bins_ |
bins More... | |
std::vector< Precursor > | precursors_ |
precursor information More... | |
Static Private Attributes | |
static constexpr const float | MIN_MZ_ = 1.0 |
This is a binned representation of a PeakSpectrum.
sz | the size of the bins and |
sp | number of neighboring bins to both sides affected by a peak contribution |
ps | the PeakSpectrum, used to calculate the binned spectrum |
sz denotes the size of a bin in Th
, thereby deciding the number of bins (all of size sz) the spectrum is discretized to. Each bin will represent a certain Th
range and the peaks will be put in the respective bins and sum up inside. sp denotes the number of neighboring bins to the left and the number of neighboring bins to the right a peak is also added to. E.g. a BinnedSpectrum with binsize of 0.5 Th
will have a peak at 100 Th
in bin no. 200, a peak at 100.1 Th
will be in bin no. 201. If the binspread is 1, the peak at 100 Th will be added to bin no. 199, 200 and 201. If the binspread is 2, the peak at 100 Th
will also be added to bin no. 198 and 202, and so on.
Many operations are provided by the underlying SparseVector implementation:
Implementation detail: Eigen SparseVectors need to have the same dimensionality. EmptySparseVector provides an empty SparseVector with compatible dimension to perform all supported operations.
using SparseVectorIndexType = Eigen::SparseVector<float>::Index |
typedef for the index into the sparse vector
using SparseVectorIteratorType = Eigen::SparseVector<float>::InnerIterator |
typedef for the index into the sparse vector
using SparseVectorType = Eigen::SparseVector<float> |
typedef for the underlying sparse vector
|
inline |
default constructor
BinnedSpectrum | ( | const PeakSpectrum & | ps, |
float | size, | ||
bool | unit_ppm, | ||
UInt | spread, | ||
float | offset | ||
) |
detailed constructor
|
default |
copy constructor
|
virtual |
destructor
|
private |
calculate binning of peak spectrum
|
inline |
return the bin index of a given m/z position
|
inline |
return the lower m/z of a bin given its index
const SparseVectorType& getBins | ( | ) | const |
immutable access to the bin container
SparseVectorType& getBins | ( | ) |
mutable access to the bin container
|
inline |
get the bin size
|
inline |
get the bin spread
|
inline |
return offset
const std::vector<Precursor>& getPrecursors | ( | ) | const |
immutable access to precursors
std::vector<Precursor>& getPrecursors | ( | ) |
mutable access to precursors
|
static |
Check if two BinnedSpectrum objects have equally sized bins and offset.
bool operator!= | ( | const BinnedSpectrum & | rhs | ) | const |
inequality operator
|
default |
assignment operator
bool operator== | ( | const BinnedSpectrum & | rhs | ) | const |
equality operator
|
private |
the size of each bin
|
private |
the spread to left or right
|
private |
bins
|
static |
default bin offset for high-resolution data (adapted from doi:10.1007/s13361-015-1179-x)
|
static |
default bin offset for low-resolution data (adapted from doi:10.1007/s13361-015-1179-x)
|
static |
|
static |
Sensible default values and notes from doi:10.1007/s13361-015-1179-x Low-resolution MS/MS data: bin width = 1.0005 offset = 0.4 spread should be 0
High-resolution MS/MS data: bin width = 0.02 offset = 0.0 spread should be 0 Note: in sum scores, intensities from neighboring bins should be considered with half intensity of each flanking bin. : Weighted intensity spread is currently not implemented(but could replace the spread parameter).
|
static |
the empty SparseVector
|
staticprivate |
|
private |
offset of bin start
|
private |
precursor information
|
private |
absolute bin size or relative bin size