![]() |
OpenMS
|
Two-way mapping from ms-run-path to protID|pepID-identifier. More...
#include <OpenMS/METADATA/IdentifierMSRunMapper.h>
Public Member Functions | |
| IdentifierMSRunMapper ()=default | |
| IdentifierMSRunMapper (const std::vector< ProteinIdentification > &prot_ids) | |
| Construct mapping from a vector of ProteinIdentifications. | |
| void | create (const std::vector< ProteinIdentification > &prot_ids) |
| Create/update mapping from a vector of ProteinIdentifications. | |
| std::string | getPrimaryMSRunPath (const PeptideIdentification &pepid) const |
| Get the primary MS run path for a PeptideIdentification (using id_merge_index metadata) | |
| 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. | |
| bool | hasIdentifier (const std::string &identifier) const |
| Check if the mapping contains an entry for the given identifier. | |
| 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 | empty () const |
| Check if the mapping is empty. | |
| Size | size () const |
| Get the number of identifier mappings. | |
| const StringList & | getMSRunPaths (const std::string &identifier) const |
| Get the MS run paths for a given identifier (returns empty list if not found) | |
| std::vector< std::string > | getIdentifiers () const |
| Get all identifiers in this mapping. | |
| bool | hasRunPath (const StringList &ms_run_paths) const |
| Check if the mapping contains an entry for the given MS run paths. | |
| 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) | |
Private Attributes | |
| std::map< std::string, StringList > | identifier_to_msrunpath_ |
| std::map< StringList, std::string > | runpath_to_identifier_ |
Static Private Attributes | |
| static const StringList | empty_stringlist_ |
| Empty list returned by getMSRunPaths when identifier not found. | |
Two-way mapping from ms-run-path to protID|pepID-identifier.
This class encapsulates the mapping between protein identification identifiers and their associated MS run paths. It is used to resolve the correct source file for peptide identifications, especially in merged identification results.
Usage example:
|
default |
|
explicit |
Construct mapping from a vector of ProteinIdentifications.
| void create | ( | const std::vector< ProteinIdentification > & | prot_ids | ) |
Create/update mapping from a vector of ProteinIdentifications.
Referenced by MQMsms::exportFeatureMap(), and MQEvidence::exportFeatureMap().
| bool empty | ( | ) | const |
Check if the mapping is empty.
| const std::string & getIdentifier | ( | const StringList & | ms_run_paths | ) | const |
Get the identifier for a given MS run path list (throws if not found)
| std::vector< std::string > getIdentifiers | ( | ) | const |
Get all identifiers in this mapping.
| const StringList & getMSRunPaths | ( | const std::string & | identifier | ) | const |
Get the MS run paths for a given identifier (returns empty list if not found)
| std::string getPrimaryMSRunPath | ( | const PeptideIdentification & | pepid | ) | const |
Get the primary MS run path for a PeptideIdentification (using id_merge_index metadata)
| bool hasIdentifier | ( | const std::string & | identifier | ) | const |
Check if the mapping contains an entry for the given identifier.
| bool hasRunPath | ( | const StringList & | ms_run_paths | ) | const |
Check if the mapping contains an entry for the given MS run paths.
| Size size | ( | ) | const |
Get the number of identifier mappings.
| 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)
| 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.
A run with several spectra_data entries resolves per PSM only through id_merge_index. Without a usable one, getPrimaryMSRunPath() falls back to the run's first file, silently labelling every PSM of the run with it. Callers that use the resolved path as a key – QPX run_file_name is a primary-key component of the psm, feature and pg views – must refuse such input rather than publish it, so run this as a preflight before any output is opened.
Runs with 0 or 1 path are exempt: unmerged input has nothing to disambiguate, and resolution cannot be wrong.
| [in] | pep_id | The PSM to check |
| [in] | psm_index | Only used to make the diagnostic locatable |
| Exception::MissingInformation | if the run is merged and id_merge_index is missing, is not an integer, or is out of range |
|
staticprivate |
Empty list returned by getMSRunPaths when identifier not found.
|
private |
|
private |