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
68 /** @brief add ItemCart to Bucket list
69 * Each item in the cart is a key to build dedicated buckets for one item
70 * The buckets will then reference the carts that contains one item
71 *
72 * @param item_cart to add in the bucket list
73 */
74 void addItemCart(const ItemCart &item_cart);
75
76 std::size_t getItemCartCount() const;
77
78 /**
79 * Iterate the buckets present in the map collection and store them into a raw
80 * array of buckets lexicographically sorted based on the buckets content.
81 * Erase the map representation afterwards to spare memory.
82 * @return an array of buckets
83 * @since 0.1
84 */
85 std::vector<Bucket> asSortedList() const;
86
87 /**
88 * Provides access to the number of buckets present in the collection.
89 * @return The size of the collection
90 * @since 0.1
91 */
92 std::size_t size() const;
93
94
95 /** @brief removes buckets only showing intra relations in the spectrum index
96 * range
97 *
98 * removes buckets if their relationships implies only spectrum within the
99 * range of index given as arguments
100 *
101 * @remark as spectrum index are sorted in buckets, boundaries are easy to
102 * check
103 *
104 * @param spectrum_idx_begin spectrum index defining the starting boundary
105 * @param spectrum_idx_end spectrum index defining the ending boundary
106 *
107 */
108 void removeBucketsWithinCartIdRange(std::size_t spectrum_idx_begin,
109 std::size_t spectrum_idx_end);
110
111
112 private:
113 /**
114 * Map of the mass value to the bucket representing this mass value.
115 * This representation is mainly used to fill the data and is then stored into
116 * a raw array and disposed.
117 * @since 0.1
118 */
119 std::map<std::size_t, Bucket> m_bucketMap;
120
121 std::size_t m_itemCartCount = 0;
122};
123} // namespace spectree
124} // namespace pappso
bucket for spectree
std::map< std::size_t, Bucket > m_bucketMap
container for spectree items
Definition itemcart.h:55
#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