Loading...
Searching...
No Matches
msfileaccessor.h
Go to the documentation of this file.
#pragma once
#include <QString>
#include <QMetaType>
#include "../types.h"
#include "../msrun/msrunreader.h"
#include "../msrun/msrunid.h"
#include "../exportinmportconfig.h"
#include "../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
*/
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
*/
FileReaderType getFileReaderType() const;
/** @brief given an mz format, explicitly set the preferred reader
*/
void setPreferredFileReaderType(MsDataFormat format,
FileReaderType reader_type);
FileReaderType getpreferredFileReaderType(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,
pappso::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;
MsDataFormat m_fileFormat = MsDataFormat::unknown;
// Type of the file reader that could load the file.
FileReaderType m_fileReaderType;
std::map<MsDataFormat, 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
Definition msfileaccessor.h:28
pappso::MsFileAccessor::m_preferredFileReaderTypeMap
std::map< MsDataFormat, FileReaderType > m_preferredFileReaderTypeMap
Definition msfileaccessor.h:120
pappso::MsFileAccessor::m_xmlPrefix
const QString m_xmlPrefix
Definition msfileaccessor.h:113
pappso::MsFileAccessor::m_fileName
QString m_fileName
Definition msfileaccessor.h:109
pappso::MsFileAccessor::m_oboPsiModTermNativeIDFormat
OboPsiModTerm m_oboPsiModTermNativeIDFormat
Definition msfileaccessor.h:124
pappso::MsFileAccessor::m_fileReaderType
FileReaderType m_fileReaderType
Definition msfileaccessor.h:118
pappso::OboPsiModTerm
Definition obopsimodterm.h:32
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition exportinmportconfig.h:14
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::MsDataFormat
MsDataFormat
Definition types.h:120
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::FileReaderType
FileReaderType
Definition types.h:147
pappso::MsFileAccessorSPtr
std::shared_ptr< MsFileAccessor > MsFileAccessorSPtr
Definition msfileaccessor.h:127