libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
bucket.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/spectree/bucket.h
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#pragma once
37
38#include <vector>
39
40namespace pappso
41{
42namespace spectree
43{
44
45/***
46 * Contains the identifiers from spectra which possess a mass correspoding to
47 * the one associated to the bucket. Once the filling is complete, a bucket must
48 * be sorted. Spectra identifiers need to be positive integers to ensure sort
49 * correctness.
50 *
51 * @author Matthieu David
52 * @version 0.1
53 */
54
55class Bucket
56{
57 public:
58 /**
59 * Bucket creation with appropriated initialisation for the identifiers and
60 * the mass value.
61 * @param val the mass value (item id) associated to the bucket
62 * @return b a bucket object properly instanciated
63 * @since 0.1
64 */
65 Bucket(std::size_t val);
66
67 Bucket(const Bucket &other);
68
69 /**
70 * Accessor to the mass value (item id) associated to the bucket.
71 * @return the mass value
72 * @since 0.1
73 */
74 std::size_t getId() const;
75
76 /**
77 * Insertion of a new identifier in the bucket. Insertion happen to the end.
78 * @param cart The cart identifier to add in the bucket
79 * @since 0.1
80 */
81 void push_back(std::size_t cart);
82
83 /**
84 * Return the number of identifiers contained in the bucket.
85 * @return the number of identifiers
86 * @since 0.1
87 */
88 std::size_t size() const;
89
90 /**
91 * Implementation of the comparable interface in order to be able to compare
92 * two buckets and sort a collection of buckets lexicographically.
93 * @param b The bucket to compare with the current one
94 * @return -x if the bucket is lexicographically smaller, +x if the bucket is
95 * lexicographically bigger and 0 if they have the same content, where x is a
96 * non-zero integer.
97 * @since 0.1
98 */
99 bool operator<(const Bucket &bucket_two) const;
100
101 const std::vector<std::size_t> &getCartList() const;
102
103 /** @brief get the first cart id of the list
104 * */
105 std::size_t front() const;
106
107 /** @brief get the last cart id of the list
108 * */
109 std::size_t back() const;
110
111 private:
112 /**
113 * The mass value associated to the bucket.
114 * This value cannot be modified.
115 * @since 0.1
116 */
117
118 std::size_t m_itemId;
119
120
121 /**
122 * Spectrum identifiers stored in an optimized array to reduce the memory
123 * occupation (fastutils). This list can only be filled, sorted or accessed in
124 * read-only.
125 * @since 0.1
126 */
127 std::vector<std::size_t> m_cartList;
128};
129} // namespace spectree
130} // namespace pappso
std::size_t size() const
Definition bucket.cpp:62
bool operator<(const Bucket &bucket_two) const
Definition bucket.cpp:75
std::size_t m_itemId
Definition bucket.h:118
void push_back(std::size_t cart)
Definition bucket.cpp:56
std::vector< std::size_t > m_cartList
Definition bucket.h:127
std::size_t back() const
get the last cart id of the list
Definition bucket.cpp:103
std::size_t getId() const
Definition bucket.cpp:68
std::size_t front() const
get the first cart id of the list
Definition bucket.cpp:97
const std::vector< std::size_t > & getCartList() const
Definition bucket.cpp:109
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39