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
82 void validateMergeIndex(const PeptideIdentification& pep_id, size_t psm_index) const;
83
85 bool hasIdentifier(const std::string& identifier) const;
86
88 const std::string& getIdentifier(const StringList& ms_run_paths) const;
89
91 bool empty() const;
92
94 Size size() const;
95
97 const StringList& getMSRunPaths(const std::string& identifier) const;
98
100 std::vector<std::string> getIdentifiers() const;
101
103 bool hasRunPath(const StringList& ms_run_paths) const;
104
106 bool tryGetIdentifier(const StringList& ms_run_paths, std::string& identifier) const;
107
108 private:
110 std::map<std::string, StringList> identifier_to_msrunpath_;
111 std::map<StringList, std::string> runpath_to_identifier_;
112 };
113
114} // 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:111
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)
void validateMergeIndex(const PeptideIdentification &pep_id, size_t psm_index) const
Refuse a PSM of a merged run that cannot be attributed to an origin file.
std::map< std::string, StringList > identifier_to_msrunpath_
Definition IdentifierMSRunMapper.h:110
static const StringList empty_stringlist_
Empty list returned by getMSRunPaths when identifier not found.
Definition IdentifierMSRunMapper.h:109
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 TypeAliases.h:39
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19