libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
locationsaver.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/specpeptidoms/locationsaver.h
3 * \date 24/03/2025
4 * \author Aurélien Berthier
5 * \brief save protein subsequences for alignment
6 *
7 * C++ implementation of the SpecPeptidOMS algorithm described in :
8 * (1) Benoist, É.; Jean, G.; Rogniaux, H.; Fertin, G.; Tessier, D. SpecPeptidOMS Directly and
9 * Rapidly Aligns Mass Spectra on Whole Proteomes and Identifies Peptides That Are Not Necessarily
10 * Tryptic: Implications for Peptidomics. J. Proteome Res. 2025.
11 * https://doi.org/10.1021/acs.jproteome.4c00870.
12 */
13
14/*
15 * Copyright (c) 2025 Aurélien Berthier
16 * <aurelien.berthier@ls2n.fr>
17 *
18 *
19>>>>>>> main:src/pappsomspp/processing/specpeptidoms/locationsaver.h
20 * This program is free software: you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation, either version 3 of the License, or
23 * (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 */
33
34#pragma once
35
36#include <cstddef>
37#include <vector>
38#include <algorithm>
39#include <QString>
40#include "spomsprotein.h"
41
42namespace pappso
43{
44namespace specpeptidoms
45{
46
48{
49 // std::vector<uint8_t> prot_sequence;
50
51 /** @brief convenient function to get peptide sequence from location
52 */
53 QString getPeptideString() const;
54
55 /** @brief start position on ?
56 */
57 std::size_t beginning;
58
59 /** @brief length of ?
60 */
61 std::size_t length;
62
63
64 /** @TODO index of a tree ?
65 */
66 int tree;
67
68 /** @TODO number of matching peak ?
69 */
70 int score;
71
72 /** @brief Protein accession
73 */
75};
76
78{
79 public:
80 /**
81 * Constructor
82 */
84
85 /**
86 * Destructor
87 */
89
90 /**
91 * @brief Adds a location to the locations heap. If a saved location has the same tree_id, it will
92 * replace it. Otherwise, it replaces the location with the lowest score.
93 */
94 void addLocation(std::size_t beginning,
95 std::size_t length,
96 int tree,
97 int score,
98 const SpOMSProtein *protein_ptr);
99
100 /**
101 * @brief Returns a vector containing the saved locations.
102 * @return vector of Location of size MAX_SAVED_ALIGNMENTS
103 */
104 std::vector<Location> getLocations() const;
105
106 /**
107 * @brief Creates a new alignment tree and returns its id
108 */
109 std::size_t getNextTree();
110
111 /**
112 * @brief Returns the minimum score for a location with the provided tree_id to be saved in the
113 * heap.
114 */
115 int getMinScore(int tree_id) const;
116
117 void resetLocationSaver();
118
119 private:
120 static bool locationCompare(const Location &loc1, const Location &loc2);
121
122 std::vector<Location> m_locations_heap;
123 std::vector<int> m_tree_scores;
124 std::vector<bool> m_tree_in_heap;
125};
126} // namespace specpeptidoms
127} // namespace pappso
int getMinScore(int tree_id) const
Returns the minimum score for a location with the provided tree_id to be saved in the heap.
static bool locationCompare(const Location &loc1, const Location &loc2)
void addLocation(std::size_t beginning, std::size_t length, int tree, int score, const SpOMSProtein *protein_ptr)
Adds a location to the locations heap. If a saved location has the same tree_id, it will replace it....
std::vector< Location > getLocations() const
Returns a vector containing the saved locations.
std::vector< Location > m_locations_heap
std::size_t getNextTree()
Creates a new alignment tree and returns its id.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::size_t length
length of ?
QString getPeptideString() const
convenient function to get peptide sequence from location
std::size_t beginning
start position on ?
const SpOMSProtein * proteinPtr
Protein accession.