PeptideIdentification#
- class pyopenms.PeptideIdentification#
Bases:
objectCython implementation of _PeptideIdentification
- Original C++ documentation is available here
– Inherits from [‘MetaInfoInterface’]
Represents peptide identification results for a single spectrum or feature
PeptideIdentification stores the results of peptide identification from database search engines (e.g., Mascot, X!Tandem, MSGF+). Each PeptideIdentification contains:
A list of peptide hits (candidate sequences) ranked by score
The precursor m/z and retention time
Score type and significance threshold
Link to the ProteinIdentification (via identifier)
Multiple PeptideIdentifications can belong to one ProteinIdentification, which stores the search parameters and protein-level results.
Example usage:
pep_id = oms.PeptideIdentification() pep_id.setRT(1234.5) # Set retention time pep_id.setMZ(445.678) # Set precursor m/z pep_id.setScoreType("XTandem") # Add a peptide hit hit = oms.PeptideHit() hit.setScore(50.5) hit.setRank(1) hit.setSequence(oms.AASequence.fromString("PEPTIDE")) hit.setCharge(2) pep_id.insertHit(hit) # Access hits for hit in pep_id.getHits(): print(f"Sequence: {hit.getSequence().toString()}, Score: {hit.getScore()}")
- __init__()#
Overload:
- __init__(self) None
Overload:
- __init__(self, in_0: PeptideIdentification) None
Methods
clearMetaInfo(self)Removes all meta values
empty(self)getBaseName(self)getExperimentLabel(self)getHits(self)Returns all peptide hits (candidate sequences)
getIdentifier(self)Returns the identifier linking to the parent ProteinIdentification
getKeys(self, keys)Fills the given vector with a list of all keys for which a value is set
getMZ(self)Returns the precursor m/z value
getMetaValue(self, in_0)Returns the value corresponding to a string, or
getRT(self)Returns the retention time of the precursor
getReferencingHits(self, in_0, in_1)Returns all peptide hits which reference to a given protein accession (i.e. filter by protein accession).
getScoreType(self)Returns the type of score (e.g., "Mascot", "XTandem", "q-value")
getSignificanceThreshold(self)Returns the significance threshold value
hasMZ(self)Checks if m/z value is set
hasRT(self)Checks if retention time is set
insertHit(self, in_0)Appends a peptide hit to the list
isHigherScoreBetter(self)Returns whether higher scores are better
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
setBaseName(self, in_0)setExperimentLabel(self, in_0)setHigherScoreBetter(self, in_0)Sets whether higher scores are better
setHits(self, in_0)Sets all peptide hits at once
setIdentifier(self, in_0)Sets the identifier linking to a ProteinIdentification
setMZ(self, in_0)Sets the precursor m/z value
setMetaValue(self, in_0, in_1)Sets the DataValue corresponding to a name
setRT(self, in_0)Sets the retention time of the precursor
setScoreType(self, in_0)Sets the score type
setSignificanceThreshold(self, value)Sets the significance threshold value
sort(self)- clearMetaInfo(self) None#
Removes all meta values
- empty(self) bool#
- getHits(self) List[PeptideHit]#
Returns all peptide hits (candidate sequences)
- Returns:
List of peptide candidates ranked by score
Hits are typically sorted by score, with the best hit at index 0
- getIdentifier(self) bytes | str | String#
Returns the identifier linking to the parent ProteinIdentification
- Returns:
Unique identifier string
Use this to find the corresponding ProteinIdentification with search parameters
- getKeys(self, keys: List[bytes]) None#
Fills the given vector with a list of all keys for which a value is set
- getMZ(self) float#
Returns the precursor m/z value
- Returns:
Mass-to-charge ratio of the precursor ion
- 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
- getRT(self) float#
Returns the retention time of the precursor
- Returns:
Retention time in seconds
- getReferencingHits(self, in_0: List[PeptideHit], in_1: Set[bytes]) List[PeptideHit]#
Returns all peptide hits which reference to a given protein accession (i.e. filter by protein accession)
- getScoreType(self) bytes | str | String#
Returns the type of score (e.g., “Mascot”, “XTandem”, “q-value”)
- Returns:
Name of the score type
- getSignificanceThreshold(self) float#
Returns the significance threshold value
- Returns:
The threshold value (interpretation depends on score type)
Hits with scores below/above this threshold (depending on score direction) may be considered insignificant
- hasMZ(self) bool#
Checks if m/z value is set
- Returns:
True if m/z is available, False otherwise
- hasRT(self) bool#
Checks if retention time is set
- Returns:
True if RT is available, False otherwise
- insertHit(self, in_0: PeptideHit) None#
Appends a peptide hit to the list
- Parameters:
hit – The peptide hit to add
- isHigherScoreBetter(self) bool#
Returns whether higher scores are better
- Returns:
True if higher scores indicate better matches, False if lower is better
- 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
- setHigherScoreBetter(self, in_0: bool) None#
Sets whether higher scores are better
- Parameters:
higher_better – True if higher scores are better, False otherwise
- setHits(self, in_0: List[PeptideHit]) None#
Sets all peptide hits at once
- Parameters:
hits – List of peptide hits to store
- setIdentifier(self, in_0: bytes | str | String) None#
Sets the identifier linking to a ProteinIdentification
- Parameters:
identifier – Unique identifier string
- setMZ(self, in_0: float) None#
Sets the precursor m/z value
- Parameters:
mz – Mass-to-charge ratio of the precursor
- 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
- setRT(self, in_0: float) None#
Sets the retention time of the precursor
- Parameters:
rt – Retention time in seconds
- setScoreType(self, in_0: bytes | str | String) None#
Sets the score type
- Parameters:
score_type – Name of the score type (e.g., “Mascot”, “XTandem”)
- setSignificanceThreshold(self, value: float) None#
Sets the significance threshold value
- Parameters:
value – The threshold value to set
- sort(self) None#