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
48 static std::map<QThread *, TimsDataFastMap> m_preAllocatedFastaMapPerThread;
50
52 // static constexpr quint32 index_not_defined{
53 // std::numeric_limits<quint32>::max()};
54
56 {
57 bool first_access = true;
58 std::size_t count = 0;
59 };
60
61 /** @brief accumulates intesity for the given tof index
62 *
63 * sets the count value on the first access ( first_access is true) and add
64 * the tof index to the tofIndexList then increments it if it is called on the
65 * same tof index
66 */
67 std::size_t accumulateIntensity(quint32 tofIndex, std::size_t intensity);
68
69
70 /** @brief reads intensity for a tof_index
71 *
72 * reads the cumulated intensity for this tof index and replaces the first
73 * access boolean to true.
74 * => this is important to reuse the map in an other computation
75 * No need to erase the content or initialize it
76 */
77 std::size_t readIntensity(quint32);
78
79
80 /** @brief downsize mz resolution to lower the number of real mz computations
81 *
82 * the map is modified in place
83 *
84 * @param mzindex_merge_window width of the mzindex window used to merge all
85 * intensities into a single point. This results in faster computing.
86 */
87 void downsizeMzRawMap(std::size_t mzindex_merge_window);
88
89 /** @brief simple filter to agregate counts on neigbhor mobility slots (+1)
90 *
91 * the map is modified in place
92 *
93 */
94 void builtInCentroid();
95
97
98 std::vector<quint32> tofIndexList;
99
100 std::vector<TimsDataFastMapElement> mapTofIndexIntensity;
101};
102
103} // namespace pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
replacement for std::map
std::size_t accumulateIntensity(quint32 tofIndex, std::size_t intensity)
accumulates intesity for the given tof index
void builtInCentroid()
simple filter to agregate counts on neigbhor mobility slots (+1)
static std::map< QThread *, TimsDataFastMap > m_preAllocatedFastaMapPerThread
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()
std::vector< TimsDataFastMapElement > mapTofIndexIntensity