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

Method registerObservation

src/openms/source/METADATA/ID/IdentificationData.cpp:323–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321 }
322
323 IdentificationData::ObservationRef
324 IdentificationData::registerObservation(const Observation& obs)
325 {
326 if (!no_checks_)
327 {
328 // reference to spectrum or feature is required:
329 if (obs.data_id.empty())
330 {
331 String msg = "missing identifier in observation";
332 throw Exception::IllegalArgument(__FILE__, __LINE__,
333 OPENMS_PRETTY_FUNCTION, msg);
334 }
335 // ref. to input file must be valid:
336 if (!isValidReference_(obs.input_file, input_files_))
337 {
338 String msg = "invalid reference to an input file - register that first";
339 throw Exception::IllegalArgument(__FILE__, __LINE__,
340 OPENMS_PRETTY_FUNCTION, msg);
341 }
342 }
343
344 // can't use "insertIntoMultiIndex_" because Observation doesn't have the
345 // "steps_and_scores" member (from ScoredProcessingResult)
346 auto result = observations_.insert(obs);
347 if (!result.second) // existing element - merge in new information
348 {
349 observations_.modify(result.first, [&obs](Observation& existing)
350 {
351 existing.merge(obs);
352 });
353 }
354 // add address of new element to look-up table (for existence checks):
355 observation_lookup_.insert(uintptr_t(&(*result.first)));
356
357 // @TODO: add processing step? (currently not supported by Observation)
358 return result.first;
359 }
360
361
362 IdentificationData::IdentifiedPeptideRef

Callers 7

postProcessHits_Method · 0.80
addMatchesToID_Method · 0.80
loadObservations_Method · 0.80
importIDsMethod · 0.80
handleFeatureExport_Method · 0.80
exportConsensusIDsMethod · 0.80

Calls 4

isValidReference_Function · 0.85
emptyMethod · 0.45
insertMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected