OpenMS
Loading...
Searching...
No Matches
IdentifierMSRunMapper Class Reference

Two-way mapping from ms-run-path to protID|pepID-identifier. More...

#include <OpenMS/METADATA/IdentifierMSRunMapper.h>

Collaboration diagram for IdentifierMSRunMapper:
[legend]

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.
 
String getPrimaryMSRunPath (const PeptideIdentification &pepid) const
 Get the primary MS run path for a PeptideIdentification (using id_merge_index metadata)
 
bool hasIdentifier (const String &identifier) const
 Check if the mapping contains an entry for the given identifier.
 
const StringgetIdentifier (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 StringListgetMSRunPaths (const String &identifier) const
 Get the MS run paths for a given identifier (returns empty list if not found)
 
std::vector< StringgetIdentifiers () 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, String &identifier) const
 Try to get identifier for a given MS run path list (returns false if not found)
 

Private Attributes

std::map< String, StringListidentifier_to_msrunpath_
 
std::map< StringList, Stringrunpath_to_identifier_
 

Static Private Attributes

static const StringList empty_stringlist_
 Empty list returned by getMSRunPaths when identifier not found.
 

Detailed Description

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:

// Create mapping from protein identifications
IdentifierMSRunMapper mapping(protein_ids);
// Get the source file for a peptide identification
String source_file = mapping.getPrimaryMSRunPath(pep_id);
// Build a USI using the mapping
USI usi = pep_id.buildUSI(mapping, "PXD000561");
Two-way mapping from ms-run-path to protID|pepID-identifier.
Definition IdentifierMSRunMapper.h:51
A more convenient string class.
Definition String.h:34
Utility class for handling Universal Spectrum Identifiers (USI).
Definition USI.h:54
Note
The internal data structures are private to avoid exposing nested containers that are difficult to wrap in Python bindings.
See also
ProteinIdentification, PeptideIdentification

Constructor & Destructor Documentation

◆ IdentifierMSRunMapper() [1/2]

IdentifierMSRunMapper ( )
default

◆ IdentifierMSRunMapper() [2/2]

IdentifierMSRunMapper ( const std::vector< ProteinIdentification > &  prot_ids)
explicit

Construct mapping from a vector of ProteinIdentifications.

Member Function Documentation

◆ create()

void create ( const std::vector< ProteinIdentification > &  prot_ids)

Create/update mapping from a vector of ProteinIdentifications.

◆ empty()

bool empty ( ) const

Check if the mapping is empty.

◆ getIdentifier()

const String & getIdentifier ( const StringList ms_run_paths) const

Get the identifier for a given MS run path list (throws if not found)

◆ getIdentifiers()

std::vector< String > getIdentifiers ( ) const

Get all identifiers in this mapping.

◆ getMSRunPaths()

const StringList & getMSRunPaths ( const String identifier) const

Get the MS run paths for a given identifier (returns empty list if not found)

◆ getPrimaryMSRunPath()

String getPrimaryMSRunPath ( const PeptideIdentification pepid) const

Get the primary MS run path for a PeptideIdentification (using id_merge_index metadata)

◆ hasIdentifier()

bool hasIdentifier ( const String identifier) const

Check if the mapping contains an entry for the given identifier.

◆ hasRunPath()

bool hasRunPath ( const StringList ms_run_paths) const

Check if the mapping contains an entry for the given MS run paths.

◆ size()

Size size ( ) const

Get the number of identifier mappings.

◆ tryGetIdentifier()

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)

Member Data Documentation

◆ empty_stringlist_

const StringList empty_stringlist_
staticprivate

Empty list returned by getMSRunPaths when identifier not found.

◆ identifier_to_msrunpath_

std::map<String, StringList> identifier_to_msrunpath_
private

◆ runpath_to_identifier_

std::map<StringList, String> runpath_to_identifier_
private