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
63
65 bool hasIdentifier(const String& identifier) const;
66
68 const String& getIdentifier(const StringList& ms_run_paths) const;
69
71 bool empty() const;
72
74 Size size() const;
75
77 const StringList& getMSRunPaths(const String& identifier) const;
78
80 std::vector<String> getIdentifiers() const;
81
83 bool hasRunPath(const StringList& ms_run_paths) const;
84
86 bool tryGetIdentifier(const StringList& ms_run_paths, String& identifier) const;
87
88 private:
90 std::map<String, StringList> identifier_to_msrunpath_;
91 std::map<StringList, 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.
bool hasIdentifier(const String &identifier) const
Check if the mapping contains an entry for the given identifier.
const StringList & getMSRunPaths(const String &identifier) const
Get the MS run paths for a given identifier (returns empty list if not found)
bool empty() const
Check if the mapping is empty.
std::map< StringList, String > runpath_to_identifier_
Definition IdentifierMSRunMapper.h:91
bool tryGetIdentifier(const StringList &ms_run_paths, String &identifier) const
Try to get identifier for a given MS run path list (returns false if not found)
String getPrimaryMSRunPath(const PeptideIdentification &pepid) const
Get the primary MS run path for a PeptideIdentification (using id_merge_index metadata)
const String & getIdentifier(const StringList &ms_run_paths) const
Get the identifier for a given MS run path list (throws if not found)
static const StringList empty_stringlist_
Empty list returned by getMSRunPaths when identifier not found.
Definition IdentifierMSRunMapper.h:89
IdentifierMSRunMapper(const std::vector< ProteinIdentification > &prot_ids)
Construct mapping from a vector of ProteinIdentifications.
Size size() const
Get the number of identifier mappings.
std::vector< String > getIdentifiers() const
Get all identifiers in this mapping.
std::map< String, StringList > identifier_to_msrunpath_
Definition IdentifierMSRunMapper.h:90
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition PeptideIdentification.h:66
A more convenient string class.
Definition String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< String > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19