PeptideProteinResolution#
- class pyopenms.PeptideProteinResolution#
Bases:
objectResolves shared peptides based on protein scores
Resolves connected components of the bipartite protein-peptide graph based on protein probabilities/scores and adds them as additional protein_groups to the protein identification run processed. Thereby greedily assigns shared peptides in this component uniquely to the proteins of the current @em best @em indistinguishable protein group, until every peptide is uniquely assigned. This effectively allows more peptides to be used in ProteinQuantifier at the cost of potentially additional noise in the peptides quantities. In accordance with most state-of-the-art protein inference tools, only the best hit (PSM) for a peptide ID is considered. Probability ties are currently resolved by taking the protein with larger number of peptides
The class could provide iterator for ConnectedComponents in the future. One could extend the graph to include all PeptideHits (not only the best). It becomes a tripartite graph with larger connected components then. Maybe extend it to work with MS1 features. Separate resolution and adding groups to output
- __init__(arg: bool, /) None#
Methods
__init__(arg, /)buildGraph(protein, peptides[, skip_sort])Initialize and store the graph (= maps), needs sorted groups for correct functionality.
findConnectedComponent(root_prot_grp)Does a BFS on the two maps (= two parts of the graph; indist.
resolveConnectedComponent(conn_comp, ...)Resolves connected components based on posterior probabilities and adds them as additional protein_groups to the output idXML.
resolveGraph(protein, peptides)Applies resolveConnectedComponent to every component of the graph and is able to write statistics when specified.
run(inferred_protein_id, inferred_peptide_ids)Convenience function that performs graph building and group resolution
- buildGraph(protein: pyopenms.ProteinIdentification, peptides: pyopenms.PeptideIdentificationList, skip_sort: bool = False) None#
Initialize and store the graph (= maps), needs sorted groups for correct functionality. Therefore sorts the indist. protein groups if not skipped
- Parameters:
protein – ProteinIdentification object storing IDs and groups
peptides – Vector of ProteinIdentifications with links to the proteins
skip_sort – Skips sorting of groups, nothing is modified then
- findConnectedComponent(root_prot_grp: int) pyopenms.PeptideProteinResolution_ConnectedComponent#
Does a BFS on the two maps (= two parts of the graph; indist. prot. groups and peptides), switching from one to the other in each step
- Parameters:
root_prot_grp – Starts the BFS at this protein group index
- Returns:
Returns a Connected Component as set of group and peptide indices
- resolveConnectedComponent(conn_comp: pyopenms.PeptideProteinResolution_ConnectedComponent, protein: pyopenms.ProteinIdentification, peptides: pyopenms.PeptideIdentificationList) None#
Resolves connected components based on posterior probabilities and adds them as additional protein_groups to the output idXML. Thereby greedily assigns shared peptides in this component uniquely to the proteins of the current BEST INDISTINGUISHABLE protein group, ready to be used in ProteinQuantifier then. This is achieved by removing all other evidence from the input PeptideIDs and iterating until each peptide is uniquely assigned. In accordance with Fido only the best hit (PSM) for an ID is considered. Probability ties resolved by taking protein with largest number of peptides
- Parameters:
conn_comp – The component to be resolved
protein – ProteinIdentification object storing IDs and groups
peptides – Vector of ProteinIdentifications with links to the proteins
- resolveGraph(protein: pyopenms.ProteinIdentification, peptides: pyopenms.PeptideIdentificationList) None#
Applies resolveConnectedComponent to every component of the graph and is able to write statistics when specified. Parameters will both be mutated in this method
- Parameters:
protein – ProteinIdentification object storing IDs and groups
peptides – vector of ProteinIdentifications with links to the proteins
- static run(inferred_protein_id: collections.abc.Sequence[pyopenms.ProteinIdentification], inferred_peptide_ids: pyopenms.PeptideIdentificationList) list[pyopenms.ProteinIdentification]#
Convenience function that performs graph building and group resolution
After resolution, all unreferenced proteins are removed and groups updated.
- Parameters:
inferred_protein_id – ProteinIdentification objects storing IDs and groups
inferred_peptide_ids – PeptideIdentifications with links to the proteins (modified in place)
- Returns:
Updated inferred_protein_id
In/out compatibility (pyOpenMS 3.5 behaviour): a Python list passed as
inferred_protein_idis also updated in place with the returned contents.