PeptideHit#
- class pyopenms.PeptideHit#
Bases:
objectCython implementation of _PeptideHit
- Original C++ documentation is available here
– Inherits from [‘MetaInfoInterface’]
Represents a single peptide identification hit from a database search
A PeptideHit stores information about a candidate peptide sequence that was matched to a spectrum. Each hit contains:
The peptide sequence (as AASequence)
A score from the search engine
The rank among all candidates
The charge state
Protein mappings (PeptideEvidence objects)
Multiple PeptideHit objects are typically stored in a PeptideIdentification, sorted by score to show the most likely candidates first.
Example usage:
hit = oms.PeptideHit() hit.setSequence(oms.AASequence.fromString("PEPTIDER")) hit.setScore(95.5) hit.setRank(1) hit.setCharge(2) # Access information print(f"Sequence: {hit.getSequence().toString()}") print(f"Score: {hit.getScore()}, Rank: {hit.getRank()}") print(f"Charge: {hit.getCharge()}")
- __init__()#
Overload:
- __init__(self) None
Overload:
- __init__(self, score: float, rank: int, charge: int, sequence: AASequence) None
Overload:
- __init__(self, in_0: PeptideHit) None
Methods
addAnalysisResults(self, aresult)Adds a search engine sub-score
addPeptideEvidence(self, in_0)Adds a single protein mapping
clearMetaInfo(self)Removes all meta values
Extracts all unique protein accessions
getAnalysisResults(self)Returns all search engine sub-scores
getCharge(self)Returns the charge state of the peptide
getKeys(self, keys)Fills the given vector with a list of all keys for which a value is set
getMetaValue(self, in_0)Returns the value corresponding to a string, or
getPeakAnnotations(self)Returns fragment ion annotations
getPeptideEvidences(self)Returns protein mapping information for this peptide
getRank(self)Returns the rank of this hit among all candidates
getScore(self)Returns the score of this peptide-spectrum match (PSM)
getSequence(self)Returns the peptide sequence
isDecoy(self)Checks if this hit maps only to decoy proteins
isMetaEmpty(self)Returns if the MetaInfo is empty
metaRegistry(self)Returns a reference to the MetaInfoRegistry
metaValueExists(self, in_0)Returns whether an entry with the given name exists
removeMetaValue(self, in_0)Removes the DataValue corresponding to name if it exists
setAnalysisResults(self, aresult)Sets search engine sub-scores
setCharge(self, in_0)Sets the charge state
setMetaValue(self, in_0, in_1)Sets the DataValue corresponding to a name
setPeakAnnotations(self, in_0)Sets fragment ion annotations
setPeptideEvidences(self, in_0)Sets the protein mapping information
setRank(self, in_0)Sets the rank of this hit
setScore(self, in_0)Sets the PSM score
setSequence(self, in_0)Sets the peptide sequence
- addAnalysisResults(self, aresult: PeptideHit_AnalysisResult) None#
Adds a search engine sub-score
- Parameters:
aresult – Sub-score to add
- addPeptideEvidence(self, in_0: PeptideEvidence) None#
Adds a single protein mapping
- Parameters:
evidence – Protein location information to add
- clearMetaInfo(self) None#
Removes all meta values
- extractProteinAccessionsSet(self) Set[bytes]#
Extracts all unique protein accessions
- Returns:
Set of unique protein accession strings
Empty accessions are excluded from the result
- getAnalysisResults(self) List[PeptideHit_AnalysisResult]#
Returns all search engine sub-scores
- Returns:
Sub-score information
- getCharge(self) int#
Returns the charge state of the peptide
- Returns:
Charge state (e.g., 2 for doubly charged)
- getKeys(self, keys: List[bytes]) None#
Fills the given vector with a list of all keys for which a value is set
- getMetaValue(self, in_0: bytes | str | String) int | float | bytes | str | List[int] | List[float] | List[bytes]#
Returns the value corresponding to a string, or
- getPeakAnnotations(self) List[PeptideHit_PeakAnnotation]#
Returns fragment ion annotations
- Returns:
Annotated fragment peaks
- getPeptideEvidences(self) List[PeptideEvidence]#
Returns protein mapping information for this peptide
- Returns:
List of proteins where this peptide was found
Each evidence contains protein accession, start/end positions, and if it’s a decoy
- getRank(self) int#
Returns the rank of this hit among all candidates
- Returns:
Rank (1 = best hit, 2 = second best, etc.)
- getScore(self) float#
Returns the score of this peptide-spectrum match (PSM)
- Returns:
The search engine score
Interpretation depends on the score type (check isHigherScoreBetter)
- getSequence(self) AASequence#
Returns the peptide sequence
- Returns:
The peptide amino acid sequence with modifications
- isDecoy(self) bool#
Checks if this hit maps only to decoy proteins
- Returns:
True if all protein mappings are decoys, False otherwise
Returns False if no target/decoy information is available
- isMetaEmpty(self) bool#
Returns if the MetaInfo is empty
- metaRegistry(self) MetaInfoRegistry#
Returns a reference to the MetaInfoRegistry
- metaValueExists(self, in_0: bytes | str | String) bool#
Returns whether an entry with the given name exists
- removeMetaValue(self, in_0: bytes | str | String) None#
Removes the DataValue corresponding to name if it exists
- setAnalysisResults(self, aresult: List[PeptideHit_AnalysisResult]) None#
Sets search engine sub-scores
- Parameters:
aresult – Sub-score information from search engine
- setCharge(self, in_0: int) None#
Sets the charge state
- Parameters:
charge – Charge state of the peptide ion
- setMetaValue(self, in_0: bytes | str | String, in_1: int | float | bytes | str | List[int] | List[float] | List[bytes]) None#
Sets the DataValue corresponding to a name
- setPeakAnnotations(self, in_0: List[PeptideHit_PeakAnnotation]) None#
Sets fragment ion annotations
- Parameters:
annotations – Fragment peak annotations
- setPeptideEvidences(self, in_0: List[PeptideEvidence]) None#
Sets the protein mapping information
- Parameters:
evidences – Protein locations for this peptide
- setRank(self, in_0: int) None#
Sets the rank of this hit
- Parameters:
rank – Rank among all candidates (1 = best)
- setScore(self, in_0: float) None#
Sets the PSM score
- Parameters:
score – The search engine score to set
- setSequence(self, in_0: AASequence) None#
Sets the peptide sequence
- Parameters:
sequence – The peptide amino acid sequence