libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
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 <vector>
33
#include <map>
34
#include <QThread>
35
#include "
pappsomspp/export-import-config.h
"
36
37
namespace
pappso
38
{
39
/**
40
* @brief replacement for std::map
41
*
42
* Beware to use it carefully : clear the tofIndexList before using it
43
*
44
*/
45
class
PMSPP_LIB_DECL
TimsDataFastMap
46
{
47
public
:
48
static
std::map<QThread *, TimsDataFastMap>
m_preAllocatedFastMapPerThread
;
49
static
TimsDataFastMap
&
getTimsDataFastMapInstance
();
50
51
// static constexpr quint32 index_not_defined{
52
// std::numeric_limits<quint32>::max()};
53
54
struct
TimsDataFastMapElement
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
95
void
removeArtefactualSpike
();
96
97
const
std::vector<quint32> &
getTofIndexList
()
const
;
98
99
void
clear
();
100
101
private
:
102
TimsDataFastMap
();
103
104
std::vector<quint32>
tofIndexList
;
105
106
std::vector<TimsDataFastMapElement>
mapTofIndexIntensity
;
107
};
108
109
}
// namespace pappso
pappso::TimsDataFastMap::accumulateIntensity
std::size_t accumulateIntensity(quint32 tofIndex, std::size_t intensity)
accumulates intesity for the given tof index
Definition
timsdatafastmap.cpp:59
pappso::TimsDataFastMap::removeArtefactualSpike
void removeArtefactualSpike()
Definition
timsdatafastmap.cpp:174
pappso::TimsDataFastMap::getTofIndexList
const std::vector< quint32 > & getTofIndexList() const
Definition
timsdatafastmap.cpp:196
pappso::TimsDataFastMap::builtInCentroid
void builtInCentroid()
simple filter to agregate counts on neigbhor mobility slots (+1)
Definition
timsdatafastmap.cpp:117
pappso::TimsDataFastMap::TimsDataFastMap
TimsDataFastMap()
Definition
timsdatafastmap.cpp:53
pappso::TimsDataFastMap::readIntensity
std::size_t readIntensity(quint32)
reads intensity for a tof_index
Definition
timsdatafastmap.cpp:87
pappso::TimsDataFastMap::tofIndexList
std::vector< quint32 > tofIndexList
Definition
timsdatafastmap.h:104
pappso::TimsDataFastMap::downsizeMzRawMap
void downsizeMzRawMap(std::size_t mzindex_merge_window)
downsize mz resolution to lower the number of real mz computations
Definition
timsdatafastmap.cpp:96
pappso::TimsDataFastMap::getTimsDataFastMapInstance
static TimsDataFastMap & getTimsDataFastMapInstance()
Definition
timsdatafastmap.cpp:40
pappso::TimsDataFastMap::m_preAllocatedFastMapPerThread
static std::map< QThread *, TimsDataFastMap > m_preAllocatedFastMapPerThread
Definition
timsdatafastmap.h:48
pappso::TimsDataFastMap::mapTofIndexIntensity
std::vector< TimsDataFastMapElement > mapTofIndexIntensity
Definition
timsdatafastmap.h:106
pappso::TimsDataFastMap::clear
void clear()
Definition
timsdatafastmap.cpp:202
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition
export-import-config.h:14
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::TimsDataFastMap::TimsDataFastMapElement
Definition
timsdatafastmap.h:55
pappso::TimsDataFastMap::TimsDataFastMapElement::count
std::size_t count
Definition
timsdatafastmap.h:57
pappso::TimsDataFastMap::TimsDataFastMapElement::first_access
bool first_access
Definition
timsdatafastmap.h:56
pappsomspp
core
vendors
tims
timsdatafastmap.h
Generated on
for libpappsomspp by
1.17.0