OpenMS
PeptideHit Class Reference

Represents a single spectrum match (candidate) for a specific tandem mass spectrum (MS/MS). More...

#include <OpenMS/METADATA/PeptideHit.h>

Inheritance diagram for PeptideHit:
[legend]
Collaboration diagram for PeptideHit:
[legend]

Classes

struct  PeakAnnotation
 Contains annotations of a peak. More...
 
class  PepXMLAnalysisResult
 Analysis Result (containing search engine / prophet results) More...
 
class  RankLess
 Lesser predicate for scores of hits. More...
 
class  ScoreLess
 Lesser predicate for scores of hits. More...
 
class  ScoreMore
 Greater predicate for scores of hits. More...
 
class  SequenceLessComparator
 Lesser predicate for (modified) sequence of hits. More...
 

Public Types

enum class  TargetDecoyType { TARGET , DECOY , TARGET_DECOY , UNKNOWN }
 Enum for target/decoy annotation. More...
 

Public Member Functions

Constructors and Assignment
 PeptideHit ()
 Default constructor. More...
 
 PeptideHit (double score, UInt rank, Int charge, const AASequence &sequence)
 Values constructor that copies sequence. More...
 
 PeptideHit (double score, UInt rank, Int charge, AASequence &&sequence)
 Values constructor that moves sequence R-value. More...
 
 PeptideHit (const PeptideHit &source)
 Copy constructor. More...
 
 PeptideHit (PeptideHit &&) noexcept
 Move constructor. More...
 
virtual ~PeptideHit ()
 Destructor. More...
 
PeptideHitoperator= (const PeptideHit &source)
 Assignment operator. More...
 
PeptideHitoperator= (PeptideHit &&) noexcept
 Move assignment operator. More...
 
bool operator== (const PeptideHit &rhs) const
 Equality operator. More...
 
bool operator!= (const PeptideHit &rhs) const
 Inequality operator. More...
 
- Public Member Functions inherited from MetaInfoInterface
 MetaInfoInterface ()
 Constructor. More...
 
 MetaInfoInterface (const MetaInfoInterface &rhs)
 Copy constructor. More...
 
 MetaInfoInterface (MetaInfoInterface &&) noexcept
 Move constructor. More...
 
 ~MetaInfoInterface ()
 Destructor. More...
 
MetaInfoInterfaceoperator= (const MetaInfoInterface &rhs)
 Assignment operator. More...
 
MetaInfoInterfaceoperator= (MetaInfoInterface &&) noexcept
 Move assignment operator. More...
 
void swap (MetaInfoInterface &rhs)
 Swap contents. More...
 
bool operator== (const MetaInfoInterface &rhs) const
 Equality operator. More...
 
bool operator!= (const MetaInfoInterface &rhs) const
 Equality operator. More...
 
const DataValuegetMetaValue (const String &name) const
 Returns the value corresponding to a string, or DataValue::EMPTY if not found. More...
 
DataValue getMetaValue (const String &name, const DataValue &default_value) const
 Returns the value corresponding to a string, or a default value (e.g.: DataValue::EMPTY) if not found
More...
 
const DataValuegetMetaValue (UInt index) const
 Returns the value corresponding to the index, or DataValue::EMPTY if not found. More...
 
DataValue getMetaValue (UInt index, const DataValue &default_value) const
 Returns the value corresponding to the index, or a default value (e.g.: DataValue::EMPTY) if not found
More...
 
bool metaValueExists (const String &name) const
 Returns whether an entry with the given name exists. More...
 
bool metaValueExists (UInt index) const
 Returns whether an entry with the given index exists. More...
 
void setMetaValue (const String &name, const DataValue &value)
 Sets the DataValue corresponding to a name. More...
 
void setMetaValue (UInt index, const DataValue &value)
 Sets the DataValue corresponding to an index. More...
 
void removeMetaValue (const String &name)
 Removes the DataValue corresponding to name if it exists. More...
 
void removeMetaValue (UInt index)
 Removes the DataValue corresponding to index if it exists. More...
 
void addMetaValues (const MetaInfoInterface &from)
 
void getKeys (std::vector< String > &keys) const
 Fills the given vector with a list of all keys for which a value is set. More...
 
void getKeys (std::vector< UInt > &keys) const
 Fills the given vector with a list of all keys for which a value is set. More...
 
bool isMetaEmpty () const
 Returns if the MetaInfo is empty. More...
 
void clearMetaInfo ()
 Removes all meta values. More...
 

Accessors

AASequence sequence_
 
double score_ {}
 the score of the peptide hit More...
 
Int charge_ {}
 the charge of the peptide More...
 
std::vector< PeptideEvidencepeptide_evidences_
 information on the potential peptides observed through this PSM. More...
 
std::vector< PeptideHit::PeakAnnotationfragment_annotations_
 annotations of fragments in the corresponding spectrum More...
 
const AASequencegetSequence () const
 returns the peptide sequence More...
 
AASequencegetSequence ()
 returns the mutable peptide sequence More...
 
void setSequence (const AASequence &sequence)
 sets the peptide sequence More...
 
void setSequence (AASequence &&sequence)
 sets the peptide sequence More...
 
Int getCharge () const
 returns the charge of the peptide More...
 
void setCharge (Int charge)
 sets the charge of the peptide More...
 
const std::vector< PeptideEvidence > & getPeptideEvidences () const
 returns information on peptides (potentially) identified by this PSM More...
 
void setPeptideEvidences (const std::vector< PeptideEvidence > &peptide_evidences)
 set information on peptides (potentially) identified by this PSM More...
 
void setPeptideEvidences (std::vector< PeptideEvidence > &&peptide_evidences)
 
void addPeptideEvidence (const PeptideEvidence &peptide_evidence)
 adds information on a peptide that is (potentially) identified by this PSM More...
 
double getScore () const
 returns the PSM score More...
 
void setScore (double score)
 sets the PSM score More...
 
void setAnalysisResults (const std::vector< PepXMLAnalysisResult > &aresult)
 set information on (search engine) sub scores associated with this PSM (only used by pepXML) More...
 
void addAnalysisResults (const PepXMLAnalysisResult &aresult)
 add information on (search engine) sub scores associated with this PSM (only used by pepXML) More...
 
std::vector< PepXMLAnalysisResultgetAnalysisResults () const
 returns information on (search engine) sub scores associated with this PSM (only used by pepXML) More...
 
UInt getRank () const
 returns the PSM rank More...
 
void setRank (UInt newrank)
 sets the PSM rank (0 = top hit) More...
 
std::vector< PeptideHit::PeakAnnotation > & getPeakAnnotations ()
 returns the fragment annotations More...
 
const std::vector< PeptideHit::PeakAnnotation > & getPeakAnnotations () const
 
void setPeakAnnotations (std::vector< PeptideHit::PeakAnnotation > frag_annotations)
 sets the fragment annotations More...
 
bool isDecoy () const
 Returns true if this hit is annotated as mapping to decoy sequences only. Returns false for TargetDecoyType::TARGET and TargetDecoyType::TARGET_DECOY. Note: an unknown/unannotated state (TargetDecoyType::UNKNOWN) will yield false. More...
 
void setTargetDecoyType (TargetDecoyType type)
 Sets the target/decoy type for this peptide hit. More...
 
TargetDecoyType getTargetDecoyType () const
 Returns the target/decoy type for this peptide hit. More...
 
std::set< StringextractProteinAccessionsSet () const
 extracts the set of non-empty protein accessions from peptide evidences More...
 
size_t getNumberOfAnalysisResultsFromMetaValues_ () const
 Get the number of analysis results stored as meta values (only for pepXML results) More...
 
std::vector< PepXMLAnalysisResultextractAnalysisResultsFromMetaValues_ () const
 Extract analysis results from meta values (only for pepXML results) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MetaInfoInterface
static MetaInfoRegistrymetaRegistry ()
 Returns a reference to the MetaInfoRegistry. More...
 
- Protected Member Functions inherited from MetaInfoInterface
void createIfNotExists_ ()
 Creates the MetaInfo object if it does not exist. More...
 
- Protected Attributes inherited from MetaInfoInterface
MetaInfometa_
 Pointer to the MetaInfo object (0 by default) More...
 

Detailed Description

Represents a single spectrum match (candidate) for a specific tandem mass spectrum (MS/MS).

Stores the primary information about a potential match, including:

  • The sequence (potentially with modifications) using AASequence.
  • The primary score assigned by the identification algorithm (e.g., search engine).
  • The rank of this hit compared to other hits for the same spectrum (stored as a meta value with key "rank").
  • The precursor charge state assumed for this match.
  • Evidence linking the peptide sequence to specific protein sequences (PeptideEvidence).
  • Optional annotations mapping fragment ions in the MS/MS spectrum to interpretations (PeakAnnotation).
  • Optional secondary scores from post-processing tools (PepXMLAnalysisResult).

Objects are typically contained within a PeptideIdentification object, which represents all hits found for a single spectrum. Inherits from MetaInfoInterface, allowing arbitrary metadata (key-value pairs) to be attached.

Deprecated:
Use SpectrumMatch instead. PeptideHit may be removed in a future OpenMS version.
See also
PeptideIdentification, AASequence, PeptideEvidence, PeakAnnotation, PepXMLAnalysisResult, MetaInfoInterface

Member Enumeration Documentation

◆ TargetDecoyType

enum TargetDecoyType
strong

Enum for target/decoy annotation.

Enumerator
TARGET 

Only matches target proteins.

DECOY 

Only matches decoy proteins.

TARGET_DECOY 

Matches BOTH target and decoy proteins.

UNKNOWN 

Target/decoy status is unknown (meta value not set)

Constructor & Destructor Documentation

◆ PeptideHit() [1/5]

Default constructor.

◆ PeptideHit() [2/5]

PeptideHit ( double  score,
UInt  rank,
Int  charge,
const AASequence sequence 
)

Values constructor that copies sequence.

◆ PeptideHit() [3/5]

PeptideHit ( double  score,
UInt  rank,
Int  charge,
AASequence &&  sequence 
)

Values constructor that moves sequence R-value.

◆ PeptideHit() [4/5]

PeptideHit ( const PeptideHit source)

Copy constructor.

◆ PeptideHit() [5/5]

PeptideHit ( PeptideHit &&  )
noexcept

Move constructor.

◆ ~PeptideHit()

virtual ~PeptideHit ( )
virtual

Destructor.

Member Function Documentation

◆ addAnalysisResults()

void addAnalysisResults ( const PepXMLAnalysisResult aresult)

add information on (search engine) sub scores associated with this PSM (only used by pepXML)

◆ addPeptideEvidence()

void addPeptideEvidence ( const PeptideEvidence peptide_evidence)

adds information on a peptide that is (potentially) identified by this PSM

◆ extractAnalysisResultsFromMetaValues_()

std::vector<PepXMLAnalysisResult> extractAnalysisResultsFromMetaValues_ ( ) const
private

Extract analysis results from meta values (only for pepXML results)

◆ extractProteinAccessionsSet()

std::set<String> extractProteinAccessionsSet ( ) const

extracts the set of non-empty protein accessions from peptide evidences

Referenced by IDFilter::HasMatchingAccessionUnordered< HitType >::operator()(), and IDFilter::HasMatchingAccession< HitType >::operator()().

◆ getAnalysisResults()

std::vector<PepXMLAnalysisResult> getAnalysisResults ( ) const

returns information on (search engine) sub scores associated with this PSM (only used by pepXML)

◆ getCharge()

◆ getNumberOfAnalysisResultsFromMetaValues_()

size_t getNumberOfAnalysisResultsFromMetaValues_ ( ) const
private

Get the number of analysis results stored as meta values (only for pepXML results)

◆ getPeakAnnotations() [1/2]

std::vector<PeptideHit::PeakAnnotation>& getPeakAnnotations ( )

returns the fragment annotations

◆ getPeakAnnotations() [2/2]

const std::vector<PeptideHit::PeakAnnotation>& getPeakAnnotations ( ) const

◆ getPeptideEvidences()

const std::vector<PeptideEvidence>& getPeptideEvidences ( ) const

returns information on peptides (potentially) identified by this PSM

◆ getRank()

UInt getRank ( ) const

returns the PSM rank

◆ getScore()

◆ getSequence() [1/2]

AASequence& getSequence ( )

returns the mutable peptide sequence

◆ getSequence() [2/2]

◆ getTargetDecoyType()

TargetDecoyType getTargetDecoyType ( ) const

Returns the target/decoy type for this peptide hit.

This method performs case-insensitive parsing of the "target_decoy" meta value and returns the corresponding enum value. Returns UNKNOWN if the meta value does not exist.

Returns
The target/decoy classification:
  • TARGET: Only matches target proteins
  • DECOY: Only matches decoy proteins
  • TARGET_DECOY: Matches both target and decoy proteins
  • UNKNOWN: Target/decoy status not set (meta value missing)

◆ isDecoy()

bool isDecoy ( ) const

Returns true if this hit is annotated as mapping to decoy sequences only. Returns false for TargetDecoyType::TARGET and TargetDecoyType::TARGET_DECOY. Note: an unknown/unannotated state (TargetDecoyType::UNKNOWN) will yield false.

◆ operator!=()

bool operator!= ( const PeptideHit rhs) const

Inequality operator.

◆ operator=() [1/2]

PeptideHit& operator= ( const PeptideHit source)

Assignment operator.

◆ operator=() [2/2]

PeptideHit& operator= ( PeptideHit &&  )
noexcept

Move assignment operator.

◆ operator==()

bool operator== ( const PeptideHit rhs) const

Equality operator.

◆ setAnalysisResults()

void setAnalysisResults ( const std::vector< PepXMLAnalysisResult > &  aresult)

set information on (search engine) sub scores associated with this PSM (only used by pepXML)

◆ setCharge()

void setCharge ( Int  charge)

sets the charge of the peptide

◆ setPeakAnnotations()

void setPeakAnnotations ( std::vector< PeptideHit::PeakAnnotation frag_annotations)

sets the fragment annotations

◆ setPeptideEvidences() [1/2]

void setPeptideEvidences ( const std::vector< PeptideEvidence > &  peptide_evidences)

set information on peptides (potentially) identified by this PSM

◆ setPeptideEvidences() [2/2]

void setPeptideEvidences ( std::vector< PeptideEvidence > &&  peptide_evidences)

◆ setRank()

void setRank ( UInt  newrank)

sets the PSM rank (0 = top hit)

◆ setScore()

◆ setSequence() [1/2]

void setSequence ( AASequence &&  sequence)

sets the peptide sequence

◆ setSequence() [2/2]

void setSequence ( const AASequence sequence)

sets the peptide sequence

◆ setTargetDecoyType()

void setTargetDecoyType ( TargetDecoyType  type)

Sets the target/decoy type for this peptide hit.

This method provides a type-safe way to annotate peptide hits with their target/decoy status. Use TARGET_DECOY for peptides that match both target and decoy protein sequences (these are treated as targets in FDR calculations). Note: UNKNOWN should only be used in special cases where the status needs to be explicitly marked as unknown.

Parameters
typeThe target/decoy classification:
  • TARGET: Only matches target proteins
  • DECOY: Only matches decoy proteins
  • TARGET_DECOY: Matches both target and decoy proteins
  • UNKNOWN: Target/decoy status is unknown (explicit unknown state)

Member Data Documentation

◆ charge_

Int charge_ {}
protected

the charge of the peptide

◆ fragment_annotations_

std::vector<PeptideHit::PeakAnnotation> fragment_annotations_
protected

annotations of fragments in the corresponding spectrum

◆ peptide_evidences_

std::vector<PeptideEvidence> peptide_evidences_
protected

information on the potential peptides observed through this PSM.

◆ score_

double score_ {}
protected

the score of the peptide hit

◆ sequence_

AASequence sequence_
protected