libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::MzcborMsFileReader Class Reference

#include <mzcbormsfilereader.h>

Inheritance diagram for pappso::MzcborMsFileReader:
pappso::MsFileReader

Public Member Functions

 MzcborMsFileReader (const QString &file_name)
 
virtual ~MzcborMsFileReader ()
 
virtual Enums::MsDataFormat getFileFormat () override
 
virtual std::vector< MsRunIdCstSPtrgetMsRunIds (const QString &run_prefix) override
 

Private Member Functions

virtual std::size_t initialize ()
 
- Private Member Functions inherited from pappso::MsFileReader
 MsFileReader (const QString &file_name)
 
virtual ~MsFileReader ()
 

Private Attributes

std::vector< pwiz::msdata::MSDataPtr > m_msDataPtrVector
 
pappso::cbor::mzcbor::MzcborReaderBase m_mzcborReaderBase
 
pappso::cbor::mzcbor::MzcborIndexReader m_mzcborIndexReader
 
- Private Attributes inherited from pappso::MsFileReader
QString m_fileName
 
Enums::MsDataFormat m_fileFormat = Enums::MsDataFormat::unknown
 

Detailed Description

Todo:
write docs

Definition at line 21 of file mzcbormsfilereader.h.

Constructor & Destructor Documentation

◆ MzcborMsFileReader()

pappso::MzcborMsFileReader::MzcborMsFileReader ( const QString &  file_name)

Definition at line 10 of file mzcbormsfilereader.cpp.

10 : MsFileReader{file_name}
11{
13 initialize();
14}
MsFileReader(const QString &file_name)
Enums::MsDataFormat m_fileFormat
virtual std::size_t initialize()

References initialize(), pappso::MsFileReader::m_fileFormat, and pappso::Enums::unknown.

◆ ~MzcborMsFileReader()

pappso::MzcborMsFileReader::~MzcborMsFileReader ( )
virtual

Definition at line 17 of file mzcbormsfilereader.cpp.

18{
19}

Member Function Documentation

◆ getFileFormat()

Enums::MsDataFormat pappso::MzcborMsFileReader::getFileFormat ( )
overridevirtual

Implements pappso::MsFileReader.

Definition at line 23 of file mzcbormsfilereader.cpp.

24{
25 // std::cout << __FILE__ << " @ " << __LINE__ << " " << __FUNCTION__ << " () "
26 // << std::setprecision(15) << "m_fileFormat: " << (int)m_fileFormat
27 // << std::endl;
28
29 return m_fileFormat;
30}

References pappso::MsFileReader::m_fileFormat.

Referenced by pappso::MsFileAccessor::getMsRunIds().

◆ getMsRunIds()

std::vector< MsRunIdCstSPtr > pappso::MzcborMsFileReader::getMsRunIds ( const QString &  run_prefix)
overridevirtual

Implements pappso::MsFileReader.

Definition at line 79 of file mzcbormsfilereader.cpp.

80{
81 std::vector<MsRunIdCstSPtr> ms_run_ids;
82
83
85 {
86
87 if(m_mzcborIndexReader.getRunIdList().size() > 0)
88 {
89 qDebug();
90 std::size_t iter = 0;
91 for(auto &msrun_id_str : m_mzcborIndexReader.getRunIdList())
92 {
93 MsRunId ms_run_id(m_fileName, msrun_id_str);
94
95
96 // Set the MS data format as determined in initialize().
97 ms_run_id.setMsDataFormat(m_fileFormat);
98
99 // We need to set the unambiguous xmlId string.
100 ms_run_id.setXmlId(
101 QString("%1%2").arg(run_prefix).arg(Utils::getLexicalOrderedString(iter)));
102
103 // Now set the sample name to the run id : we can not do that, this is not the use
104 // sample name ms_run_id.setSampleName(QString::fromStdString(ms_data_ptr->run.id));
105
106 // And if it is possible, the real sample name because this one is for the
107 // end user to recognize his sample:
108 ms_run_id.setSampleName(msrun_id_str);
109
110
111 ms_run_ids.push_back(std::make_shared<MsRunId>(ms_run_id));
112 iter++;
113 }
114 }
115 else
116 {
117
118 std::size_t iter = 0;
119 for(auto &msrun_id_str : m_mzcborReaderBase.getMsrunIdList())
120 {
121 MsRunId ms_run_id(m_fileName, msrun_id_str);
122
123
124 // Set the MS data format as determined in initialize().
125 ms_run_id.setMsDataFormat(m_fileFormat);
126
127 // We need to set the unambiguous xmlId string.
128 ms_run_id.setXmlId(
129 QString("%1%2").arg(run_prefix).arg(Utils::getLexicalOrderedString(iter)));
130
131 // Now set the sample name to the run id : we can not do that, this is not the use
132 // sample name ms_run_id.setSampleName(QString::fromStdString(ms_data_ptr->run.id));
133
134 // And if it is possible, the real sample name because this one is for the
135 // end user to recognize his sample:
136 ms_run_id.setSampleName(msrun_id_str);
137
138
139 ms_run_ids.push_back(std::make_shared<MsRunId>(ms_run_id));
140 iter++;
141 }
142 }
143 }
144
145 return ms_run_ids;
146}
pappso::cbor::mzcbor::MzcborIndexReader m_mzcborIndexReader
pappso::cbor::mzcbor::MzcborReaderBase m_mzcborReaderBase
static const QString getLexicalOrderedString(unsigned int num)
Definition utils.cpp:72
const std::vector< QString > & getRunIdList() const

References pappso::Utils::getLexicalOrderedString(), pappso::cbor::mzcbor::MzcborReaderBase::getMsrunIdList(), pappso::cbor::mzcbor::MzcborIndexReader::getRunIdList(), pappso::MsFileReader::m_fileFormat, pappso::MsFileReader::m_fileName, m_mzcborIndexReader, m_mzcborReaderBase, pappso::Enums::mzcbor, pappso::MsRunId::setMsDataFormat(), pappso::MsRunId::setSampleName(), and pappso::MsRunId::setXmlId().

Referenced by pappso::MsFileAccessor::getMsRunIds().

◆ initialize()

std::size_t pappso::MzcborMsFileReader::initialize ( )
privatevirtual

Definition at line 33 of file mzcbormsfilereader.cpp.

34{
35
37 QString str_index_file = m_fileName;
38 QFileInfo mzcbor_index_fileinfo(str_index_file.append(".idx"));
39 if(mzcbor_index_fileinfo.exists())
40 {
41 qDebug() << "mzcbor_index_fileinfo.exists()";
42 QFile mzcbor_index_file(mzcbor_index_fileinfo.absoluteFilePath());
43 mzcbor_index_file.open(QIODevice::ReadOnly);
44
45 m_mzcborIndexReader.readCbor(&mzcbor_index_file);
47 {
49 }
51 mzcbor_index_file.close();
52
53 qDebug() << m_mzcborIndexReader.getRunIdList().size();
54
55 return m_mzcborIndexReader.getRunIdList().size();
56 }
57 else
58 {
59 qDebug();
60 QFile mzcbor_file(m_fileName);
61 mzcbor_file.open(QIODevice::ReadOnly);
62
63 m_mzcborReaderBase.readCbor(&mzcbor_file, monitor);
65 {
67 }
69 mzcbor_file.close();
70
71 qDebug() << m_mzcborReaderBase.getMsrunIdList().join(" ");
72
73 return m_mzcborReaderBase.getMsrunIdList().size();
74 }
75}
virtual void readCbor(QFile *cborp, pappso::UiMonitorInterface &monitor)
const QStringList & getMsrunIdList() const

References pappso::Enums::mzcbor.

Referenced by MzcborMsFileReader().

Member Data Documentation

◆ m_msDataPtrVector

std::vector<pwiz::msdata::MSDataPtr> pappso::MzcborMsFileReader::m_msDataPtrVector
private

Definition at line 36 of file mzcbormsfilereader.h.

◆ m_mzcborIndexReader

pappso::cbor::mzcbor::MzcborIndexReader pappso::MzcborMsFileReader::m_mzcborIndexReader
private

Definition at line 39 of file mzcbormsfilereader.h.

Referenced by getMsRunIds().

◆ m_mzcborReaderBase

pappso::cbor::mzcbor::MzcborReaderBase pappso::MzcborMsFileReader::m_mzcborReaderBase
private

Definition at line 38 of file mzcbormsfilereader.h.

Referenced by getMsRunIds().


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