Loading...
Searching...
No Matches
pappso::MsRunXicExtractorDiskBuffer Class Reference

`#include <msrunxicextractordiskbuffer.h>`

Inheritance diagram for pappso::MsRunXicExtractorDiskBuffer:

## Public Member Functions

| MsRunXicExtractorDiskBuffer (const MsRunXicExtractorDiskBuffer &other)
virtual | ~MsRunXicExtractorDiskBuffer ()
Public Member Functions inherited from pappso::MsRunXicExtractorDisk
| MsRunXicExtractorDisk (MsRunReaderSPtr &msrun_reader)
| MsRunXicExtractorDisk (const MsRunXicExtractorDisk &other)
virtual | ~MsRunXicExtractorDisk ()
Public Member Functions inherited from pappso::MsRunXicExtractor
| MsRunXicExtractor (const MsRunXicExtractor &other)
virtual | ~MsRunXicExtractor ()
Public Member Functions inherited from pappso::MsRunXicExtractorInterface
void | setXicExtractMethod (XicExtractMethod method)
| set the XIC extraction method
void | setRetentionTimeAroundTarget (double range_in_seconds)
| set the retention time range in seconds around the target rt
virtual void | extractXicCoordSPtrList (UiMonitorInterface &monitor, std::vector< XicCoordSPtr > &xic_coord_list) final
| extract a list of XIC given a list of xic coordinates to extract
virtual void | extractXicCoordSPtrListParallelized (UiMonitorInterface &monitor, std::vector< XicCoordSPtr > &xic_coord_list) final
| multithreaded XIC extraction
const MsRunIdCstSPtr & | getMsRunId () const
const MsRunReaderSPtr & | getMsRunReaderSPtr () const
| get the msrunreader currently used for XIC extraction
void | setPostExtractionTraceFilterCstSPtr (pappso::FilterInterfaceCstSPtr &filter)
| filter interface to apply just after XIC extration on each trace

## Protected Member Functions

| MsRunXicExtractorDiskBuffer (MsRunReaderSPtr &msrun_reader, const QDir &temporary_dir)
virtual void | storeSlices (std::map< unsigned int, MassSpectrum > &slice_vector, std::size_t ipos) override
| store MassSpectrum slices (by daltons) for a given retention time
void | appendSliceInBuffer (unsigned int slice_number, MassSpectrum &spectrum, std::size_t ipos)
void | flushBufferOnDisk ()
virtual void | endPwizRead () override
Protected Member Functions inherited from pappso::MsRunXicExtractorDisk
| MsRunXicExtractorDisk (MsRunReaderSPtr &msrun_reader, const QDir &temporary_dir)
virtual void | protectedExtractXicCoordSPtrList (UiMonitorInterface &monitor, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end) override
void | prepareExtractor ()
void | serializeMsRun ()
void | appendSliceOnDisk (unsigned int slice_number, MassSpectrum &spectrum, std::size_t ipos)
| append a slice on disk (in a file)
std::vector< MsRunSliceSPtr > | acquireSlices (const MzRange &mz_range)
| retrieve all the slices corresponding to a given mz_range
MsRunSliceSPtr | unserializeSlice (unsigned int slice_number)
| get one slice from disk by her slice number (dalton)
Protected Member Functions inherited from pappso::MsRunXicExtractor
| MsRunXicExtractor (MsRunReaderSPtr &msrun_reader)
virtual void | getXicFromPwizMSDataFile (std::vector< Xic * > &xic_list, const std::vector< MzRange > &mass_range_list, pappso::pappso_double rt_begin, pappso::pappso_double rt_end)
Protected Member Functions inherited from pappso::MsRunXicExtractorInterface
| MsRunXicExtractorInterface (MsRunReaderSPtr &msrun_reader)
| constructor is private, use the MsRunXicExtractorFactory
| MsRunXicExtractorInterface (const MsRunXicExtractorInterface &other)
virtual | ~MsRunXicExtractorInterface ()
virtual void | postExtractionProcess (UiMonitorInterface &monitor, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end)
| possible post extraction process, eventually trace filters

## Protected Attributes

std::map< unsigned int, QByteArray > | m_sliceBufferMap
std::size_t | m_bufferSize = 0
std::size_t | m_bufferMaxSize = 150
Protected Attributes inherited from pappso::MsRunXicExtractorDisk
QString | m_temporaryDirectory
QTemporaryDir * | mpa_temporaryDirectory = nullptr
std::vector< pappso::pappso_double > | m_retentionTimeList
pappso::pappso_double | m_maxMz = 0
pappso::pappso_double | m_minMz = 5000
std::size_t | m_rtSize = 0
std::deque< MsRunSliceSPtr > | m_msRunSliceListCache
QMutex | m_mutex
Protected Attributes inherited from pappso::MsRunXicExtractor
std::vector< MsRunXicExtractorPoints > | m_msrun_points
Protected Attributes inherited from pappso::MsRunXicExtractorInterface
MsRunReaderSPtr | msp_msrun_reader
XicExtractMethod | m_xicExtractMethod = XicExtractMethod::max
double | m_retentionTimeAroundTarget = std::numeric_limits<double>::max()
pappso::FilterInterfaceCstSPtr | mcsp_postExtractionTraceFilter = nullptr

## Private Attributes

friend | MsRunXicExtractorFactory

## Detailed Description

Definition at line 43 of file msrunxicextractordiskbuffer.h.

## Constructor & Destructor Documentation

## MsRunXicExtractorDiskBuffer() [1/2]

pappso::MsRunXicExtractorDiskBuffer::MsRunXicExtractorDiskBuffer | ( | const MsRunXicExtractorDiskBuffer & | other | ) |

Definition at line 48 of file msrunxicextractordiskbuffer.cpp.

: MsRunXicExtractorDisk(other)
{
m_sliceBufferMap.clear();
}
pappso::MsRunXicExtractorDiskBuffer::m_sliceBufferMap
std::map< unsigned int, QByteArray > m_sliceBufferMap
Definition msrunxicextractordiskbuffer.h:66
pappso::MsRunXicExtractorDisk::MsRunXicExtractorDisk
MsRunXicExtractorDisk(MsRunReaderSPtr &msrun_reader)

References m_sliceBufferMap.

## ~MsRunXicExtractorDiskBuffer()

pappso::MsRunXicExtractorDiskBuffer::~MsRunXicExtractorDiskBuffer | ( |  | ) |

virtual

Definition at line 56 of file msrunxicextractordiskbuffer.cpp.

{
}

## MsRunXicExtractorDiskBuffer() [2/2]

pappso::MsRunXicExtractorDiskBuffer::MsRunXicExtractorDiskBuffer | ( | MsRunReaderSPtr & | msrun_reader,
|  | const QDir & | temporary_dir
| ) |  |

protected

Definition at line 40 of file msrunxicextractordiskbuffer.cpp.

: MsRunXicExtractorDisk(msrun_reader, temporary_dir)
{
m_sliceBufferMap.clear();
}

References m_sliceBufferMap.

## Member Function Documentation

## appendSliceInBuffer()

void pappso::MsRunXicExtractorDiskBuffer::appendSliceInBuffer | ( | unsigned int | slice_number,
|  | MassSpectrum & | spectrum,
|  | std::size_t | ipos
| ) |  |

protected

Definition at line 78 of file msrunxicextractordiskbuffer.cpp.

{
qDebug();
std::size_t spectrum_size = spectrum.size();
if(spectrum_size == 0)
return;
try
{
std::pair<std::map<unsigned int, QByteArray>::iterator, bool> ret =
m_sliceBufferMap.insert(
std::pair<unsigned int, QByteArray>(slice_number, QByteArray()));
if(ret.second)
{ // new buffer
ret.first->second.resize(0);
QDataStream outstream(&ret.first->second, QIODevice::WriteOnly);
outstream << (quint32)ipos;
outstream << spectrum;
}
else
{
QDataStream outstream(&ret.first->second,
QIODevice::WriteOnly | QIODevice::Append);
outstream << (quint32)ipos;
outstream << spectrum;
}
}
catch(PappsoException &error_pappso)
{
throw pappso::PappsoException(
QObject::tr("appendSliceInBuffer : error ipos=%1 :\n%2")
.arg(ipos)
.arg(error_pappso.qwhat()));
}
catch(std::exception &error)
{
throw pappso::PappsoException(
QObject::tr("appendSliceInBuffer slice_number=%1 ipos=%2 error :\n%3")
.arg(slice_number)
.arg(ipos)
.arg(error.what()));
}
qDebug();
}
pappso::PappsoException
Definition pappsoexception.h:42

References m_sliceBufferMap, and pappso::PappsoException::qwhat().

Referenced by storeSlices().

## endPwizRead()

void pappso::MsRunXicExtractorDiskBuffer::endPwizRead | ( |  | ) |

override protected virtual

Reimplemented from pappso::MsRunXicExtractorDisk.

Definition at line 206 of file msrunxicextractordiskbuffer.cpp.

{
flushBufferOnDisk();
m_sliceBufferMap.clear();
msp_msrun_reader.get()->releaseDevice();
}
pappso::MsRunXicExtractorDiskBuffer::flushBufferOnDisk
void flushBufferOnDisk()
Definition msrunxicextractordiskbuffer.cpp:130
pappso::MsRunXicExtractorInterface::msp_msrun_reader
MsRunReaderSPtr msp_msrun_reader
Definition msrunxicextractorinterface.h:126

References flushBufferOnDisk(), m_sliceBufferMap, and pappso::MsRunXicExtractorInterface::msp_msrun_reader.

## flushBufferOnDisk()

void pappso::MsRunXicExtractorDiskBuffer::flushBufferOnDisk | ( |  | ) |

protected

Definition at line 130 of file msrunxicextractordiskbuffer.cpp.

{
qDebug();
try
{
for(auto &buffer_pair : m_sliceBufferMap)
{
if(buffer_pair.second.size() > 0)
{
QFile slice_file(QString("%1/%2")
.arg(mpa_temporaryDirectory->path())
.arg(buffer_pair.first));
bool new_file = false;
if(!slice_file.exists())
{
new_file = true;
if(!slice_file.open(QIODevice::WriteOnly))
{
throw pappso::PappsoException(
QObject::tr("unable to open file %1")
.arg(slice_file.fileName()));
}
}
else
{
if(!slice_file.open(QIODevice::WriteOnly | QIODevice::Append))
{
throw pappso::PappsoException(
QObject::tr("unable to open file %1")
.arg(slice_file.fileName()));
}
}
QDataStream stream(&slice_file);
if(new_file)
{
stream << (quint32)buffer_pair.first;
stream << (quint32)m_rtSize;
stream.writeRawData(buffer_pair.second.constData(),
buffer_pair.second.size());
}
else
{
stream.writeRawData(buffer_pair.second.constData(),
buffer_pair.second.size());
}
slice_file.flush();
slice_file.close();
}
// buffer_pair.second = std::vector<MassSpectrum>();
}
m_bufferSize = 0;
m_sliceBufferMap.clear();
}
catch(PappsoException &error_pappso)
{
throw pappso::PappsoException(
QObject::tr("flushBufferOnDisk error :\n%1").arg(error_pappso.qwhat()));
}
catch(std::exception &error)
{
throw pappso::PappsoException(
QObject::tr("flushBufferOnDisk error :\n%1").arg(error.what()));
}
qDebug();
}
pappso::MsRunXicExtractorDiskBuffer::m_bufferSize
std::size_t m_bufferSize
Definition msrunxicextractordiskbuffer.h:68
pappso::MsRunXicExtractorDisk::m_rtSize
std::size_t m_rtSize
Definition msrunxicextractordisk.h:106
pappso::MsRunXicExtractorDisk::mpa_temporaryDirectory
QTemporaryDir * mpa_temporaryDirectory
Definition msrunxicextractordisk.h:100

References m_bufferSize, pappso::MsRunXicExtractorDisk::m_rtSize, m_sliceBufferMap, pappso::MsRunXicExtractorDisk::mpa_temporaryDirectory, and pappso::PappsoException::qwhat().

Referenced by endPwizRead(), and storeSlices().

## storeSlices()

void pappso::MsRunXicExtractorDiskBuffer::storeSlices | ( | std::map< unsigned int, MassSpectrum > & | slice_vector,
|  | std::size_t | ipos
| ) |  |

override protected virtual

store MassSpectrum slices (by daltons) for a given retention time

Parameters

  slice_vector | mass spectrum chunks (by daltons)
  ipos | the position in the retention time vector

Reimplemented from pappso::MsRunXicExtractorDisk.

Definition at line 61 of file msrunxicextractordiskbuffer.cpp.

{
m_bufferSize++;
for(auto &&msrun_slice : slice_vector)
{
appendSliceInBuffer(msrun_slice.first, msrun_slice.second, ipos);
}
if(m_bufferSize == m_bufferMaxSize)
{
flushBufferOnDisk();
}
}
pappso::MsRunXicExtractorDiskBuffer::m_bufferMaxSize
std::size_t m_bufferMaxSize
Definition msrunxicextractordiskbuffer.h:69
pappso::MsRunXicExtractorDiskBuffer::appendSliceInBuffer
void appendSliceInBuffer(unsigned int slice_number, MassSpectrum &spectrum, std::size_t ipos)
Definition msrunxicextractordiskbuffer.cpp:78

References appendSliceInBuffer(), flushBufferOnDisk(), m_bufferMaxSize, and m_bufferSize.

## Member Data Documentation

## m_bufferMaxSize

std::size_t pappso::MsRunXicExtractorDiskBuffer::m_bufferMaxSize = 150

protected

Definition at line 69 of file msrunxicextractordiskbuffer.h.

Referenced by storeSlices().

## m_bufferSize

std::size_t pappso::MsRunXicExtractorDiskBuffer::m_bufferSize = 0

protected

Definition at line 68 of file msrunxicextractordiskbuffer.h.

Referenced by flushBufferOnDisk(), and storeSlices().

## m_sliceBufferMap

std::map<unsigned int, QByteArray> pappso::MsRunXicExtractorDiskBuffer::m_sliceBufferMap

protected

Definition at line 66 of file msrunxicextractordiskbuffer.h.

Referenced by MsRunXicExtractorDiskBuffer(), MsRunXicExtractorDiskBuffer(), appendSliceInBuffer(), endPwizRead(), and flushBufferOnDisk().

## MsRunXicExtractorFactory

friend pappso::MsRunXicExtractorDiskBuffer::MsRunXicExtractorFactory

private

Definition at line 45 of file msrunxicextractordiskbuffer.h.

The documentation for this class was generated from the following files:

- pappsomspp/xicextractor/private/msrunxicextractordiskbuffer.h
- pappsomspp/xicextractor/private/msrunxicextractordiskbuffer.cpp