67 private std::vector<Peak1D>,
88 Chunk(
Size start,
Size end,
bool sorted) : start(start), end(end), is_sorted(sorted) {}
94 void add(
bool is_sorted)
96 chunks_.emplace_back((chunks_.empty() ? 0 : chunks_.back().end), spec_.size(), is_sorted);
131 typedef typename ContainerType::iterator
Iterator;
143 using ContainerType::operator[];
144 using ContainerType::begin;
145 using ContainerType::rbegin;
146 using ContainerType::end;
147 using ContainerType::rend;
148 using ContainerType::cbegin;
149 using ContainerType::cend;
150 using ContainerType::resize;
151 using ContainerType::size;
152 using ContainerType::push_back;
153 using ContainerType::emplace_back;
154 using ContainerType::pop_back;
155 using ContainerType::empty;
156 using ContainerType::front;
157 using ContainerType::back;
158 using ContainerType::reserve;
159 using ContainerType::insert;
160 using ContainerType::erase;
161 using ContainerType::swap;
163 using typename ContainerType::iterator;
164 using typename ContainerType::const_iterator;
165 using typename ContainerType::size_type;
166 using typename ContainerType::value_type;
167 using typename ContainerType::reference;
168 using typename ContainerType::const_reference;
169 using typename ContainerType::pointer;
170 using typename ContainerType::difference_type;
206 void updateRanges()
override;
211 double getRT()
const;
214 void setRT(
double rt);
224 double getDriftTime()
const;
229 void setDriftTime(
double dt);
237 String getDriftTimeUnitAsString()
const;
249 UInt getMSLevel()
const;
252 void setMSLevel(
UInt ms_level);
255 const String& getName()
const;
258 void setName(
const String& name);
275 const FloatDataArrays& getFloatDataArrays()
const;
281 return float_data_arrays_;
285 void setFloatDataArrays(
const FloatDataArrays& fda);
288 const StringDataArrays& getStringDataArrays()
const;
291 StringDataArrays& getStringDataArrays();
294 void setStringDataArrays(
const StringDataArrays& sda);
297 const IntegerDataArrays& getIntegerDataArrays()
const;
300 IntegerDataArrays& getIntegerDataArrays();
303 void setIntegerDataArrays(
const IntegerDataArrays& ida);
313 void sortByIntensity(
bool reverse =
false);
320 void sortByPosition();
326 void sortByPositionPresorted(
const std::vector<Chunk>& chunks);
329 bool isSorted()
const;
335 template<
class Predicate>
338 auto value_2_index_wrapper = [
this, &lambda](
const value_type& value1,
const value_type& value2) {
340 const Size index1 = (&value1) - (&this->front());
341 const Size index2 = (&value2) - (&this->front());
343 assert(index1 < this->size());
344 assert(index2 < this->size());
345 return lambda(index1, index2);
347 return std::is_sorted(this->begin(), this->end(), value_2_index_wrapper);
354 template<
class Predicate>
355 void sort(
const Predicate& lambda)
357 std::vector<Size> indices(this->size());
358 std::iota(indices.begin(), indices.end(), 0);
359 std::stable_sort(indices.begin(), indices.end(), lambda);
377 Size findNearest(CoordinateType mz)
const;
390 Int findNearest(CoordinateType mz, CoordinateType tolerance)
const;
405 Int findNearest(CoordinateType mz, CoordinateType tolerance_left, CoordinateType tolerance_right)
const;
418 Int findHighestInWindow(CoordinateType mz, CoordinateType tolerance_left, CoordinateType tolerance_right)
const;
425 Iterator MZBegin(CoordinateType mz);
453 ConstIterator MZBegin(CoordinateType mz)
const;
460 ConstIterator MZBegin(ConstIterator begin, CoordinateType mz, ConstIterator end)
const;
467 ConstIterator MZEnd(CoordinateType mz)
const;
474 ConstIterator MZEnd(ConstIterator begin, CoordinateType mz, ConstIterator end)
const;
483 Iterator PosBegin(CoordinateType mz);
501 ConstIterator PosBegin(CoordinateType mz)
const;
510 ConstIterator PosBegin(ConstIterator begin, CoordinateType mz, ConstIterator end)
const;
537 ConstIterator PosEnd(CoordinateType mz)
const;
546 ConstIterator PosEnd(ConstIterator begin, CoordinateType mz, ConstIterator end)
const;
550 bool containsIMData()
const;
559 std::pair<Size, DriftTimeUnit> getIMData()
const;
575 void clear(
bool clear_meta_data);
584 MSSpectrum& select(
const std::vector<Size>& indices);
602 ConstIterator getBasePeak()
const;
639 os <<
"-- MSSPECTRUM BEGIN --" << std::endl;
642 os << static_cast<const SpectrumSettings&>(spec);
647 os << *it << std::endl;
650 os <<
"-- MSSPECTRUM END --" << std::endl;
void sort(const Predicate &lambda)
Definition: MSSpectrum.h:355
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:112
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:634
std::vector< Chunk > & getChunks()
Definition: MSSpectrum.h:98
SpectrumType
Spectrum peak type.
Definition: SpectrumSettings.h:70
StringDataArrays string_data_arrays_
String data arrays.
Definition: MSSpectrum.h:631
Comparator for the retention time.
Definition: MSSpectrum.h:74
ContainerType::reverse_iterator ReverseIterator
Mutable reverse iterator.
Definition: MSSpectrum.h:136
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:134
OpenMS::DataArrays::FloatDataArray FloatDataArray
Float data array vector type.
Definition: MSSpectrum.h:119
RangeManager< RangeMZ, RangeIntensity > RangeManagerType
Definition: MSSpectrum.h:117
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:625
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
const MSSpectrum & spec_
Definition: MSSpectrum.h:104
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:132
std::vector< Chunk > chunks_
Definition: MSSpectrum.h:103
Chunks(const MSSpectrum &s)
Definition: MSSpectrum.h:93
std::vector< FloatDataArray > FloatDataArrays
Definition: MSSpectrum.h:120
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:628
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:91
bool operator!=(const MSSpectrum &rhs) const
Equality operator.
Definition: MSSpectrum.h:200
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:123
bool isSorted(const Predicate &lambda) const
Definition: MSSpectrum.h:336
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:279
std::vector< PeakType > ContainerType
Spectrum base type.
Definition: MSSpectrum.h:114
RangeManagerContainer< RangeMZ, RangeIntensity > RangeManagerContainerType
RangeManager.
Definition: MSSpectrum.h:116
OpenMS::DataArrays::StringDataArray StringDataArray
String data array vector type.
Definition: MSSpectrum.h:122
Chunk(Size start, Size end, bool sorted)
Definition: MSSpectrum.h:88
std::vector< IntegerDataArray > IntegerDataArrays
Definition: MSSpectrum.h:126
DriftTimeUnit drift_time_unit_
Drift time unit.
Definition: MSSpectrum.h:619
void add(bool is_sorted)
Definition: MSSpectrum.h:94
double retention_time_
Retention time.
Definition: MSSpectrum.h:613
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:622
OpenMS::DataArrays::IntegerDataArray IntegerDataArray
Integer data array vector type.
Definition: MSSpectrum.h:125
double drift_time_
Drift time.
Definition: MSSpectrum.h:616
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:138
Size end
not inclusive
Definition: MSSpectrum.h:86