libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
bucketclustering.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/spectree/bucketclustering.h
3 * \date 13/12/2023
4 * \author Olivier Langella
5 * \brief rearrange itemcarts into buckets
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 "itemcart.h"
39#include "bucket.h"
40#include <map>
41
42namespace pappso
43{
44namespace spectree
45{
46
47/***
48 * Implements a collection of lexicographically sortable buckets (according to
49 * the positive integer identifiers they contain).
50 *
51 * @author Matthieu David
52 * @version 0.1
53 */
54
56{
57 public:
58 /**
59 * Initializes and fill the map collection containing the buckets and their
60 * content (spectra identifiers). The spectra identifiers and masses sets are
61 * read from Spectrum objects.
62 * @param spectra an array of Spectrum
63 * @return a map of integers to buckets
64 */
66
67 void addItemCart(const ItemCart &spectrum_int);
68
69 std::size_t getItemCartCount() const;
70
71 /**
72 * Iterate the buckets present in the map collection and store them into a raw
73 * array of buckets lexicographically sorted based on the buckets content.
74 * Erase the map representation afterwards to spare memory.
75 * @return an array of buckets
76 * @since 0.1
77 */
78 std::vector<Bucket> asSortedList() const;
79
80 /**
81 * Provides access to the number of buckets present in the collection.
82 * @return The size of the collection
83 * @since 0.1
84 */
85 std::size_t size() const;
86
87
88 /** @brief removes buckets only showing intra relations in the spectrum index
89 * range
90 *
91 * removes buckets if their relationships implies only spectrum within the
92 * range of index given as arguments
93 *
94 * @remark as spectrum index are sorted in buckets, boundaries are easy to
95 * check
96 *
97 * @param spectrum_idx_begin spectrum index defining the starting boundary
98 * @param spectrum_idx_end spectrum index defining the ending boundary
99 *
100 */
101 void removeBucketsWithinCartIdRange(std::size_t spectrum_idx_begin,
102 std::size_t spectrum_idx_end);
103
104
105 private:
106 /**
107 * Map of the mass value to the bucket representing this mass value.
108 * This representation is mainly used to fill the data and is then stored into
109 * a raw array and disposed.
110 * @since 0.1
111 */
112 std::map<std::size_t, Bucket> m_bucketMap;
113
114 std::size_t m_itemCartCount = 0;
115};
116} // namespace spectree
117} // namespace pappso
bucket for spectree
std::map< std::size_t, Bucket > m_bucketMap
#define PMSPP_LIB_DECL
basic object to study using spectree
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39