|
OpenMS
2.6.0
|
Go to the documentation of this file.
40 #include <boost/regex.hpp>
102 template <
typename SpectrumContainer>
104 const String& scan_regexp = default_scan_regexp)
109 n_spectra_ = spectra.size();
110 setScanRegExp_(scan_regexp);
111 for (
Size i = 0; i < n_spectra_; ++i)
116 if (!scan_regexp.empty())
118 scan_no = extractScanNumber(native_id, scan_regexp_,
true);
121 OPENMS_LOG_WARN <<
"Warning: Could not extract scan number from spectrum native ID '" + native_id +
"' using regular expression '" + scan_regexp +
"'. Look-up by scan number may not work properly." << std::endl;
124 addEntry_(i, spectrum.
getRT(), scan_no, native_id);
139 Size findByRT(
double rt)
const;
150 Size findByNativeID(
const String& native_id)
const;
162 Size findByIndex(
Size index,
bool count_from_one =
false)
const;
173 Size findByScanNumber(
Size scan_number)
const;
187 Size findByReference(
const String& spectrum_ref)
const;
198 void addReferenceFormat(
const String& regexp);
211 static Int extractScanNumber(
const String& native_id,
212 const boost::regex& scan_regexp,
213 bool no_error =
false);
215 static Int extractScanNumber(
const String& native_id,
216 const String& native_id_type_accession);
241 void addEntry_(
Size index,
double rt,
Int scan_number,
256 const boost::smatch& match)
const;
263 void setScanRegExp_(
const String& scan_regexp);
std::map< String, Size > ids_
Mapping: native ID -> spectrum index.
Definition: SpectrumLookup.h:230
boost::regex scan_regexp_
Regular expression to extract scan numbers.
Definition: SpectrumLookup.h:225
A more convenient string class.
Definition: String.h:59
std::map< double, Size > rts_
Mapping: RT -> spectrum index.
Definition: SpectrumLookup.h:229
Size n_spectra_
Number of spectra.
Definition: SpectrumLookup.h:223
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
static const String & default_scan_regexp
Default regular expression for extracting scan numbers from spectrum native IDs.
Definition: SpectrumLookup.h:72
#define OPENMS_LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged.
Definition: LogStream.h:460
std::vector< String > regexp_name_list_
Named groups in vector format.
Definition: SpectrumLookup.h:227
static const String & regexp_names_
Named groups recognized in regular expression.
Definition: SpectrumLookup.h:221
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
std::map< Size, Size > scans_
Mapping: scan number -> spectrum index.
Definition: SpectrumLookup.h:231
double rt_tolerance
Tolerance for look-up by retention time.
Definition: SpectrumLookup.h:78
Helper class for looking up spectra based on different attributes.
Definition: SpectrumLookup.h:67
void readSpectra(const SpectrumContainer &spectra, const String &scan_regexp=default_scan_regexp)
Read and index spectra for later look-up.
Definition: SpectrumLookup.h:103
std::vector< boost::regex > reference_formats
Possible formats of spectrum references, defined as regular expressions.
Definition: SpectrumLookup.h:75
const String & getNativeID() const
returns the native identifier for the spectrum, used by the acquisition software.
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67