29 #include "../../../pappsomspp/pappsoexception.h"
30 #include "../../../pappsomspp/exception/exceptionnotimplemented.h"
32 #include <QDataStream>
38 : m_timsBinFile(timsBinFile.absoluteFilePath())
41 if((timsCompressionType != 1) && (timsCompressionType != 2))
44 QObject::tr(
"compression type %1 not handled by this library")
45 .arg(timsCompressionType));
50 QObject::tr(
"No TIMS binary file name specified"));
53 if(!file.open(QIODevice::ReadOnly))
56 QObject::tr(
"ERROR opening TIMS binary file %1 for read")
57 .arg(timsBinFile.absoluteFilePath()));
63 : m_timsBinFile(other.m_timsBinFile)
89 QDataStream bin_in(&file);
90 bin_in.setByteOrder(QDataStream::ByteOrder::LittleEndian);
98 while(!bin_in.atEnd())
100 while((!bin_in.atEnd()) && (position % 4 != 0))
114 quint32 frame_len(0);
115 while((!bin_in.atEnd()) && (frame_len == 0))
137 qDebug() <<
" number_in(nb scans)=" << number_in
138 <<
" position=" << position;
157 qDebug() <<
"timsId:" << timsId <<
"timsOffset:" << timsOffset;
161 if(!file.open(QIODevice::ReadOnly))
164 QObject::tr(
"ERROR opening TIMS binary file %1 for read")
168 bool seekpos_ok = file.seek(timsOffset);
172 QObject::tr(
"ERROR reading TIMS frame %1 TIMS binary file %2: "
173 "m_timsBinFile.seek(%3) failed")
180 quint32 frame_length;
181 file.read((
char *)&frame_length, 4);
189 file.read((
char *)&scan_number, 4);
206 qDebug() <<
"mpa_memoryBuffer == nullptr";
236 if(read_length - 2 != (qint64)frame_length)
239 QObject::tr(
"ERROR reading TIMS frame %1 TIMS binary file %2: "
240 "read_length=%3 != %4frame_length")
253 auto decompressed_size2 =
256 if(decompressed_size2 == ZSTD_CONTENTSIZE_UNKNOWN)
259 QObject::tr(
"ERROR reading TIMS frame %1 TIMS binary file %2: "
260 " decompressed_size2 == ZSTD_CONTENTSIZE_UNKNOWN, "
267 if(decompressed_size2 == ZSTD_CONTENTSIZE_ERROR)
271 QObject::tr(
"ERROR reading TIMS frame %1 TIMS binary file %2: "
272 " decompressed_size2 == ZSTD_CONTENTSIZE_ERROR, "
278 qDebug() <<
" decompressed_size2=" << decompressed_size2;
290 std::size_t decompressed_size =
297 if(decompressed_size != decompressed_size2)
300 QObject::tr(
"ERROR reading TIMS frame %1 TIMS binary file %2: "
301 "decompressed_size != decompressed_size2")
304 .arg(decompressed_size)
305 .arg(decompressed_size2));
310 frame_sptr = std::make_shared<TimsFrame>(
318 frame_sptr = std::make_shared<TimsFrameType1>(
326 frame_sptr = std::make_shared<TimsFrame>(timsId, scan_number,
nullptr, 0);
std::size_t m_decompressMemoryBufferSize
int m_timsCompressionType
TimsBinDec(const QFileInfo &timsBinFile, int timsCompressionType)
qint64 m_memoryBufferSize
char * mpa_decompressMemoryBuffer
TimsFrameSPtr getTimsFrameSPtrByOffset(std::size_t timsId, std::size_t timsOffset)
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< TimsFrame > TimsFrameSPtr
binary file handler of Bruker's TimsTof raw data
handle a single Bruker's TimsTof frame type 1 compression