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;
281 return float_data_arrays_;
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);
639 os <<
"-- MSSPECTRUM BEGIN --" << std::endl;
642 os << static_cast<const SpectrumSettings&>(spec);
647 os << *it << std::endl;
650 os <<
"-- MSSPECTRUM END --" << std::endl;
Float data array class.
Definition: DataArrays.h:48
Integer data array class.
Definition: DataArrays.h:55
String data array class.
Definition: DataArrays.h:62
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
void setIntegerDataArrays(const IntegerDataArrays &ida)
Sets the integer meta data arrays.
ConstIterator MZBegin(CoordinateType mz) const
Binary search for peak range begin.
FloatDataArrays & getFloatDataArrays()
Returns a mutable reference to the float meta data arrays.
Definition: MSSpectrum.h:279
UInt ms_level_
MS level.
Definition: MSSpectrum.h:622
Iterator MZBegin(Iterator begin, CoordinateType mz, Iterator end)
Binary search for peak range begin.
RangeManagerContainer< RangeMZ, RangeIntensity > RangeManagerContainerType
RangeManager.
Definition: MSSpectrum.h:116
PeakType::CoordinateType CoordinateType
Coordinate (m/z) type.
Definition: MSSpectrum.h:112
Iterator PosEnd(Iterator begin, CoordinateType mz, Iterator end)
Binary search for peak range end (returns the past-the-end iterator)
void setMSLevel(UInt ms_level)
Sets the MS level.
Int findNearest(CoordinateType mz, CoordinateType tolerance) const
Binary search for the peak nearest to a specific m/z given a +/- tolerance windows in Th.
ConstIterator PosBegin(CoordinateType mz) const
Binary search for peak range begin.
std::vector< StringDataArray > StringDataArrays
Definition: MSSpectrum.h:123
OpenMS::DataArrays::FloatDataArray FloatDataArray
Float data array vector type.
Definition: MSSpectrum.h:119
bool operator!=(const MSSpectrum &rhs) const
Equality operator.
Definition: MSSpectrum.h:200
Iterator PosBegin(Iterator begin, CoordinateType mz, Iterator end)
Binary search for peak range begin.
SpectrumSettings::SpectrumType getType(const bool query_data) const
Determine if spectrum is profile or centroided using up to three layers of information.
String name_
Name.
Definition: MSSpectrum.h:625
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:134
MSSpectrum(const MSSpectrum &source)
Copy constructor.
String getDriftTimeUnitAsString() const
returns the ion mobility drift time unit as string
bool containsIMData() const
StringDataArrays & getStringDataArrays()
Returns a mutable reference to the string meta data arrays.
ContainerType::reverse_iterator ReverseIterator
Mutable reverse iterator.
Definition: MSSpectrum.h:136
ConstIterator PosBegin(ConstIterator begin, CoordinateType mz, ConstIterator end) const
Binary search for peak range begin.
double drift_time_
Drift time.
Definition: MSSpectrum.h:616
MSSpectrum & operator=(const SpectrumSettings &source)
Assignment operator.
void setDriftTimeUnit(DriftTimeUnit dt)
Sets the ion mobility drift time unit.
std::vector< PeakType > ContainerType
Spectrum base type.
Definition: MSSpectrum.h:114
ContainerType::const_reverse_iterator ConstReverseIterator
Non-mutable reverse iterator.
Definition: MSSpectrum.h:138
bool isSorted() const
Checks if all peaks are sorted with respect to ascending m/z.
ConstIterator MZBegin(ConstIterator begin, CoordinateType mz, ConstIterator end) const
Binary search for peak range begin.
MSSpectrum & select(const std::vector< Size > &indices)
RangeManager< RangeMZ, RangeIntensity > RangeManagerType
Definition: MSSpectrum.h:117
Iterator MZEnd(Iterator begin, CoordinateType mz, Iterator end)
Binary search for peak range end (returns the past-the-end iterator)
void setName(const String &name)
Sets the name.
Iterator MZBegin(CoordinateType mz)
Binary search for peak range begin.
ConstIterator PosEnd(ConstIterator begin, CoordinateType mz, ConstIterator end) const
Binary search for peak range end (returns the past-the-end iterator)
void sortByPosition()
Lexicographically sorts the peaks by their position.
ConstIterator MZEnd(ConstIterator begin, CoordinateType mz, ConstIterator end) const
Binary search for peak range end (returns the past-the-end iterator)
StringDataArrays string_data_arrays_
String data arrays.
Definition: MSSpectrum.h:631
ConstIterator MZEnd(CoordinateType mz) const
Binary search for peak range end (returns the past-the-end iterator)
void sortByIntensity(bool reverse=false)
Lexicographically sorts the peaks by their intensity.
void sortByPositionPresorted(const std::vector< Chunk > &chunks)
Sort the spectrum, but uses the fact, that certain chunks are presorted.
DriftTimeUnit getDriftTimeUnit() const
Returns the ion mobility drift time unit.
const IntegerDataArrays & getIntegerDataArrays() const
Returns a const reference to the integer meta data arrays.
MSSpectrum(MSSpectrum &&)=default
Move constructor.
IntegerDataArrays integer_data_arrays_
Integer data arrays.
Definition: MSSpectrum.h:634
void sort(const Predicate &lambda)
Definition: MSSpectrum.h:355
OpenMS::DataArrays::StringDataArray StringDataArray
String data array vector type.
Definition: MSSpectrum.h:122
~MSSpectrum()=default
Destructor.
std::pair< Size, DriftTimeUnit > getIMData() const
Get the Ion mobility data array's index and its associated unit.
bool operator==(const MSSpectrum &rhs) const
Equality operator.
double retention_time_
Retention time.
Definition: MSSpectrum.h:613
PeakType::IntensityType calculateTIC() const
compute the total ion count (sum of all peak intensities)
UInt getMSLevel() const
Returns the MS level.
const String & getName() const
Returns the name.
Iterator PosEnd(CoordinateType mz)
Binary search for peak range end (returns the past-the-end iterator)
bool isSorted(const Predicate &lambda) const
Definition: MSSpectrum.h:336
FloatDataArrays float_data_arrays_
Float data arrays.
Definition: MSSpectrum.h:628
ConstIterator getBasePeak() const
Iterator PosBegin(CoordinateType mz)
Binary search for peak range begin.
Size findNearest(CoordinateType mz) const
Binary search for the peak nearest to a specific m/z.
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
void setStringDataArrays(const StringDataArrays &sda)
Sets the string meta data arrays.
Int findHighestInWindow(CoordinateType mz, CoordinateType tolerance_left, CoordinateType tolerance_right) const
Search for the peak with highest intensity among the peaks near to a specific m/z given two +/- toler...
Iterator MZEnd(CoordinateType mz)
Binary search for peak range end (returns the past-the-end iterator)
const StringDataArrays & getStringDataArrays() const
Returns a const reference to the string meta data arrays.
MSSpectrum & operator=(const MSSpectrum &source)
Assignment operator.
double getDriftTime() const
Returns the ion mobility drift time (MSSpectrum::DRIFTTIME_NOT_SET means it is not set)
std::vector< FloatDataArray > FloatDataArrays
Definition: MSSpectrum.h:120
void updateRanges() override
OpenMS::DataArrays::IntegerDataArray IntegerDataArray
Integer data array vector type.
Definition: MSSpectrum.h:125
DriftTimeUnit drift_time_unit_
Drift time unit.
Definition: MSSpectrum.h:619
MSSpectrum & operator=(MSSpectrum &&) &=default
Move assignment operator.
void clear(bool clear_meta_data)
Clears all data and meta data.
void setDriftTime(double dt)
Sets the ion mobility drift time.
std::vector< IntegerDataArray > IntegerDataArrays
Definition: MSSpectrum.h:126
IntegerDataArrays & getIntegerDataArrays()
Returns a mutable reference to the integer meta data arrays.
void setRT(double rt)
Sets the absolute retention time (in seconds)
void setFloatDataArrays(const FloatDataArrays &fda)
Sets the float meta data arrays.
Int findNearest(CoordinateType mz, CoordinateType tolerance_left, CoordinateType tolerance_right) const
Search for the peak nearest to a specific m/z given two +/- tolerance windows in Th.
ConstIterator PosEnd(CoordinateType mz) const
Binary search for peak range end (returns the past-the-end iterator)
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
double CoordinateType
Coordinate type.
Definition: Peak1D.h:66
float IntensityType
Intensity type.
Definition: Peak1D.h:62
Definition: RangeManager.h:921
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra.
Definition: RangeManager.h:589
Representation of 1D spectrum settings.
Definition: SpectrumSettings.h:65
SpectrumType getType() const
returns the spectrum type (centroided (PEAKS) or profile data (RAW))
SpectrumType
Spectrum peak type.
Definition: SpectrumSettings.h:71
A more convenient string class.
Definition: String.h:60
int Int
Signed integer type.
Definition: Types.h:102
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
bool operator==(const IDBoostGraph::ProteinGroup &lhs, const IDBoostGraph::ProteinGroup &rhs)
static String & reverse(String &this_s)
Definition: StringUtilsSimple.h:350
FLASHIda C++ to C# (or vice versa) bridge functions The functions here are called in C# to invoke fun...
Definition: FeatureDeconvolution.h:48
Peak2D PeakType
Definition: MassTrace.h:47
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
DriftTimeUnit
Drift time unit for ion mobility.
Definition: IMTypes.h:49
Used to remember what subsets in a spectrum are sorted already to allow faster sorting of the spectru...
Definition: MSSpectrum.h:84
Chunk(Size start, Size end, bool sorted)
Definition: MSSpectrum.h:88
Size end
not inclusive
Definition: MSSpectrum.h:86
bool is_sorted
are the Peaks in [start, end) sorted yet?
Definition: MSSpectrum.h:87
Size start
inclusive
Definition: MSSpectrum.h:85
Definition: MSSpectrum.h:91
std::vector< Chunk > chunks_
Definition: MSSpectrum.h:103
const MSSpectrum & spec_
Definition: MSSpectrum.h:104
std::vector< Chunk > & getChunks()
Definition: MSSpectrum.h:98
void add(bool is_sorted)
Definition: MSSpectrum.h:94
Chunks(const MSSpectrum &s)
Definition: MSSpectrum.h:93
Comparator for the ion mobility.
Definition: MSSpectrum.h:79
bool operator()(const MSSpectrum &a, const MSSpectrum &b) const
Comparator for the retention time.
Definition: MSSpectrum.h:75
bool operator()(const MSSpectrum &a, const MSSpectrum &b) const