libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
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
#include "
pappsomspp/export-import-config.h
"
42
43
namespace
pappso
44
{
45
namespace
specpeptidoms
46
{
47
48
struct
Location
49
{
50
// std::vector<uint8_t> prot_sequence;
51
52
/** @brief convenient function to get peptide sequence from location
53
*/
54
QString
getPeptideString
()
const
;
55
56
/** @brief start position of the subsequence
57
*/
58
std::size_t
beginning
;
59
60
/** @brief length of the subsequence
61
*/
62
std::size_t
length
;
63
64
65
/** index of the alignment tree
66
*/
67
int
tree
;
68
69
/** @TODO number of matching peak ?
70
*/
71
int
score
;
72
73
/** @brief Protein accession
74
*/
75
const
SpOMSProtein
*
proteinPtr
;
76
};
77
78
class
PMSPP_LIB_DECL
LocationSaver
79
{
80
public
:
81
/**
82
* Constructor
83
*/
84
LocationSaver
();
85
86
/**
87
* Destructor
88
*/
89
~LocationSaver
();
90
91
/**
92
* @brief Adds a location to the locations heap. If a saved location has the same tree_id, it will
93
* replace it. Otherwise, it replaces the location with the lowest score.
94
*/
95
void
addLocation
(std::size_t beginning,
96
std::size_t length,
97
int
tree,
98
int
score,
99
const
SpOMSProtein
*protein_ptr);
100
101
/**
102
* @brief Returns a vector containing the saved locations.
103
* @return vector of Location of size MAX_SAVED_ALIGNMENTS
104
*/
105
std::vector<Location>
getLocations
()
const
;
106
107
/**
108
* @brief Creates a new alignment tree and returns its id
109
*/
110
std::size_t
getNextTree
();
111
112
/**
113
* @brief Returns the minimum score for a location with the provided tree_id to be saved in the
114
* heap.
115
*/
116
int
getMinScore
(
int
tree_id)
const
;
117
118
void
resetLocationSaver
();
119
120
private
:
121
static
bool
locationCompare
(
const
Location
&loc1,
const
Location
&loc2);
122
123
std::vector<Location>
m_locations_heap
;
124
std::vector<int>
m_tree_scores
;
125
std::vector<bool>
m_tree_in_heap
;
126
};
127
}
// namespace specpeptidoms
128
}
// namespace pappso
pappso::specpeptidoms::LocationSaver::getMinScore
int getMinScore(int tree_id) const
Returns the minimum score for a location with the provided tree_id to be saved in the heap.
Definition
locationsaver.cpp:151
pappso::specpeptidoms::LocationSaver::m_tree_scores
std::vector< int > m_tree_scores
Definition
locationsaver.h:124
pappso::specpeptidoms::LocationSaver::resetLocationSaver
void resetLocationSaver()
Definition
locationsaver.cpp:186
pappso::specpeptidoms::LocationSaver::locationCompare
static bool locationCompare(const Location &loc1, const Location &loc2)
Definition
locationsaver.cpp:75
pappso::specpeptidoms::LocationSaver::LocationSaver
LocationSaver()
Definition
locationsaver.cpp:59
pappso::specpeptidoms::LocationSaver::addLocation
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....
Definition
locationsaver.cpp:82
pappso::specpeptidoms::LocationSaver::m_tree_in_heap
std::vector< bool > m_tree_in_heap
Definition
locationsaver.h:125
pappso::specpeptidoms::LocationSaver::getLocations
std::vector< Location > getLocations() const
Returns a vector containing the saved locations.
Definition
locationsaver.cpp:126
pappso::specpeptidoms::LocationSaver::m_locations_heap
std::vector< Location > m_locations_heap
Definition
locationsaver.h:123
pappso::specpeptidoms::LocationSaver::getNextTree
std::size_t getNextTree()
Creates a new alignment tree and returns its id.
Definition
locationsaver.cpp:143
pappso::specpeptidoms::SpOMSProtein
Definition
spomsprotein.h:38
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition
export-import-config.h:14
pappso::specpeptidoms
Definition
correctiontree.h:40
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
spomsprotein.h
pappso::specpeptidoms::Location
Definition
locationsaver.h:49
pappso::specpeptidoms::Location::tree
int tree
Definition
locationsaver.h:67
pappso::specpeptidoms::Location::length
std::size_t length
length of the subsequence
Definition
locationsaver.h:62
pappso::specpeptidoms::Location::getPeptideString
QString getPeptideString() const
convenient function to get peptide sequence from location
Definition
locationsaver.cpp:44
pappso::specpeptidoms::Location::beginning
std::size_t beginning
start position of the subsequence
Definition
locationsaver.h:58
pappso::specpeptidoms::Location::proteinPtr
const SpOMSProtein * proteinPtr
Protein accession.
Definition
locationsaver.h:75
pappso::specpeptidoms::Location::score
int score
Definition
locationsaver.h:71
pappsomspp
core
processing
specpeptidoms
locationsaver.h
Generated on
for libpappsomspp by
1.17.0