libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
spomsprotein.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Aurélien Berthier
3 * <aurelien.berthier@ls2n.fr>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "spomsprotein.h"
20
21
22namespace pappso
23{
24namespace specpeptidoms
25{
26SpOMSProtein::SpOMSProtein(const QString &description,
27 const QString &sequence,
28 const AaCode &aa_code)
29 : m_description(description), m_sequence(sequence)
30{
31 clear();
32
33 SpOMSAa aa;
34
35 for(const QChar &aa_str : m_sequence)
36 {
37 aa.aa = (pappso::Enums::AminoAcidChar)aa_str.toLatin1();
38 aa.code = aa_code.getAaCode(aa.aa);
39 aa.mass = aa_code.getMass(aa.code);
40 push_back(aa);
41 }
42
43 // by default the sequence is reversed
44 std::reverse(begin(), end());
45}
46
50
51const QString
53{
54 return m_description.split(" ").at(0);
55}
56
57const QString &
59{
60 return m_sequence;
61}
62
63
64const QString &
69
70std::vector<SpOMSAa>
71SpOMSProtein::sliced(std::size_t position, std::size_t length) const
72{
73
74 std::vector<SpOMSAa> aa_vec;
75
76 for(std::size_t i = 0; i < length; i++)
77 {
78 aa_vec.push_back(at(i + position));
79 }
80
81 return aa_vec;
82}
83} // namespace specpeptidoms
84} // namespace pappso
collection of integer code for each amino acid 0 => null 1 to 20 => amino acid sorted by there mass (...
Definition aacode.h:44
uint8_t getAaCode(char aa_letter) const
get the integer code of an amino acid with the one letter code
Definition aacode.cpp:81
double getMass(uint8_t aa_code) const
get the mass of the amino acid given its integer code the amino acid can bear some modification (if a...
Definition aacode.cpp:224
const QString & getSequence() const
SpOMSProtein(const QString &description, const QString &sequence, const AaCode &aa_code)
const QString & getCompleteDescription() const
std::vector< SpOMSAa > sliced(std::size_t position, std::size_t length) const
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39