libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
bucket.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/processing/spectree/bucket.cpp
3
* \date 13/12/2023
4
* \author Olivier Langella
5
* \brief bucket for spectree
6
*
7
* C++ implementation of algorithm already described in :
8
* 1. David, M., Fertin, G., Rogniaux, H. & Tessier, D. SpecOMS: A Full Open
9
* Modification Search Method Performing All-to-All Spectra Comparisons within
10
* Minutes. J. Proteome Res. 16, 3030–3038 (2017).
11
*
12
* https://www.theses.fr/2019NANT4092
13
*/
14
15
16
/*
17
* SpecTree
18
* Copyright (C) 2023 Olivier Langella
19
* <olivier.langella@universite-paris-saclay.fr>
20
*
21
* This program is free software: you can redistribute ipetide to spectrum
22
* alignmentt and/or modify it under the terms of the GNU General Public License
23
* as published by the Free Software Foundation, either version 3 of the
24
* License, or (at your option) any later version.
25
*
26
* This program is distributed in the hope that it will be useful,
27
* but WITHOUT ANY WARRANTY; without even the implied warranty of
28
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
* GNU General Public License for more details.
30
*
31
* You should have received a copy of th^e GNU General Public License
32
* along with this program. If not, see <http://www.gnu.org/licenses/>.
33
*
34
*/
35
36
#include "
bucket.h
"
37
#include <algorithm>
38
39
40
namespace
pappso
41
{
42
namespace
spectree
43
{
44
45
Bucket::Bucket
(std::size_t val)
46
{
47
m_itemId
= val;
48
}
49
50
Bucket::Bucket
(
const
Bucket
&other) :
m_cartList
(other.
m_cartList
)
51
{
52
m_itemId
= other.
m_itemId
;
53
}
54
55
void
56
Bucket::push_back
(std::size_t cart)
57
{
58
m_cartList
.push_back(cart);
59
}
60
61
std::size_t
62
Bucket::size
()
const
63
{
64
return
m_cartList
.size();
65
}
66
67
std::size_t
68
Bucket::getId
()
const
69
{
70
return
m_itemId
;
71
}
72
73
74
bool
75
Bucket::operator<
(
const
Bucket
&bucket_b)
const
76
{
77
78
auto
it_bucket_end =
m_cartList
.end();
79
auto
it_bucket_b_end = bucket_b.
m_cartList
.end();
80
81
auto
it_bucket =
m_cartList
.begin();
82
auto
it_bucket_b = bucket_b.
m_cartList
.begin();
83
84
for
(; it_bucket != it_bucket_end && it_bucket_b != it_bucket_b_end; it_bucket++, it_bucket_b++)
85
{
86
if
(*it_bucket != *it_bucket_b)
87
return
(*it_bucket < *it_bucket_b);
88
}
89
90
// When the buckets have an equal content until the limit, the shortest one
91
// is returned first
92
return
(
m_cartList
.size() < bucket_b.
m_cartList
.size());
93
}
94
95
std::size_t
96
Bucket::front
()
const
97
{
98
return
m_cartList
.front();
99
}
100
101
std::size_t
102
Bucket::back
()
const
103
{
104
return
m_cartList
.back();
105
}
106
107
const
std::vector<std::size_t> &
108
Bucket::getCartList
()
const
109
{
110
return
m_cartList
;
111
}
112
}
// namespace spectree
113
}
// namespace pappso
bucket.h
pappso::spectree::Bucket::size
std::size_t size() const
Definition
bucket.cpp:62
pappso::spectree::Bucket::operator<
bool operator<(const Bucket &bucket_two) const
Definition
bucket.cpp:75
pappso::spectree::Bucket::m_itemId
std::size_t m_itemId
Definition
bucket.h:118
pappso::spectree::Bucket::push_back
void push_back(std::size_t cart)
Definition
bucket.cpp:56
pappso::spectree::Bucket::m_cartList
std::vector< std::size_t > m_cartList
Definition
bucket.h:127
pappso::spectree::Bucket::Bucket
Bucket(std::size_t val)
Definition
bucket.cpp:45
pappso::spectree::Bucket::back
std::size_t back() const
get the last cart id of the list
Definition
bucket.cpp:102
pappso::spectree::Bucket::getId
std::size_t getId() const
Definition
bucket.cpp:68
pappso::spectree::Bucket::front
std::size_t front() const
get the first cart id of the list
Definition
bucket.cpp:96
pappso::spectree::Bucket::getCartList
const std::vector< std::size_t > & getCartList() const
Definition
bucket.cpp:108
pappso::spectree
Definition
bucket.cpp:43
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappsomspp
core
processing
spectree
bucket.cpp
Generated on
for libpappsomspp by
1.17.0