Loading...
Searching...
No Matches
msfileaccessor.h
Go to the documentation of this file.
#pragma once
#include <QString>
#include <QMetaType>
#include "pappsomspp/core/types.h"
#include "pappsomspp/core/msrun/msrunreader.h"
#include "pappsomspp/core/msrun/msrunid.h"
#include "pappsomspp/export-import-config.h"
#include "pappsomspp/core/obo/obopsimodterm.h"
namespace pappso
{
class TimsMsRunReaderMs2;
typedef std::shared_ptr<TimsMsRunReaderMs2> TimsMsRunReaderMs2SPtr;
// This class is used to access mass spectrometry data files. The file being
// opened and read might contain more than one MS run. The user of this class
// might request a vector of all these MS runs (in the form of a vector of
// MsRunIdCstSPtr. Once the MsRunIdCstSPtr of interest has been located by the
// caller, the caller might then request the MsRunReaderSPtr to use to read that
// MS run's data.
class PMSPP_LIB_DECL MsFileAccessor
{
public:
MsFileAccessor(const QString &file_name, const QString &xml_prefix);
MsFileAccessor(const MsFileAccessor &other);
virtual ~MsFileAccessor();
const QString &getFileName() const;
/** @brief get the raw format of mz data
*/
Enums::MsDataFormat getFileFormat() const;
/** @brief get OboPsiModTerm corresponding to the raw format of mz data
*/
const OboPsiModTerm getOboPsiModTermFileFormat() const;
/** @brief get OboPsiModTerm corresponding to the nativeID format format of mz
* data
*/
const OboPsiModTerm &getOboPsiModTermNativeIDFormat() const;
/** @brief get the file reader type
*/
Enums::FileReaderType getFileReaderType() const;
/** @brief given an mz format, explicitly set the preferred reader
*/
void setPreferredFileReaderType(Enums::MsDataFormat format,
Enums::FileReaderType reader_type);
Enums::FileReaderType getpreferredFileReaderType(Enums::MsDataFormat format);
std::vector<MsRunIdCstSPtr> getMsRunIds();
void setSelectedMsRunId(MsRunIdCstSPtr ms_run_id_csp);
MsRunIdCstSPtr getSelectedMsRunId() const;
MsRunReaderSPtr msRunReaderSPtr(MsRunIdCstSPtr ms_run_id);
MsRunReaderSPtr msRunReaderSPtr(std::size_t ms_run_id_index);
MsRunReaderSPtr msRunReaderSPtrForSelectedMsRunId();
/** @brief get an msrun reader by finding the run_id in file
*
* @param run_id identifier within file of the MSrun
* @param xml_id XML identifier given by the user to identify this MSrun in
* our experiment (not in the file)
*/
MsRunReaderSPtr getMsRunReaderSPtrByRunId(const QString &run_id,
const QString &xml_id);
/** @brief get an MsRunReader directly from a valid MsRun ID
*
* no need to check the file format or filename : all is already part of the
* msrunid
*
* @param ms_run_id msrun identifier
* @return msrun reader shared pointer
*/
static MsRunReaderSPtr buildMsRunReaderSPtr(MsRunIdCstSPtr ms_run_id);
/** @brief get an MsRunReader directly from a valid MsRun ID
*
* no need to check the file format or filename : all is already part of the
* msrunid
*
* @param ms_run_id msrun identifier
* @param preferred_file_reader_type the preferred file reader type to use
* (depending on the mz format)
* @return msrun reader shared pointer
*/
static MsRunReaderSPtr
buildMsRunReaderSPtr(MsRunIdCstSPtr ms_run_id,
Enums::FileReaderType preferred_file_reader_type);
/** @brief if possible, builds directly a dedicated Tims TOF tdf file reader
*/
TimsMsRunReaderMs2SPtr buildTimsMsRunReaderMs2SPtr();
private:
QString m_fileName;
// When opening more than one file concurrently in a determinate session, we
// need this prefix to craft unabiguous ms run ids.
const QString m_xmlPrefix;
Enums::MsDataFormat m_fileFormat = Enums::MsDataFormat::unknown;
// Type of the file reader that could load the file.
Enums::FileReaderType m_fileReaderType;
std::map<Enums::MsDataFormat, Enums::FileReaderType> m_preferredFileReaderTypeMap;
MsRunIdCstSPtr mcsp_selectedMsRunId = nullptr;
OboPsiModTerm m_oboPsiModTermNativeIDFormat;
};
typedef std::shared_ptr<MsFileAccessor> MsFileAccessorSPtr;
typedef std::shared_ptr<const MsFileAccessor> MsFileAccessorCstSPtr;
} // namespace pappso
pappso::MsFileAccessor::getOboPsiModTermNativeIDFormat
const OboPsiModTerm & getOboPsiModTermNativeIDFormat() const
get OboPsiModTerm corresponding to the nativeID format format of mz data
Definition msfileaccessor.cpp:189
pappso::MsFileAccessor::getSelectedMsRunId
MsRunIdCstSPtr getSelectedMsRunId() const
Definition msfileaccessor.cpp:385
pappso::MsFileAccessor::msRunReaderSPtr
MsRunReaderSPtr msRunReaderSPtr(MsRunIdCstSPtr ms_run_id)
Definition msfileaccessor.cpp:422
pappso::MsFileAccessor::m_xmlPrefix
const QString m_xmlPrefix
Definition msfileaccessor.h:113
pappso::MsFileAccessor::m_fileReaderType
Enums::FileReaderType m_fileReaderType
Definition msfileaccessor.h:118
pappso::MsFileAccessor::m_fileFormat
Enums::MsDataFormat m_fileFormat
Definition msfileaccessor.h:115
pappso::MsFileAccessor::setPreferredFileReaderType
void setPreferredFileReaderType(Enums::MsDataFormat format, Enums::FileReaderType reader_type)
given an mz format, explicitly set the preferred reader
Definition msfileaccessor.cpp:342
pappso::MsFileAccessor::getFileFormat
Enums::MsDataFormat getFileFormat() const
get the raw format of mz data
Definition msfileaccessor.cpp:70
pappso::MsFileAccessor::getFileReaderType
Enums::FileReaderType getFileReaderType() const
get the file reader type
Definition msfileaccessor.cpp:373
pappso::MsFileAccessor::msRunReaderSPtrForSelectedMsRunId
MsRunReaderSPtr msRunReaderSPtrForSelectedMsRunId()
Definition msfileaccessor.cpp:527
pappso::MsFileAccessor::m_fileName
QString m_fileName
Definition msfileaccessor.h:109
pappso::MsFileAccessor::mcsp_selectedMsRunId
MsRunIdCstSPtr mcsp_selectedMsRunId
Definition msfileaccessor.h:122
pappso::MsFileAccessor::getMsRunIds
std::vector< MsRunIdCstSPtr > getMsRunIds()
Definition msfileaccessor.cpp:197
pappso::MsFileAccessor::m_oboPsiModTermNativeIDFormat
OboPsiModTerm m_oboPsiModTermNativeIDFormat
Definition msfileaccessor.h:124
pappso::MsFileAccessor::setSelectedMsRunId
void setSelectedMsRunId(MsRunIdCstSPtr ms_run_id_csp)
Definition msfileaccessor.cpp:379
pappso::MsFileAccessor::getOboPsiModTermFileFormat
const OboPsiModTerm getOboPsiModTermFileFormat() const
get OboPsiModTerm corresponding to the raw format of mz data
Definition msfileaccessor.cpp:76
pappso::MsFileAccessor::getMsRunReaderSPtrByRunId
MsRunReaderSPtr getMsRunReaderSPtrByRunId(const QString &run_id, const QString &xml_id)
get an msrun reader by finding the run_id in file
Definition msfileaccessor.cpp:602
pappso::MsFileAccessor::getpreferredFileReaderType
Enums::FileReaderType getpreferredFileReaderType(Enums::MsDataFormat format)
Definition msfileaccessor.cpp:358
pappso::MsFileAccessor::MsFileAccessor
MsFileAccessor(const QString &file_name, const QString &xml_prefix)
Definition msfileaccessor.cpp:33
pappso::MsFileAccessor::buildMsRunReaderSPtr
static MsRunReaderSPtr buildMsRunReaderSPtr(MsRunIdCstSPtr ms_run_id)
get an MsRunReader directly from a valid MsRun ID
Definition msfileaccessor.cpp:535
pappso::MsFileAccessor::m_preferredFileReaderTypeMap
std::map< Enums::MsDataFormat, Enums::FileReaderType > m_preferredFileReaderTypeMap
Definition msfileaccessor.h:120
pappso::MsFileAccessor::buildTimsMsRunReaderMs2SPtr
TimsMsRunReaderMs2SPtr buildTimsMsRunReaderMs2SPtr()
if possible, builds directly a dedicated Tims TOF tdf file reader
Definition msfileaccessor.cpp:391
pappso::MsFileAccessor::getFileName
const QString & getFileName() const
Definition msfileaccessor.cpp:64
pappso::OboPsiModTerm
Definition obopsimodterm.h:34
pappso::TimsMsRunReaderMs2
Definition timsmsrunreaderms2.h:39
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
msrunid.h
msrunreader.h
pappso::Enums::MsDataFormat
MsDataFormat
Definition types.h:148
pappso::Enums::MsDataFormat::unknown
@ unknown
unknown format
Definition types.h:149
pappso::Enums::FileReaderType
FileReaderType
Definition types.h:176
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:57
pappso::TimsMsRunReaderMs2SPtr
std::shared_ptr< TimsMsRunReaderMs2 > TimsMsRunReaderMs2SPtr
Definition msfileaccessor.h:19
pappso::MsRunIdCstSPtr
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46
pappso::MsFileAccessorCstSPtr
std::shared_ptr< const MsFileAccessor > MsFileAccessorCstSPtr
Definition msfileaccessor.h:128
pappso::MsFileAccessorSPtr
std::shared_ptr< MsFileAccessor > MsFileAccessorSPtr
Definition msfileaccessor.h:127
obopsimodterm.h
types.h