MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / extractScanNumber

Method extractScanNumber

src/openms/source/METADATA/SpectrumLookup.cpp:234–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232 }
233
234 Int SpectrumLookup::extractScanNumber(const String& native_id,
235 const boost::regex& scan_regexp,
236 bool no_error)
237 {
238 vector<string> matches;
239 boost::sregex_token_iterator current_begin(native_id.begin(), native_id.end(), scan_regexp, 1);
240 boost::sregex_token_iterator current_end(native_id.end(), native_id.end(), scan_regexp, 1);
241 matches.insert(matches.end(), current_begin, current_end);
242 if (!matches.empty())
243 {
244 // always use the last possible matching subgroup
245 String last_value = String(matches.back());
246 try
247 {
248 return last_value.toInt();
249 }
250 catch (Exception::ConversionError&)
251 {
252 }
253 }
254 if (!no_error)
255 {
256 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
257 native_id, "Could not extract scan number");
258 }
259 return -1;
260 }
261
262 Int SpectrumLookup::extractScanNumber(const String& native_id,
263 const String& native_id_type_accession)

Callers

nothing calls this directly

Calls 9

stringClass · 0.85
backMethod · 0.80
toIntMethod · 0.80
StringClass · 0.50
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected