OpenMS
Loading...
Searching...
No Matches
IdentifierMSRunMapper.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
13#include <OpenMS/config.h>
14
15#include <map>
16#include <vector>
17
18namespace OpenMS
19{
20 // Forward declarations
21 class ProteinIdentification;
22 class PeptideIdentification;
23
50 class OPENMS_DLLAPI IdentifierMSRunMapper
51 {
52 public:
54
56 explicit IdentifierMSRunMapper(const std::vector<ProteinIdentification>& prot_ids);
57
59 void create(const std::vector<ProteinIdentification>& prot_ids);
60
62 std::string getPrimaryMSRunPath(const PeptideIdentification& pepid) const;
63
65 bool hasIdentifier(const std::string& identifier) const;
66
68 const std::string& getIdentifier(const StringList& ms_run_paths) const;
69
71 bool empty() const;
72
74 Size size() const;
75
77 const StringList& getMSRunPaths(const std::string& identifier) const;
78
80 std::vector<std::string> getIdentifiers() const;
81
83 bool hasRunPath(const StringList& ms_run_paths) const;
84
86 bool tryGetIdentifier(const StringList& ms_run_paths, std::string& identifier) const;
87
88 private:
90 std::map<std::string, StringList> identifier_to_msrunpath_;
91 std::map<StringList, std::string> runpath_to_identifier_;
92 };
93
94} // namespace OpenMS
Two-way mapping from ms-run-path to protID|pepID-identifier.
Definition IdentifierMSRunMapper.h:51
bool hasRunPath(const StringList &ms_run_paths) const
Check if the mapping contains an entry for the given MS run paths.
void create(const std::vector< ProteinIdentification > &prot_ids)
Create/update mapping from a vector of ProteinIdentifications.
std::map< StringList, std::string > runpath_to_identifier_
Definition IdentifierMSRunMapper.h:91
bool tryGetIdentifier(const StringList &ms_run_paths, std::string &identifier) const
Try to get identifier for a given MS run path list (returns false if not found)
const std::string & getIdentifier(const StringList &ms_run_paths) const
Get the identifier for a given MS run path list (throws if not found)
bool hasIdentifier(const std::string &identifier) const
Check if the mapping contains an entry for the given identifier.
std::string getPrimaryMSRunPath(const PeptideIdentification &pepid) const
Get the primary MS run path for a PeptideIdentification (using id_merge_index metadata)
bool empty() const
Check if the mapping is empty.
const StringList & getMSRunPaths(const std::string &identifier) const
Get the MS run paths for a given identifier (returns empty list if not found)
std::map< std::string, StringList > identifier_to_msrunpath_
Definition IdentifierMSRunMapper.h:90
static const StringList empty_stringlist_
Empty list returned by getMSRunPaths when identifier not found.
Definition IdentifierMSRunMapper.h:89
std::vector< std::string > getIdentifiers() const
Get all identifiers in this mapping.
IdentifierMSRunMapper(const std::vector< ProteinIdentification > &prot_ids)
Construct mapping from a vector of ProteinIdentifications.
Size size() const
Get the number of identifier mappings.
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition PeptideIdentification.h:66
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19