OpenMS
2.8.0
|
This is a binned representation of a PeakSpectrum. More...
#include <OpenMS/COMPARISON/SPECTRA/BinnedSpectrum.h>
Public Types | |
using | SparseVectorType = Eigen::SparseVector< float, 0, int > |
typedef for the underlying sparse vector More... | |
Public Member Functions | |
BinnedSpectrum () | |
the empty SparseVector More... | |
BinnedSpectrum (const PeakSpectrum &ps, float size, bool unit_ppm, UInt spread, float offset) | |
detailed constructor More... | |
BinnedSpectrum (const BinnedSpectrum &) | |
copy constructor More... | |
virtual | ~BinnedSpectrum () |
destructor More... | |
BinnedSpectrum & | operator= (const BinnedSpectrum &) |
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... | |
size_t | 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.0005f |
static constexpr const float | DEFAULT_BIN_WIDTH_HIRES = 0.02f |
static constexpr const float | DEFAULT_BIN_OFFSET_HIRES = 0.0f |
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.4f |
default bin offset for low-resolution data (adapted from doi:10.1007/s13361-015-1179-x) 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 SparseVectorType = Eigen::SparseVector<float, 0, int> |
typedef for the underlying sparse vector
|
inline |
the empty SparseVector
default constructor
BinnedSpectrum | ( | const PeakSpectrum & | ps, |
float | size, | ||
bool | unit_ppm, | ||
UInt | spread, | ||
float | offset | ||
) |
detailed constructor
BinnedSpectrum | ( | const BinnedSpectrum & | ) |
copy constructor
|
virtual |
destructor
|
private |
calculate binning of peak spectrum
size_t getBinIndex | ( | float | mz | ) | const |
return the bin index of a given m/z position
float getBinIntensity | ( | double | mz | ) |
returns the bin intensity at a given m/z position
|
inline |
return the lower m/z of a bin given its index
SparseVectorType* getBins | ( | ) |
mutable access to the bin container
const SparseVectorType* getBins | ( | ) | const |
immutable access to the bin container
|
inline |
get the bin size
|
inline |
get the bin spread
|
inline |
return offset
std::vector<Precursor>& getPrecursors | ( | ) |
mutable access to precursors
const std::vector<Precursor>& getPrecursors | ( | ) | const |
immutable access to precursors
|
static |
Check if two BinnedSpectrum objects have equally sized bins and offset.
bool operator!= | ( | const BinnedSpectrum & | rhs | ) | const |
inequality operator
BinnedSpectrum& operator= | ( | const BinnedSpectrum & | ) |
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
|
staticconstexpr |
default bin offset for high-resolution data (adapted from doi:10.1007/s13361-015-1179-x)
|
staticconstexpr |
default bin offset for low-resolution data (adapted from doi:10.1007/s13361-015-1179-x)
|
staticconstexpr |
|
staticconstexpr |
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. @TODO: Weighted intensity spread is currently not implemented(but could replace the spread parameter).
|
staticconstexprprivate |
|
private |
offset of bin start
|
private |
precursor information
|
private |
absolute bin size or relative bin size