ProteinHit#
- class pyopenms.ProteinHit#
Bases:
MetaInfoInterfaceRepresents 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__() None#
- __init__(arg: pyopenms.ProteinHit, /) None
- __init__(arg0: float, arg1: int, arg2: str, arg3: str, /) None
Methods
__init__()Removes all meta values
Returns the protein accession
Returns the sequence coverage percentage
Returns the protein description
getKeys(keys)Fills the given list with all meta value keys
getMetaValue(name)Returns the value corresponding to a string, or DataValue::EMPTY if not found
Returns all meta values as a dictionary of {name: value}
getRank()Returns the rank of this protein hit
getScore()Returns the protein inference score
Returns the protein sequence
isDecoy()Checks if this is a decoy protein hit
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
setAccession(accession)Sets the protein accession
setCoverage(coverage)Sets the sequence coverage percentage
setDescription(description)Sets the protein description
setMetaValue(name, value)Sets the DataValue corresponding to a name
setMetaValues(values)Sets multiple meta values from a dictionary of {name: value}
setRank(newrank)Sets the rank
setScore(score)Sets the protein inference score
setSequence(sequence)Sets the protein sequence
- clearMetaInfo() None#
Removes all meta values
- getAccession() str#
Returns the protein accession
- Returns:
Database accession/identifier (e.g., “P12345” for UniProt)
- getCoverage() 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() str#
Returns the protein description
- Returns:
Human-readable protein name/description from database
- getKeys(keys: list) None#
Fills the given list with all meta value keys
- getMetaValue(name: str) None | int | float | str | bytes | list[str] | list[int] | list[float]#
- getMetaValue(name: str, default_value: None | int | float | str | bytes | list[str] | list[int] | list[float]) None | int | float | str | bytes | list[str] | list[int] | list[float]
- getMetaValue(index: int) None | int | float | str | bytes | list[str] | list[int] | list[float]
- getMetaValue(index: int, default_value: None | int | float | str | bytes | list[str] | list[int] | list[float]) None | int | float | str | bytes | list[str] | list[int] | list[float]
Returns the value corresponding to a string, or DataValue::EMPTY if not found
- getMetaValues() dict#
Returns all meta values as a dictionary of {name: value}
- getRank() int#
Returns the rank of this protein hit
- Returns:
Rank (1 = best hit, 2 = second best, etc.)
- getScore() float#
Returns the protein inference score
- Returns:
Score from protein inference algorithm
- getSequence() str#
Returns the protein sequence
- Returns:
Full amino acid sequence of the protein (if available)
- isDecoy() bool#
Checks if this is a decoy protein hit
- Returns:
True if this is a decoy hit from target-decoy search
- isMetaEmpty() bool#
Returns if the MetaInfo is empty
- static metaRegistry() pyopenms.MetaInfoRegistry#
Returns a reference to the MetaInfoRegistry
- metaValueExists(name: str) bool#
- metaValueExists(index: int) bool
Returns whether an entry with the given name exists
- removeMetaValue(name: str) None#
- removeMetaValue(index: int) None
Removes the DataValue corresponding to name if it exists
- setAccession(accession: str) None#
Sets the protein accession
- Parameters:
accession – Database accession/identifier
- setCoverage(coverage: float) None#
Sets the sequence coverage percentage
- Parameters:
coverage – Percentage (0-100) of sequence covered by peptides
- setDescription(description: str) None#
Sets the protein description
- Parameters:
description – Human-readable protein name/description
- setMetaValue(name: str, value: None | int | float | str | bytes | list[str] | list[int] | list[float]) None#
- setMetaValue(index: int, value: None | int | float | str | bytes | list[str] | list[int] | list[float]) None
Sets the DataValue corresponding to a name
- setMetaValues(values: dict) None#
Sets multiple meta values from a dictionary of {name: value}
- setRank(newrank: int) None#
Sets the rank
- Parameters:
newrank – Rank among all protein candidates
- setScore(score: float) None#
Sets the protein inference score
- Parameters:
score – Score to set
- setSequence(sequence: str) None#
- setSequence(sequence: str) None
Sets the protein sequence
- Parameters:
sequence – Full amino acid sequence