ProteinHit#
- class pyopenms.ProteinHit#
Bases:
objectCython implementation of _ProteinHit
- Original C++ documentation is available here
– Inherits from [‘MetaInfoInterface’]
Represents a single protein identification hit from a database search
A ProteinHit stores information about a protein that was identified based on peptide evidence. Each hit contains:
Protein accession (database identifier)
Score from protein inference
Rank among protein candidates
Protein sequence (optional)
Sequence coverage percentage
Multiple ProteinHit objects are stored in a ProteinIdentification, typically sorted by score to show the most confident identifications first.
Example usage:
protein_hit = oms.ProteinHit() protein_hit.setAccession("P12345") protein_hit.setScore(150.5) protein_hit.setRank(1) protein_hit.setCoverage(45.2) # 45.2% coverage protein_hit.setDescription("Example protein") # Access information print(f"Accession: {protein_hit.getAccession()}") print(f"Score: {protein_hit.getScore()}, Coverage: {protein_hit.getCoverage()}%")
- __init__()#
Overload:
- __init__(self) None
Overload:
- __init__(self, score: float, rank: int, accession: bytes | str | String, sequence: bytes | str | String) None
Overload:
- __init__(self, in_0: ProteinHit) None
Methods
clearMetaInfo(self)Removes all meta values
getAccession(self)Returns the protein accession
getCoverage(self)Returns the sequence coverage percentage
getDescription(self)Returns the protein description
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
getRank(self)Returns the rank of this protein hit
getScore(self)Returns the protein inference score
getSequence(self)Returns the protein sequence
isDecoy(self)Checks if this is a decoy protein hit
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
setAccession(self, in_0)Sets the protein accession
setCoverage(self, in_0)Sets the sequence coverage percentage
setDescription(self, description)Sets the protein description
setMetaValue(self, in_0, in_1)Sets the DataValue corresponding to a name
setRank(self, in_0)Sets the rank
setScore(self, in_0)Sets the protein inference score
setSequence(self, in_0)Sets the protein sequence
- clearMetaInfo(self) None#
Removes all meta values
- getAccession(self) bytes | str | String#
Returns the protein accession
- Returns:
Database accession/identifier (e.g., “P12345” for UniProt)
- getCoverage(self) float#
Returns the sequence coverage percentage
- Returns:
Percentage of protein sequence covered by identified peptides
Value is in range 0-100 (e.g., 45.2 means 45.2% coverage)
- getDescription(self) bytes | str | String#
Returns the protein description
- Returns:
Human-readable protein name/description from database
- 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
- getRank(self) int#
Returns the rank of this protein hit
- Returns:
Rank (1 = best hit, 2 = second best, etc.)
- getScore(self) float#
Returns the protein inference score
- Returns:
Score from protein inference algorithm
- getSequence(self) bytes | str | String#
Returns the protein sequence
- Returns:
Full amino acid sequence of the protein (if available)
- isDecoy(self) bool#
Checks if this is a decoy protein hit
- Returns:
True if this is a decoy hit from target-decoy search
- 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
- setAccession(self, in_0: bytes | str | String) None#
Sets the protein accession
- Parameters:
accession – Database accession/identifier
- setCoverage(self, in_0: float) None#
Sets the sequence coverage percentage
- Parameters:
coverage – Percentage (0-100) of sequence covered by peptides
- setDescription(self, description: bytes | str | String) None#
Sets the protein description
- Parameters:
description – Human-readable protein name/description
- 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
- setRank(self, in_0: int) None#
Sets the rank
- Parameters:
rank – Rank among all protein candidates
- setScore(self, in_0: float) None#
Sets the protein inference score
- Parameters:
score – Score to set