PeptideHit#
- class pyopenms.PeptideHit#
Bases:
objectRepresents 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__() None#
- __init__(arg0: float, arg1: int, arg2: int, arg3: pyopenms.AASequence, /) None
- __init__(arg0: float, arg1: int, arg2: int, arg3: pyopenms.AASequence, /) None
- __init__(arg: pyopenms.PeptideHit, /) None
Methods
__init__()addAnalysisResults(aresult)Adds a search engine sub-score
addPeptideEvidence(peptide_evidence)Adds a single protein mapping
Removes all meta values
Extracts all unique protein accessions
Returns all search engine sub-scores
Returns the charge state of the peptide
getKeys(keys)Overloaded function.
getMetaValue(name)Returns the value corresponding to a string, or DataValue::EMPTY if not found
Returns fragment ion annotations
Returns protein mapping information for this peptide
getRank()Returns the rank of this hit among all candidates
getScore()Returns the score of this peptide-spectrum match (PSM)
Returns the peptide sequence
isDecoy()Checks if this hit maps only to decoy proteins
Returns if the MetaInfo is empty
Returns a reference to the MetaInfoRegistry
metaValueExists(name)Returns whether an entry with the given name exists
removeMetaValue(name)Removes the DataValue corresponding to name if it exists
setAnalysisResults(aresults)Set information on (search engine) sub scores associated with this PSM.
setCharge(charge)Sets the charge state
setMetaValue(name, value)Sets the DataValue corresponding to a name
setPeakAnnotations(frag_annotations)Sets fragment ion annotations
setPeptideEvidences(peptide_evidences)Sets the protein mapping information
setRank(newrank)Sets the rank of this hit
setScore(score)Sets the PSM score
setSequence(sequence)Sets the peptide sequence
- addAnalysisResults(aresult: pyopenms.PeptideHit_AnalysisResult) None#
Adds a search engine sub-score
- Parameters:
aresult – Sub-score to add
- addPeptideEvidence(peptide_evidence: pyopenms.PeptideEvidence) None#
Adds a single protein mapping
- Parameters:
peptide_evidence – Protein location information to add
- clearMetaInfo() None#
Removes all meta values
- extractProteinAccessionsSet() set[str]#
Extracts all unique protein accessions
- Returns:
Set of unique protein accession strings
Empty accessions are excluded from the result
- getAnalysisResults() list[pyopenms.PeptideHit_AnalysisResult]#
Returns all search engine sub-scores
- Returns:
Sub-score information
- getCharge() int#
Returns the charge state of the peptide
- Returns:
Charge state (e.g., 2 for doubly charged)
- getKeys(keys: list) None#
- getKeys() list
Overloaded function.
getKeys(keys: list) -> None
Fills the given list with all meta value keys
getKeys() -> list
Returns all meta value keys as a list
- getMetaValue(name: str) None | int | float | str | bytes | list[str] | list[int] | list[float]#
Returns the value corresponding to a string, or DataValue::EMPTY if not found
- getPeakAnnotations() list[pyopenms.PeptideHit_PeakAnnotation]#
Returns fragment ion annotations
- Returns:
Annotated fragment peaks
- getPeptideEvidences() list[pyopenms.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() int#
Returns the rank of this hit among all candidates
- Returns:
Rank (1 = best hit, 2 = second best, etc.)
- getScore() float#
Returns the score of this peptide-spectrum match (PSM)
- Returns:
The search engine score
Interpretation depends on the score type (check isHigherScoreBetter)
- getSequence() pyopenms.AASequence#
Returns the peptide sequence
- Returns:
The peptide amino acid sequence with modifications
- isDecoy() 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() bool#
Returns if the MetaInfo is empty
- static metaRegistry() pyopenms.MetaInfoRegistry#
Returns a reference to the MetaInfoRegistry
- metaValueExists(name: str) bool#
Returns whether an entry with the given name exists
- removeMetaValue(name: str) None#
Removes the DataValue corresponding to name if it exists
- setAnalysisResults(aresults: collections.abc.Sequence[pyopenms.PeptideHit_AnalysisResult]) None#
Set information on (search engine) sub scores associated with this PSM.
- Parameters:
aresults – List of PepXMLAnalysisResult objects
- setCharge(charge: int) None#
Sets the charge state
- Parameters:
charge – Charge state of the peptide ion
- setMetaValue(name: str, value: None | int | float | str | bytes | list[str] | list[int] | list[float]) None#
Sets the DataValue corresponding to a name
- setPeakAnnotations(frag_annotations: collections.abc.Sequence[pyopenms.PeptideHit_PeakAnnotation]) None#
Sets fragment ion annotations
- Parameters:
frag_annotations – Fragment peak annotations
- setPeptideEvidences(peptide_evidences: collections.abc.Sequence[pyopenms.PeptideEvidence]) None#
- setPeptideEvidences(peptide_evidences: collections.abc.Sequence[pyopenms.PeptideEvidence]) None
Sets the protein mapping information
- Parameters:
peptide_evidences – Protein locations for this peptide
- setRank(newrank: int) None#
Sets the rank of this hit
- Parameters:
newrank – Rank among all candidates (1 = best)
- setScore(score: float) None#
Sets the PSM score
- Parameters:
score – The search engine score to set
- setSequence(sequence: pyopenms.AASequence) None#
- setSequence(sequence: pyopenms.AASequence) None
Sets the peptide sequence
- Parameters:
sequence – The peptide amino acid sequence