libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
timsdatafastmap.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/vendors/tims/timsdatafastmap.h
3 * \date 16/12/2023
4 * \author Olivier Langella
5 * \brief replacement fot std::map dedicated to tims data for fast computations
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2023 Olivier Langella
10 *<Olivier.Langella@universite-paris-saclay.fr>.
11 *
12 * This file is part of the PAPPSOms++ library.
13 *
14 * PAPPSOms++ is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * PAPPSOms++ is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26 *
27 ******************************************************************************/
28
29#pragma once
30
31#include <cstdlib>
32#include <QtGlobal>
33#include <vector>
34#include <map>
35#include <QThread>
36
37namespace pappso
38{
39/**
40 * @brief replacement for std::map
41 *
42 * Beware to use it carefully : clear the tofIndexList before using it
43 *
44 */
46{
47 public:
48 static std::map<QThread *, TimsDataFastMap> m_preAllocatedFastMapPerThread;
50
51 // static constexpr quint32 index_not_defined{
52 // std::numeric_limits<quint32>::max()};
53
55 {
56 bool first_access = true;
57 std::size_t count = 0;
58 };
59
60 /** @brief accumulates intesity for the given tof index
61 *
62 * sets the count value on the first access ( first_access is true) and add
63 * the tof index to the tofIndexList then increments it if it is called on the
64 * same tof index
65 */
66 std::size_t accumulateIntensity(quint32 tofIndex, std::size_t intensity);
67
68
69 /** @brief reads intensity for a tof_index
70 *
71 * reads the cumulated intensity for this tof index and replaces the first
72 * access boolean to true.
73 * => this is important to reuse the map in an other computation
74 * No need to erase the content or initialize it
75 */
76 std::size_t readIntensity(quint32);
77
78
79 /** @brief downsize mz resolution to lower the number of real mz computations
80 *
81 * the map is modified in place
82 *
83 * @param mzindex_merge_window width of the mzindex window used to merge all
84 * intensities into a single point. This results in faster computing.
85 */
86 void downsizeMzRawMap(std::size_t mzindex_merge_window);
87
88 /** @brief simple filter to agregate counts on neigbhor mobility slots (+1)
89 *
90 * the map is modified in place
91 *
92 */
93 void builtInCentroid();
94
96
97 const std::vector<quint32> &getTofIndexList() const;
98
99 void clear();
100
101 private:
103
104 std::vector<quint32> tofIndexList;
105
106 std::vector<TimsDataFastMapElement> mapTofIndexIntensity;
107};
108
109} // namespace pappso
replacement for std::map
std::size_t accumulateIntensity(quint32 tofIndex, std::size_t intensity)
accumulates intesity for the given tof index
const std::vector< quint32 > & getTofIndexList() const
void builtInCentroid()
simple filter to agregate counts on neigbhor mobility slots (+1)
std::size_t readIntensity(quint32)
reads intensity for a tof_index
std::vector< quint32 > tofIndexList
void downsizeMzRawMap(std::size_t mzindex_merge_window)
downsize mz resolution to lower the number of real mz computations
static TimsDataFastMap & getTimsDataFastMapInstance()
static std::map< QThread *, TimsDataFastMap > m_preAllocatedFastMapPerThread
std::vector< TimsDataFastMapElement > mapTofIndexIntensity
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39