libpappsomspp
Library for mass spectrometry
timsbindec.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/vendors/tims/timsbindec.h
3  * \date 23/08/2019
4  * \author Olivier Langella
5  * \brief binary file handler of Bruker's TimsTof raw data
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
10  *
11  * This file is part of the PAPPSOms++ library.
12  *
13  * PAPPSOms++ is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * PAPPSOms++ is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25  *
26  ******************************************************************************/
27 
28 #pragma once
29 
30 #include <QFile>
31 #include <QFileInfo>
32 #include "timsframerecord.h"
33 #include "timsframe.h"
34 #include "timsframerawdatachunck.h"
35 #include <vector>
36 
37 
38 namespace pappso
39 {
40 
41 /**
42  * @todo write docs
43  */
45 {
46  public:
47  /**
48  * Default constructor
49  */
50  TimsBinDec(const QFileInfo &timsBinFile, int timsCompressionType);
51 
52  /**
53  * Copy constructor
54  *
55  * @param other TODO
56  */
57  TimsBinDec(const TimsBinDec &other);
58 
59  /**
60  * Destructor
61  */
62  virtual ~TimsBinDec();
63 
64  // TimsFrameCstSPtr getTimsFrameCstSPtr(std::size_t timsId);
65 
67  std::size_t frameId,
68  const std::vector<pappso::TimsFrameRecord> &frame_record_list);
69 
70  /** @brief close file access and flush cache
71  */
72  void closeLinearRead();
73 
74 
75  private:
76  /** @brief open one QFile handler for linear read
77  */
78  QFile *
79  getQfileLinear(std::size_t frameId,
80  const std::vector<pappso::TimsFrameRecord> &frame_record_list);
81  /** @brief open one QFile handler for random read
82  */
83  QFile *getQfileRandom();
84  /** @brief populate a fifo buffer with TimsFrameRawDataChunck
85  * accelerates inputs from file
86  */
87  void startLinearRead(
88  std::size_t start_frame_id,
89  std::size_t chunk_deque_size,
90  const std::vector<pappso::TimsFrameRecord> &frame_record_list);
91 
92 
95 
97  const std::vector<pappso::TimsFrameRecord> &frame_record_list);
98 
99  private:
101  QString m_timsBinFile;
102  QFile *mp_fileLinear = nullptr;
103  QFile *mp_fileRandom = nullptr;
104  // QMutex m_mutex;
105  // std::vector<quint64> m_indexArray;
106  char *mpa_decompressMemoryBuffer = nullptr;
108 
110 
111 
112  std::vector<TimsFrameRawDataChunck> m_linearAccessRawDataChunckList;
113  std::size_t m_firstFrameId = 0;
114  std::size_t m_lastFrameId = 0;
116  std::size_t m_linearForwardThreshold = 30;
117 };
118 } // namespace pappso
QFile * mp_fileRandom
Definition: timsbindec.h:103
std::size_t m_firstFrameId
Definition: timsbindec.h:113
std::size_t m_decompressMemoryBufferSize
Definition: timsbindec.h:107
TimsFrameSPtr getTimsFrameSPtrByOffset(std::size_t frameId, const std::vector< pappso::TimsFrameRecord > &frame_record_list)
Definition: timsbindec.cpp:147
void startLinearRead(std::size_t start_frame_id, std::size_t chunk_deque_size, const std::vector< pappso::TimsFrameRecord > &frame_record_list)
populate a fifo buffer with TimsFrameRawDataChunck accelerates inputs from file
Definition: timsbindec.cpp:364
QFile * getQfileRandom()
open one QFile handler for random read
Definition: timsbindec.cpp:131
std::size_t m_linearForwardThreshold
Definition: timsbindec.h:116
void closeLinearRead()
close file access and flush cache
Definition: timsbindec.cpp:92
std::size_t m_lastFrameId
Definition: timsbindec.h:114
std::size_t m_linearAccessRawDataChunckDequeSize
Definition: timsbindec.h:115
QFile * getQfileLinear(std::size_t frameId, const std::vector< pappso::TimsFrameRecord > &frame_record_list)
open one QFile handler for linear read
Definition: timsbindec.cpp:109
QFile * mp_fileLinear
Definition: timsbindec.h:102
std::vector< TimsFrameRawDataChunck > m_linearAccessRawDataChunckList
Definition: timsbindec.h:112
void moveLinearReadForward(const std::vector< pappso::TimsFrameRecord > &frame_record_list)
Definition: timsbindec.cpp:231
TimsBinDec(const QFileInfo &timsBinFile, int timsCompressionType)
Definition: timsbindec.cpp:40
virtual ~TimsBinDec()
Definition: timsbindec.cpp:70
TimsFrameSPtr getTimsFrameFromRawDataChunck(const TimsFrameRawDataChunck &raw_data_chunck)
Definition: timsbindec.cpp:254
QString m_timsBinFile
Definition: timsbindec.h:101
TimsFrameRawDataChunck m_randemAccessFrameRawDataChunck
Definition: timsbindec.h:109
char * mpa_decompressMemoryBuffer
Definition: timsbindec.h:106
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
std::shared_ptr< TimsFrame > TimsFrameSPtr
Definition: timsframe.h:40
handle a single Bruker's TimsTof frame
stores raw binary tims frame
simple structure to store SQL lite frame records