OpenMS
Loading...
Searching...
No Matches
PeptDeepUtils.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Satyam Yadav, Justin Sing $
7// --------------------------------------------------------------------------
8#pragma once
9
12#include <string>
13#include <vector>
14#include <array>
15#include <string_view>
16
17namespace OpenMS {
18 namespace ML {
19
20 // --- Shared PeptDeep Architecture Constants ---
21 constexpr int64_t PEPTDEEP_MOD_ELEMENTS = 109;
22
26 inline constexpr std::array<std::string_view, 109> ALPHAPEPTDEEP_MOD_ELEMENTS = {
27 "C", "H", "N", "O", "P", "S", "B", "F", "I", "K", "U", "V", "W", "X", "Y",
28 "Ac", "Ag", "Al", "Am", "Ar", "As", "At", "Au", "Ba", "Be", "Bi", "Bk",
29 "Br", "Ca", "Cd", "Ce", "Cf", "Cl", "Cm", "Co", "Cr", "Cs", "Cu", "Dy",
30 "Er", "Es", "Eu", "Fe", "Fm", "Fr", "Ga", "Gd", "Ge", "He", "Hf", "Hg",
31 "Ho", "In", "Ir", "Kr", "La", "Li", "Lr", "Lu", "Md", "Mg", "Mn", "Mo",
32 "Na", "Nb", "Nd", "Ne", "Ni", "No", "Np", "Os", "Pa", "Pb", "Pd", "Pm",
33 "Po", "Pr", "Pt", "Pu", "Ra", "Rb", "Re", "Rh", "Rn", "Ru", "Sb", "Sc",
34 "Se", "Si", "Sm", "Sn", "Sr", "Ta", "Tb", "Tc", "Te", "Th", "Ti", "Tl",
35 "Tm", "Xe", "Yb", "Zn", "Zr", "2H", "13C", "15N", "18O", "?"
36 };
37
48 inline OpenMS::Int64 getAAIndex(char aa) {
49 if (aa >= 'A' && aa <= 'Z') return aa - 'A' + 1;
50 if (aa >= 'a' && aa <= 'z') return aa - 'a' + 1;
51 return 0; // 0 serves as the padding and unknown token
52 }
53
59 inline void validatePeptide(const std::string& peptide) {
60 if (peptide.empty()) {
61 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Peptide sequence cannot be empty.");
62 }
63 }
64
65 }
66}
A method or algorithm argument contains illegal values.
Definition Exception.h:633
int64_t Int64
Signed integer type (64bit)
Definition Types.h:40
OpenMS::Int64 getAAIndex(char aa)
Maps amino acid characters to 1-based token indices for PeptDeep models.
Definition PeptDeepUtils.h:48
constexpr int64_t PEPTDEEP_MOD_ELEMENTS
Definition PeptDeepUtils.h:21
void validatePeptide(const std::string &peptide)
Validates a peptide sequence for PeptDeep inference. Complex character validation and modification pa...
Definition PeptDeepUtils.h:59
constexpr std::array< std::string_view, 109 > ALPHAPEPTDEEP_MOD_ELEMENTS
AlphaPeptDeep's exact 109-element array for modification tensor mapping. Elements missing from this l...
Definition PeptDeepUtils.h:26
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19