![]() |
OpenMS
|
Inference engine for PeptDeep MS2 Fragment Intensity prediction. More...
#include <OpenMS/ML/PEPTDEEP/PeptDeepMS2Inference.h>
Public Types | |
| enum | Channel : size_t { B_Z1 = 0 , B_Z2 = 1 , Y_Z1 = 2 , Y_Z2 = 3 } |
| The channels of a cleavage position: [b_z1, b_z2, y_z1, y_z2, b_modloss_z1, b_modloss_z2, y_modloss_z1, y_modloss_z2]. More... | |
Public Member Functions | |
| PeptDeepMS2Inference (const std::string &model_path, int threads=4, size_t batch_size=500) | |
| Constructor initializes the ONNX session with the specified model graph. | |
| ~PeptDeepMS2Inference () | |
| Destructor. | |
| std::vector< std::vector< float > > | predictMS2 (const std::vector< std::string > &peptides, const std::vector< float > &charges, const std::vector< float > &nces, const std::vector< int64_t > &instrument_indices) |
| Predicts MS2 fragment intensities for a batch of peptide sequences. | |
Static Public Member Functions | |
| static size_t | ionIndex (size_t length, char type, size_t ordinal, int charge, size_t channels=ION_CHANNELS) |
| The index into a prediction of predictMS2() of the b or y ion of a peptide. | |
Static Public Attributes | |
| static constexpr size_t | ION_CHANNELS = 8 |
| The values per cleavage position of a prediction of predictMS2(), in this order (Channel) | |
| static constexpr size_t | NO_ION = static_cast<size_t>(-1) |
| ionIndex() of an ion the prediction does not have | |
Private Attributes | |
| ONNXPredictorBase | model_ |
| size_t | batch_size_ |
Inference engine for PeptDeep MS2 Fragment Intensity prediction.
This class parses and tokenizes raw peptide string sequences into structural integer arrays and evaluates them through the ONNX Runtime backend to predict fragment intensities.
| enum Channel : size_t |
|
explicit |
Constructor initializes the ONNX session with the specified model graph.
| model_path | Absolute or relative path to the PeptDeep MS2 ONNX model file. |
| threads | The model runs (of at most batch_size peptides of one length each) that run at once, each on one thread (default 4). |
| batch_size | Maximum number of peptides to process in a single ONNX run (default 500). |
| Exception::BaseException | if the model file cannot be found or loaded by the runtime. |
| ~PeptDeepMS2Inference | ( | ) |
Destructor.
|
static |
The index into a prediction of predictMS2() of the b or y ion of a peptide.
Cleavage position pos (0-based) carries b(pos + 1) and y(length - 1 - pos), with channels values each.
| length | The peptide's length (residues) |
| type | 'b' or 'y' |
| ordinal | The ion's ordinal, 1 to length - 1 |
| charge | 1 or 2 |
| channels | The values per cleavage position (ION_CHANNELS, unless a model has another layout) |
| std::vector< std::vector< float > > predictMS2 | ( | const std::vector< std::string > & | peptides, |
| const std::vector< float > & | charges, | ||
| const std::vector< float > & | nces, | ||
| const std::vector< int64_t > & | instrument_indices | ||
| ) |
Predicts MS2 fragment intensities for a batch of peptide sequences.
| peptides | A vector of peptide strings. Supports OpenMS AASequence modification notation (e.g., "PEPTIDEK", "M(Oxidation)PEP"). |
| charges | A vector of precursor charge states (must match peptides size). |
| nces | A vector of normalized collision energies (must match peptides size). |
| instrument_indices | One peptdeep instrument index per peptide. Derive these with ML::instrumentIndex() rather than writing literals: the encoding is positional and belongs to peptdeep (ML::ALPHAPEPTDEEP_INSTRUMENTS), where 0 is QE and 1 is Lumos. Indices outside [0, ML::PEPTDEEP_MAX_INSTRUMENT_NUM) are rejected, because the model's OneHot would otherwise answer them with an all-off row. |
| Exception::IllegalArgument | if peptides is empty, size constraints fail, or a sequence is chemically invalid. |
|
private |
|
staticconstexpr |
The values per cleavage position of a prediction of predictMS2(), in this order (Channel)
|
private |
|
staticconstexpr |
ionIndex() of an ion the prediction does not have