Loading...
Searching...
No Matches
msrunxicextractordisk.h
Go to the documentation of this file.
/**
* \file pappsomspp/xicextractor/private/msrunxicextractordisk.h
* \date 12/05/2018
* \author Olivier Langella
* \brief MsRunReader based XIC extractor featuring disk cache
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include "msrunxicextractor.h"
#include "msrunslice.h"
#include <QTemporaryDir>
#include <deque>
#include <QMutex>
class MsRunXicExtractorFactory;
namespace pappso
{
class MsRunXicExtractorDisk : public MsRunXicExtractor
{
friend MsRunXicExtractorFactory;
public:
MsRunXicExtractorDisk(MsRunReaderSPtr &msrun_reader);
MsRunXicExtractorDisk(const MsRunXicExtractorDisk &other);
virtual ~MsRunXicExtractorDisk();
protected:
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();
/** @brief store MassSpectrum slices (by daltons) for a given retention time
* @param slice_vector mass spectrum chunks (by daltons)
* @param ipos the position in the retention time vector
*/
virtual void storeSlices(std::map<unsigned int, MassSpectrum> &slice_vector,
std::size_t ipos);
/** @brief append a slice on disk (in a file)
* @param slice_number the slice number == dalton integer
* @param spectrum the part of the mass spectrum (mz/intensity) in the range
* of the slice number
* @param ipos the position in the retention time vector
*/
void appendSliceOnDisk(unsigned int slice_number,
MassSpectrum &spectrum,
std::size_t ipos);
/** @brief retrieve all the slices corresponding to a given mz_range
* @param mz_range desired mz range
*/
std::vector<MsRunSliceSPtr> acquireSlices(const MzRange &mz_range);
/** @brief get one slice from disk by her slice number (dalton)
* @param slice_number the slice number == dalton integer
*/
MsRunSliceSPtr unserializeSlice(unsigned int slice_number);
virtual void endPwizRead();
protected:
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;
private:
void extractOneXicCoord(XicCoord &xic_coord);
};
} // namespace pappso
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition massspectrum.h:73
pappso::MsRunXicExtractorDisk
Definition msrunxicextractordisk.h:45
pappso::MsRunXicExtractorDisk::endPwizRead
virtual void endPwizRead()
Definition msrunxicextractordisk.cpp:360
pappso::MsRunXicExtractorDisk::acquireSlices
std::vector< MsRunSliceSPtr > acquireSlices(const MzRange &mz_range)
retrieve all the slices corresponding to a given mz_range
Definition msrunxicextractordisk.cpp:327
pappso::MsRunXicExtractorDisk::prepareExtractor
void prepareExtractor()
Definition msrunxicextractordisk.cpp:67
pappso::MsRunXicExtractorDisk::m_retentionTimeList
std::vector< pappso::pappso_double > m_retentionTimeList
Definition msrunxicextractordisk.h:101
pappso::MsRunXicExtractorDisk::~MsRunXicExtractorDisk
virtual ~MsRunXicExtractorDisk()
Definition msrunxicextractordisk.cpp:58
pappso::MsRunXicExtractorDisk::MsRunXicExtractorFactory
friend MsRunXicExtractorFactory
Definition msrunxicextractordisk.h:46
pappso::MsRunXicExtractorDisk::MsRunXicExtractorDisk
MsRunXicExtractorDisk(MsRunReaderSPtr &msrun_reader)
pappso::MsRunXicExtractorDisk::m_msRunSliceListCache
std::deque< MsRunSliceSPtr > m_msRunSliceListCache
Definition msrunxicextractordisk.h:108
pappso::MsRunXicExtractorDisk::serializeMsRun
void serializeMsRun()
Definition msrunxicextractordisk.cpp:167
pappso::MsRunXicExtractorDisk::storeSlices
virtual void storeSlices(std::map< unsigned int, MassSpectrum > &slice_vector, std::size_t ipos)
store MassSpectrum slices (by daltons) for a given retention time
Definition msrunxicextractordisk.cpp:238
pappso::MsRunXicExtractorDisk::m_maxMz
pappso::pappso_double m_maxMz
Definition msrunxicextractordisk.h:103
pappso::MsRunXicExtractorDisk::m_rtSize
std::size_t m_rtSize
Definition msrunxicextractordisk.h:106
pappso::MsRunXicExtractorDisk::extractOneXicCoord
void extractOneXicCoord(XicCoord &xic_coord)
Definition msrunxicextractordisk.cpp:115
pappso::MsRunXicExtractorDisk::m_minMz
pappso::pappso_double m_minMz
Definition msrunxicextractordisk.h:104
pappso::MsRunXicExtractorDisk::appendSliceOnDisk
void appendSliceOnDisk(unsigned int slice_number, MassSpectrum &spectrum, std::size_t ipos)
append a slice on disk (in a file)
Definition msrunxicextractordisk.cpp:252
pappso::MsRunXicExtractorDisk::protectedExtractXicCoordSPtrList
virtual void protectedExtractXicCoordSPtrList(UiMonitorInterface &monitor, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end) override
Definition msrunxicextractordisk.cpp:95
pappso::MsRunXicExtractorDisk::mpa_temporaryDirectory
QTemporaryDir * mpa_temporaryDirectory
Definition msrunxicextractordisk.h:100
pappso::MsRunXicExtractorDisk::m_mutex
QMutex m_mutex
Definition msrunxicextractordisk.h:110
pappso::MsRunXicExtractorDisk::unserializeSlice
MsRunSliceSPtr unserializeSlice(unsigned int slice_number)
get one slice from disk by her slice number (dalton)
Definition msrunxicextractordisk.cpp:286
pappso::MsRunXicExtractorDisk::m_temporaryDirectory
QString m_temporaryDirectory
Definition msrunxicextractordisk.h:99
pappso::MsRunXicExtractor
Definition msrunxicextractor.h:42
pappso::MzRange
Definition mzrange.h:46
pappso::UiMonitorInterface
Definition uimonitorinterface.h:50
msrunslice.h
one mz slice (1 dalton) of an MsRun
msrunxicextractor.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::MsRunReaderSPtr
std::shared_ptr< MsRunReader > MsRunReaderSPtr
Definition msrunreader.h:56
pappso::MsRunSliceSPtr
std::shared_ptr< const MsRunSlice > MsRunSliceSPtr
Definition msrunslice.h:40
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:50
pappso::XicCoord
coordinates of the XIC to extract and the resulting XIC after extraction
Definition xiccoord.h:67