16#include <unordered_map>
36namespace CometNativeIDRemapper
74 if (exp.
empty()) {
return; }
77 std::unordered_map<std::string, std::string> id_map;
78 id_map.reserve(exp.
size());
83 if (id_map.empty()) {
return; }
85 for (
auto& pid : pids)
87 auto it = id_map.find(pid.getSpectrumReference());
88 if (it != id_map.end()) { pid.setSpectrumReference(it->second); }
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
bool empty() const noexcept
Are there any spectra (does not consider chromatograms)
Size size() const noexcept
The number of spectra.
const std::vector< MSSpectrum > & getSpectra() const
returns the spectrum list
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Size rewriteToIndex(MSExperiment &exp)
Rewrite every spectrum's native ID to "index=N" (monotonic, 0-based).
Definition CometNativeIDRemapper.h:50
void translateReferencesBack(const MSExperiment &exp, PeptideIdentificationList &pids)
Translate PSM spectrum references from the rewritten "index=N" form back to the original IDs.
Definition CometNativeIDRemapper.h:72
const std::string ORIGINAL_NATIVE_ID
MetaValue key under which the original native ID is stashed by rewriteToIndex().
Definition CometNativeIDRemapper.h:39
std::string toStr(int i)
Definition StringUtils.h:257
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19