67 private std::vector<Peak1D>,
88 Chunk(
Size p_start,
Size p_end,
bool p_sorted) : start(p_start), end(p_end), is_sorted(p_sorted)
96 void add(
bool is_sorted)
98 chunks_.emplace_back((chunks_.empty() ? 0 : chunks_.back().end), spec_.size(), is_sorted);
133 typedef typename ContainerType::iterator
Iterator;
145 using ContainerType::operator[];
146 using ContainerType::begin;
147 using ContainerType::rbegin;
148 using ContainerType::end;
149 using ContainerType::rend;
150 using ContainerType::cbegin;
151 using ContainerType::cend;
152 using ContainerType::resize;
153 using ContainerType::size;
154 using ContainerType::push_back;
155 using ContainerType::emplace_back;
156 using ContainerType::pop_back;
157 using ContainerType::empty;
158 using ContainerType::front;
159 using ContainerType::back;
160 using ContainerType::reserve;
161 using ContainerType::insert;
162 using ContainerType::erase;
163 using ContainerType::swap;
165 using typename ContainerType::iterator;
166 using typename ContainerType::const_iterator;
167 using typename ContainerType::size_type;
168 using typename ContainerType::value_type;
169 using typename ContainerType::reference;
170 using typename ContainerType::const_reference;
171 using typename ContainerType::pointer;
172 using typename ContainerType::difference_type;
208 void updateRanges()
override;
213 double getRT()
const;
216 void setRT(
double rt);
226 double getDriftTime()
const;
231 void setDriftTime(
double dt);
239 String getDriftTimeUnitAsString()
const;
251 UInt getMSLevel()
const;
254 void setMSLevel(
UInt ms_level);
257 const String& getName()
const;
260 void setName(
const String& name);
277 const FloatDataArrays& getFloatDataArrays()
const;
283 return float_data_arrays_;
287 void setFloatDataArrays(
const FloatDataArrays& fda);
290 const StringDataArrays& getStringDataArrays()
const;
293 StringDataArrays& getStringDataArrays();
296 void setStringDataArrays(
const StringDataArrays& sda);
299 const IntegerDataArrays& getIntegerDataArrays()
const;
302 IntegerDataArrays& getIntegerDataArrays();
305 void setIntegerDataArrays(
const IntegerDataArrays& ida);
315 void sortByIntensity(
bool reverse =
false);
322 void sortByPosition();
328 void sortByPositionPresorted(
const std::vector<Chunk>& chunks);
331 bool isSorted()
const;
337 template<
class Predicate>
340 auto value_2_index_wrapper = [
this, &lambda](
const value_type& value1,
const value_type& value2) {
342 const Size index1 = (&value1) - (&this->front());
343 const Size index2 = (&value2) - (&this->front());
345 assert(index1 < this->size());
346 assert(index2 < this->size());
347 return lambda(index1, index2);
349 return std::is_sorted(this->begin(), this->end(), value_2_index_wrapper);
356 template<
class Predicate>
357 void sort(
const Predicate& lambda)
359 std::vector<Size> indices(this->size());
360 std::iota(indices.begin(), indices.end(), 0);
361 std::stable_sort(indices.begin(), indices.end(), lambda);
379 Size findNearest(CoordinateType mz)
const;
392 Int findNearest(CoordinateType mz, CoordinateType tolerance)
const;
407 Int findNearest(CoordinateType mz, CoordinateType tolerance_left, CoordinateType tolerance_right)
const;
420 Int findHighestInWindow(CoordinateType mz, CoordinateType tolerance_left, CoordinateType tolerance_right)
const;
427 Iterator MZBegin(CoordinateType mz);
455 ConstIterator MZBegin(CoordinateType mz)
const;
462 ConstIterator MZBegin(ConstIterator begin, CoordinateType mz, ConstIterator end)
const;
469 ConstIterator MZEnd(CoordinateType mz)
const;
476 ConstIterator MZEnd(ConstIterator begin, CoordinateType mz, ConstIterator end)
const;
485 Iterator PosBegin(CoordinateType mz);
503 ConstIterator PosBegin(CoordinateType mz)
const;
512 ConstIterator PosBegin(ConstIterator begin, CoordinateType mz, ConstIterator end)
const;
539 ConstIterator PosEnd(CoordinateType mz)
const;
548 ConstIterator PosEnd(ConstIterator begin, CoordinateType mz, ConstIterator end)
const;
552 bool containsIMData()
const;
561 std::pair<Size, DriftTimeUnit> getIMData()
const;
577 void clear(
bool clear_meta_data);
586 MSSpectrum& select(
const std::vector<Size>& indices);
604 ConstIterator getBasePeak()
const;
641 os <<
"-- MSSPECTRUM BEGIN --" << std::endl;
644 os << static_cast<const SpectrumSettings&>(spec);
649 os << *it << std::endl;
652 os <<
"-- MSSPECTRUM END --" << std::endl;
void sort(const Predicate &lambda)
Definition: MSSpectrum.h:357
bool is_sorted
are the Peaks in [start, end) sorted yet?
Definition: MSSpectrum.h:87
PeakType::CoordinateType CoordinateType
Coordinate (m/z) type.
Definition: MSSpectrum.h:114
DriftTimeUnit
Drift time unit for ion mobility.
Definition: IMTypes.h:48
A more convenient string class.
Definition: String.h:58
IntegerDataArrays integer_data_arrays_
Integer data arrays.
Definition: MSSpectrum.h:636
std::vector< Chunk > & getChunks()
Definition: MSSpectrum.h:100
SpectrumType
Spectrum peak type.
Definition: SpectrumSettings.h:70
StringDataArrays string_data_arrays_
String data arrays.
Definition: MSSpectrum.h:633
Comparator for the retention time.
Definition: MSSpectrum.h:74
ContainerType::reverse_iterator ReverseIterator
Mutable reverse iterator.
Definition: MSSpectrum.h:138
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
Peak2D PeakType
Definition: MassTrace.h:47
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:136
OpenMS::DataArrays::FloatDataArray FloatDataArray
Float data array vector type.
Definition: MSSpectrum.h:121
RangeManager< RangeMZ, RangeIntensity > RangeManagerType
Definition: MSSpectrum.h:119
Representation of 1D spectrum settings.
Definition: SpectrumSettings.h:63
bool operator==(const IDBoostGraph::ProteinGroup &lhs, const IDBoostGraph::ProteinGroup &rhs)
String name_
Name.
Definition: MSSpectrum.h:627
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
const MSSpectrum & spec_
Definition: MSSpectrum.h:106
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:134
std::vector< Chunk > chunks_
Definition: MSSpectrum.h:105
Chunk(Size p_start, Size p_end, bool p_sorted)
Definition: MSSpectrum.h:88
Chunks(const MSSpectrum &s)
Definition: MSSpectrum.h:95
std::vector< FloatDataArray > FloatDataArrays
Definition: MSSpectrum.h:122
Float data array class.
Definition: DataArrays.h:45
Integer data array class.
Definition: DataArrays.h:52
FloatDataArrays float_data_arrays_
Float data arrays.
Definition: MSSpectrum.h:630
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
SpectrumType getType() const
returns the spectrum type (centroided (PEAKS) or profile data (RAW))
Definition: MSSpectrum.h:93
bool operator!=(const MSSpectrum &rhs) const
Equality operator.
Definition: MSSpectrum.h:202
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:53
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
Used to remember what subsets in a spectrum are sorted already to allow faster sorting of the spectru...
Definition: MSSpectrum.h:84
std::vector< StringDataArray > StringDataArrays
Definition: MSSpectrum.h:125
bool isSorted(const Predicate &lambda) const
Definition: MSSpectrum.h:338
static String & reverse(String &this_s)
Definition: StringUtilsSimple.h:355
FloatDataArrays & getFloatDataArrays()
Returns a mutable reference to the float meta data arrays.
Definition: MSSpectrum.h:281
std::vector< PeakType > ContainerType
Spectrum base type.
Definition: MSSpectrum.h:116
RangeManagerContainer< RangeMZ, RangeIntensity > RangeManagerContainerType
RangeManager.
Definition: MSSpectrum.h:118
OpenMS::DataArrays::StringDataArray StringDataArray
String data array vector type.
Definition: MSSpectrum.h:124
std::vector< IntegerDataArray > IntegerDataArrays
Definition: MSSpectrum.h:128
DriftTimeUnit drift_time_unit_
Drift time unit.
Definition: MSSpectrum.h:621
void add(bool is_sorted)
Definition: MSSpectrum.h:96
double retention_time_
Retention time.
Definition: MSSpectrum.h:615
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
UInt ms_level_
MS level.
Definition: MSSpectrum.h:624
OpenMS::DataArrays::IntegerDataArray IntegerDataArray
Integer data array vector type.
Definition: MSSpectrum.h:127
double drift_time_
Drift time.
Definition: MSSpectrum.h:618
String data array class.
Definition: DataArrays.h:59
Size start
inclusive
Definition: MSSpectrum.h:85
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra...
Definition: RangeManager.h:565
Definition: RangeManager.h:896
Comparator for the ion mobility.
Definition: MSSpectrum.h:79
int Int
Signed integer type.
Definition: Types.h:102
ContainerType::const_reverse_iterator ConstReverseIterator
Non-mutable reverse iterator.
Definition: MSSpectrum.h:140
Size end
not inclusive
Definition: MSSpectrum.h:86