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

#include <msfileaccessor.h>

Public Member Functions

 MsFileAccessor (const QString &file_name, const QString &xml_prefix)
 
 MsFileAccessor (const MsFileAccessor &other)
 
virtual ~MsFileAccessor ()
 
const QString & getFileName () const
 
Enums::MsDataFormat getFileFormat () const
 get the raw format of mz data
 
const OboPsiModTerm getOboPsiModTermFileFormat () const
 get OboPsiModTerm corresponding to the raw format of mz data
 
const OboPsiModTermgetOboPsiModTermNativeIDFormat () const
 get OboPsiModTerm corresponding to the nativeID format format of mz data
 
Enums::FileReaderType getFileReaderType () const
 get the file reader type
 
void setPreferredFileReaderType (Enums::MsDataFormat format, Enums::FileReaderType reader_type)
 given an mz format, explicitly set the preferred reader
 
Enums::FileReaderType getpreferredFileReaderType (Enums::MsDataFormat format)
 
std::vector< MsRunIdCstSPtrgetMsRunIds ()
 
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 ()
 
MsRunReaderSPtr getMsRunReaderSPtrByRunId (const QString &run_id, const QString &xml_id)
 get an msrun reader by finding the run_id in file
 
TimsMsRunReaderMs2SPtr buildTimsMsRunReaderMs2SPtr ()
 if possible, builds directly a dedicated Tims TOF tdf file reader
 

Static Public Member Functions

static MsRunReaderSPtr buildMsRunReaderSPtr (MsRunIdCstSPtr ms_run_id)
 get an MsRunReader directly from a valid MsRun ID
 
static MsRunReaderSPtr buildMsRunReaderSPtr (MsRunIdCstSPtr ms_run_id, Enums::FileReaderType preferred_file_reader_type)
 get an MsRunReader directly from a valid MsRun ID
 

Private Attributes

QString m_fileName
 
const QString m_xmlPrefix
 
Enums::MsDataFormat m_fileFormat = Enums::MsDataFormat::unknown
 
Enums::FileReaderType m_fileReaderType
 
std::map< Enums::MsDataFormat, Enums::FileReaderTypem_preferredFileReaderTypeMap
 
MsRunIdCstSPtr mcsp_selectedMsRunId = nullptr
 
OboPsiModTerm m_oboPsiModTermNativeIDFormat
 

Detailed Description

Definition at line 27 of file msfileaccessor.h.

Constructor & Destructor Documentation

◆ MsFileAccessor() [1/2]

pappso::MsFileAccessor::MsFileAccessor ( const QString &  file_name,
const QString &  xml_prefix 
)

Definition at line 34 of file msfileaccessor.cpp.

35 : m_fileName(file_name), m_xmlPrefix(xml_prefix)
36{
37 QFile file(file_name);
38 if(!file.exists())
39 throw(ExceptionNotFound(
40 QObject::tr("File %1 not found.").arg(QFileInfo(file_name).absoluteFilePath())));
41
42
44 m_oboPsiModTermNativeIDFormat.m_name = "no nativeID format";
46 "No nativeID format indicates that the file tagged with this term does not "
47 "contain spectra that can have a nativeID format.";
48}
OboPsiModTerm m_oboPsiModTermNativeIDFormat
void setAccession(const QString &accession)

References pappso::OboPsiModTerm::m_definition, pappso::OboPsiModTerm::m_name, m_oboPsiModTermNativeIDFormat, and pappso::OboPsiModTerm::setAccession().

◆ MsFileAccessor() [2/2]

pappso::MsFileAccessor::MsFileAccessor ( const MsFileAccessor other)

Definition at line 51 of file msfileaccessor.cpp.

52 : m_fileName(other.m_fileName),
53 m_xmlPrefix(other.m_xmlPrefix),
54 m_fileFormat(other.m_fileFormat),
55 m_fileReaderType(other.m_fileReaderType)
56{
57 m_oboPsiModTermNativeIDFormat = other.m_oboPsiModTermNativeIDFormat;
58}
Enums::FileReaderType m_fileReaderType
Enums::MsDataFormat m_fileFormat

References m_oboPsiModTermNativeIDFormat.

◆ ~MsFileAccessor()

pappso::MsFileAccessor::~MsFileAccessor ( )
virtual

Definition at line 60 of file msfileaccessor.cpp.

61{
62}

Member Function Documentation

◆ buildMsRunReaderSPtr() [1/2]

MsRunReaderSPtr pappso::MsFileAccessor::buildMsRunReaderSPtr ( MsRunIdCstSPtr  ms_run_id)
static

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

Parameters
ms_run_idmsrun identifier
Returns
msrun reader shared pointer

Definition at line 496 of file msfileaccessor.cpp.

497{
499}
static MsRunReaderSPtr buildMsRunReaderSPtr(MsRunIdCstSPtr ms_run_id)
get an MsRunReader directly from a valid MsRun ID
@ tims
TimsMsRunReader : each scan is returned as a mass spectrum.

References buildMsRunReaderSPtr(), and pappso::Enums::tims.

Referenced by buildMsRunReaderSPtr().

◆ buildMsRunReaderSPtr() [2/2]

MsRunReaderSPtr pappso::MsFileAccessor::buildMsRunReaderSPtr ( MsRunIdCstSPtr  ms_run_id,
Enums::FileReaderType  preferred_file_reader_type 
)
static

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

Parameters
ms_run_idmsrun identifier
preferred_file_reader_typethe preferred file reader type to use (depending on the mz format)
Returns
msrun reader shared pointer

Definition at line 502 of file msfileaccessor.cpp.

504{
505 QFile file(ms_run_id.get()->getFileName());
506 if(!file.exists())
507 throw(ExceptionNotFound(QObject::tr("unable to build a reader : file %1 not found.")
508 .arg(QFileInfo(ms_run_id.get()->getFileName()).absoluteFilePath())));
509
510 Enums::MsDataFormat file_format = ms_run_id.get()->getMsDataFormat();
511
512 if(file_format == Enums::MsDataFormat::xy)
513 {
514 // qDebug() << "Returning a XyMsRunReader.";
515
516 return std::make_shared<XyMsRunReader>(ms_run_id);
517 }
518 else if(file_format == Enums::MsDataFormat::brukerBafAscii)
519 {
520 // qDebug() << "Returning a XyMsRunReader.";
521
522 return std::make_shared<BafAsciiMsRunReader>(ms_run_id);
523 }
524 else if(file_format == Enums::MsDataFormat::unknown)
525 {
526 throw(PappsoException(QObject::tr("unable to build a reader for %1 : unknown file format")
527 .arg(QFileInfo(ms_run_id.get()->getFileName()).absoluteFilePath())));
528 }
529
530 else if(file_format == Enums::MsDataFormat::brukerTims)
531 {
532 if(preferred_file_reader_type == Enums::FileReaderType::tims)
533 {
534 return std::make_shared<TimsMsRunReader>(ms_run_id);
535 }
536 else if(preferred_file_reader_type == Enums::FileReaderType::tims_ms2)
537 {
538 return std::make_shared<TimsMsRunReaderMs2>(ms_run_id);
539 }
540 else if(preferred_file_reader_type == Enums::FileReaderType::tims_frames)
541 {
542 qDebug() << "returning std::make_shared<TimsFramesMsRunReader>(ms_run_id).";
543 return std::make_shared<TimsFramesMsRunReader>(ms_run_id);
544 }
545 // qDebug() << "by default, build a TimsMsRunReader.";
546 return std::make_shared<TimsMsRunReader>(ms_run_id);
547 }
548 else
549 {
550 // qDebug() << "Returning a PwizMsRunReader .";
551 return std::make_shared<PwizMsRunReader>(ms_run_id);
552 }
553}

References pappso::Enums::brukerBafAscii, pappso::Enums::brukerTims, pappso::Enums::tims, pappso::Enums::tims_frames, pappso::Enums::tims_ms2, pappso::Enums::unknown, and pappso::Enums::xy.

◆ buildTimsMsRunReaderMs2SPtr()

TimsMsRunReaderMs2SPtr pappso::MsFileAccessor::buildTimsMsRunReaderMs2SPtr ( )

if possible, builds directly a dedicated Tims TOF tdf file reader

Definition at line 368 of file msfileaccessor.cpp.

369{
370 // try TimsData reader
371 QString tims_dir = m_fileName;
372 if(!QFileInfo(tims_dir).isDir())
373 {
374 tims_dir = QFileInfo(m_fileName).absolutePath();
375 }
376 TimsMsFileReader tims_file_reader(tims_dir);
377
378 std::vector<MsRunIdCstSPtr> ms_run_ids = tims_file_reader.getMsRunIds(m_xmlPrefix);
379
380 if(ms_run_ids.size())
381 {
382 // qDebug() << "Might well be handled using the Bruker code";
384 m_fileFormat = tims_file_reader.getFileFormat();
385 m_fileName = tims_dir;
386
387 return std::make_shared<TimsMsRunReaderMs2>(ms_run_ids.front());
388 }
389 else
390 {
391 throw(ExceptionNotPossible(
392 QObject::tr("Unable to read mz data directory %1 with TimsTOF reader.").arg(tims_dir)));
393 }
394}

References pappso::TimsMsFileReader::getFileFormat(), pappso::TimsMsFileReader::getMsRunIds(), m_fileFormat, m_fileName, m_fileReaderType, m_xmlPrefix, and pappso::Enums::tims_ms2.

◆ getFileFormat()

Enums::MsDataFormat pappso::MsFileAccessor::getFileFormat ( ) const

get the raw format of mz data

Definition at line 73 of file msfileaccessor.cpp.

74{
75 return m_fileFormat;
76}

References m_fileFormat.

Referenced by pappso::TandemWrapperRun::convertOrginalMsData2mzXmlData(), and pappso::masschroq::JsonInput::readMzDataFiles().

◆ getFileName()

const QString & pappso::MsFileAccessor::getFileName ( ) const

Definition at line 66 of file msfileaccessor.cpp.

67{
68 return m_fileName;
69}

References m_fileName.

◆ getFileReaderType()

Enums::FileReaderType pappso::MsFileAccessor::getFileReaderType ( ) const

get the file reader type

Definition at line 348 of file msfileaccessor.cpp.

349{
350 return m_fileReaderType;
351}

References m_fileReaderType.

◆ getMsRunIds()

std::vector< MsRunIdCstSPtr > pappso::MsFileAccessor::getMsRunIds ( )

Definition at line 193 of file msfileaccessor.cpp.

194{
195 // qDebug();
196
197 // Try the PwizMsFileReader
198
199 PwizMsFileReader pwiz_ms_file_reader(m_fileName);
200
201 std::vector<MsRunIdCstSPtr> ms_run_ids = pwiz_ms_file_reader.getMsRunIds(m_xmlPrefix);
202 if(ms_run_ids.size())
203 {
204 qDebug() << "Might well be handled using the Pwiz code.";
205
206 m_fileFormat = pwiz_ms_file_reader.getFileFormat();
208
209 // But the user might have configured one preferred reader type.
210
212 if(pref != m_preferredFileReaderTypeMap.end())
213 {
214 m_fileReaderType = pref->second;
215 }
216
217 return ms_run_ids;
218 }
219
220 qDebug() << "The Pwiz reader did not work.";
221
222 // Try the TimsData reader
223
224 QString tims_dir = m_fileName;
225 if(!QFileInfo(tims_dir).isDir())
226 {
227 tims_dir = QFileInfo(m_fileName).absolutePath();
228 }
229
230 TimsMsFileReader tims_file_reader(tims_dir);
231
232 ms_run_ids = tims_file_reader.getMsRunIds(m_xmlPrefix);
233
234 if(ms_run_ids.size())
235 {
236 qDebug() << "Might well be handled using the Bruker code";
237
238 m_fileName = tims_dir;
239 m_fileFormat = tims_file_reader.getFileFormat();
241
243 if(pref != m_preferredFileReaderTypeMap.end())
244 {
245 m_fileReaderType = pref->second;
246 }
247
248 qDebug() << "Returning Bruker::tims ms run(s)."
249 << "with preferred reader type:" << Utils::fileReaderTypeAsString(m_fileReaderType);
250
251 return ms_run_ids;
252 }
253
254 qDebug() << "The Tims reader did not work.";
255
256 // Try the Baf->ascii export format from Bruker Compass
257
258 try
259 {
260 ms_run_ids.clear();
261 BafAsciiFileReader baf_ascii_ms_file_reader(m_fileName);
262
263 ms_run_ids = baf_ascii_ms_file_reader.getMsRunIds(m_xmlPrefix);
264
265 if(ms_run_ids.size())
266 {
267 qDebug() << "Might well be handled using the BafAscii code";
268
270
271 m_fileFormat = baf_ascii_ms_file_reader.getFileFormat();
272
274 {
275 ms_run_ids.clear();
276 }
277 else
278 {
279 return ms_run_ids;
280 }
281 }
282 }
283 catch(const pappso::PappsoException &error)
284 {
285 qDebug() << "This is not a BafAscii code file" << error.qwhat();
286 }
287
288
289 qDebug() << "The BafAscii reader did not work.";
290
291 // At this point try the XyMsFileReader
292
293 XyMsFileReader xy_ms_file_reader(m_fileName);
294
295 ms_run_ids = xy_ms_file_reader.getMsRunIds(m_xmlPrefix);
296
297 if(ms_run_ids.size())
298 {
299 qDebug() << "Might well be handled using the XY code";
300
302
303 m_fileFormat = xy_ms_file_reader.getFileFormat();
304
305 return ms_run_ids;
306 }
307
308 qDebug() << "The XY reader did not work.";
309
310 return ms_run_ids;
311}
std::map< Enums::MsDataFormat, Enums::FileReaderType > m_preferredFileReaderTypeMap
virtual const QString & qwhat() const
static QString fileReaderTypeAsString(Enums::FileReaderType file_reader_type)
Definition utils.cpp:501

References pappso::Enums::bafascii, pappso::Utils::fileReaderTypeAsString(), pappso::BafAsciiFileReader::getFileFormat(), pappso::PwizMsFileReader::getFileFormat(), pappso::TimsMsFileReader::getFileFormat(), pappso::XyMsFileReader::getFileFormat(), pappso::BafAsciiFileReader::getMsRunIds(), pappso::PwizMsFileReader::getMsRunIds(), pappso::TimsMsFileReader::getMsRunIds(), pappso::XyMsFileReader::getMsRunIds(), m_fileFormat, m_fileName, m_fileReaderType, m_preferredFileReaderTypeMap, m_xmlPrefix, pappso::Enums::pwiz, pappso::PappsoException::qwhat(), pappso::Enums::tims, pappso::Enums::unknown, and pappso::Enums::xy.

Referenced by pappso::TandemWrapperRun::convertOrginalMsData2mzXmlData(), getMsRunReaderSPtrByRunId(), msRunReaderSPtr(), and pappso::masschroq::JsonInput::readMzDataFiles().

◆ getMsRunReaderSPtrByRunId()

MsRunReaderSPtr pappso::MsFileAccessor::getMsRunReaderSPtrByRunId ( const QString &  run_id,
const QString &  xml_id 
)

get an msrun reader by finding the run_id in file

Parameters
run_ididentifier within file of the MSrun
xml_idXML identifier given by the user to identify this MSrun in our experiment (not in the file)

Definition at line 557 of file msfileaccessor.cpp.

558{
559 std::vector<MsRunIdCstSPtr> run_list = getMsRunIds();
560 MsRunReaderSPtr reader_sp;
561 for(MsRunIdCstSPtr &original_run_id : run_list)
562 {
563 if(original_run_id.get()->getRunId() == run_id)
564 {
565 MsRunId new_run_id(*original_run_id.get());
566 new_run_id.setXmlId(xml_id);
567
568 return msRunReaderSPtr(std::make_shared<MsRunId>(new_run_id));
569 }
570 }
571
572 if((run_id.isEmpty()) && (run_list.size() == 1))
573 {
574 MsRunId new_run_id(*run_list[0].get());
575 new_run_id.setXmlId(xml_id);
576
577 return msRunReaderSPtr(std::make_shared<MsRunId>(new_run_id));
578 }
579
580
581 if(reader_sp == nullptr)
582 {
583 throw(ExceptionNotFound(QObject::tr("run id %1 not found in file %2")
584 .arg(run_id)
585 .arg(QFileInfo(m_fileName).absoluteFilePath())));
586 }
587 return reader_sp;
588}
MsRunReaderSPtr msRunReaderSPtr(MsRunIdCstSPtr ms_run_id)
std::vector< MsRunIdCstSPtr > getMsRunIds()
std::shared_ptr< MsRunReader > MsRunReaderSPtr
Definition msrunreader.h:57
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46

References getMsRunIds(), m_fileName, msRunReaderSPtr(), and pappso::MsRunId::setXmlId().

Referenced by pappso::masschroq::JsonInput::readMzDataFiles().

◆ getOboPsiModTermFileFormat()

const OboPsiModTerm pappso::MsFileAccessor::getOboPsiModTermFileFormat ( ) const

get OboPsiModTerm corresponding to the raw format of mz data

Definition at line 79 of file msfileaccessor.cpp.

80{
81 OboPsiModTerm term;
82
83 // is_a: MS:1000560 ! mass spectrometer file format
84 switch(m_fileFormat)
85 {
87 term.setAccession("MS:1001560");
88 term.m_name = "SCIEX TOF/TOF T2D format";
89 term.m_definition =
90 "Applied Biosystems/MDS Analytical Technologies TOF/TOF instrument "
91 "export format.";
92 break;
94 term.setAccession("MS:1000562");
95 term.m_name = "ABI WIFF format";
96 term.m_definition = "Applied Biosystems WIFF file format.";
97 break;
99 term.setAccession("MS:1001509");
100 term.m_name = "Agilent MassHunter format";
101 term.m_definition =
102 "A data file format found in an Agilent MassHunter directory which "
103 "contains raw data acquired by an Agilent mass spectrometer.";
104 break;
106 break;
108 term.setAccession("MS:1000825");
109 term.m_name = "Bruker FID format";
110 term.m_definition = "Bruker FID file format.";
111 break;
113 term.setAccession("MS:1002817");
114 term.m_name = "Bruker TDF format";
115 term.m_definition = "Bruker TDF raw file format.";
116 break;
118 term.setAccession("MS:1000567");
119 term.m_name = "Bruker/Agilent YEP format";
120 term.m_definition = "Bruker/Agilent YEP file format.";
121 break;
123 term.setAccession("MS:1001062");
124 term.m_name = "Mascot MGF format";
125 term.m_definition = "Mascot MGF file format.";
126 break;
128 break;
130 term.setAccession("MS:1001881");
131 term.m_name = "mz5 format";
132 term.m_definition = "mz5 file format, modelled after mzML.";
133 break;
135 term.setAccession("MS:1000584");
136 term.m_name = "mzML format";
137 term.m_definition = "Proteomics Standards Inititative mzML file format.";
138 break;
140 term.setAccession("MS:1000566");
141 term.m_name = "ISB mzXML format";
142 term.m_definition = "Institute of Systems Biology mzXML file format.";
143 break;
145 break;
147
148 term.setAccession("MS:1000563");
149 term.m_name = "Thermo RAW format";
150 term.m_definition = "Thermo Scientific RAW file format.";
151 break;
153 break;
155 term.setAccession("MS:1000526");
156 term.m_name = "Waters raw format";
157 term.m_definition =
158 "Waters data file format found in a Waters RAW directory, generated "
159 "from an MS acquisition.";
160 break;
162 term.setAccession("MS:1001369");
163 term.m_name = "BafAscii text format";
164 term.m_definition =
165 "Simple text file format obtained by exporting Bruker Baf to ascii "
166 "using Bruker software";
167 break;
169 term.setAccession("MS:1001369");
170 term.m_name = "text format";
171 term.m_definition =
172 "Simple text file format of \"m/z<separator>intensity\" value pairs "
173 "for a single mass spectrum, a PMF (or single MS2) search.";
174 break;
175 default:
176 break;
177 }
178
179 return term;
180}
@ SQLite3
SQLite3 format.

References pappso::Enums::abSciexT2D, pappso::Enums::abSciexWiff, pappso::Enums::agilentMassHunter, pappso::Enums::brukerBaf, pappso::Enums::brukerBafAscii, pappso::Enums::brukerFid, pappso::Enums::brukerTims, pappso::Enums::brukerYep, pappso::OboPsiModTerm::m_definition, m_fileFormat, pappso::OboPsiModTerm::m_name, pappso::Enums::MGF, pappso::Enums::msn, pappso::Enums::mz5, pappso::Enums::mzML, pappso::Enums::mzXML, pappso::OboPsiModTerm::setAccession(), pappso::Enums::SQLite3, pappso::Enums::thermoRaw, pappso::Enums::unknown, pappso::Enums::watersRaw, and pappso::Enums::xy.

◆ getOboPsiModTermNativeIDFormat()

const OboPsiModTerm & pappso::MsFileAccessor::getOboPsiModTermNativeIDFormat ( ) const

get OboPsiModTerm corresponding to the nativeID format format of mz data

Definition at line 184 of file msfileaccessor.cpp.

185{
186
187
189}

References m_oboPsiModTermNativeIDFormat.

◆ getpreferredFileReaderType()

Enums::FileReaderType pappso::MsFileAccessor::getpreferredFileReaderType ( Enums::MsDataFormat  format)

Definition at line 332 of file msfileaccessor.cpp.

333{
334 // qDebug();
335
336 auto ret = m_preferredFileReaderTypeMap.find(format);
337
338 if(ret != m_preferredFileReaderTypeMap.end())
339 {
340 return ret->second;
341 }
342
343 return m_fileReaderType;
344}

References m_fileReaderType, and m_preferredFileReaderTypeMap.

Referenced by msRunReaderSPtr().

◆ getSelectedMsRunId()

MsRunIdCstSPtr pappso::MsFileAccessor::getSelectedMsRunId ( ) const

Definition at line 362 of file msfileaccessor.cpp.

363{
365}
MsRunIdCstSPtr mcsp_selectedMsRunId

References mcsp_selectedMsRunId.

◆ msRunReaderSPtr() [1/2]

MsRunReaderSPtr pappso::MsFileAccessor::msRunReaderSPtr ( MsRunIdCstSPtr  ms_run_id)

Definition at line 398 of file msfileaccessor.cpp.

399{
400 // qDebug();
401
402 // We want to return a MsRunReader that accounts for the configuration that
403 // the user might have set.
404
405 if(m_fileName != ms_run_id->getFileName())
406 throw(
407 ExceptionNotPossible(QObject::tr("The MsRunId instance must have the name file name as the "
408 "MsFileAccessor.")));
409
411 {
412 qDebug() << "Returning a PwizMsRunReader.";
413 auto pwiz_reader = std::make_shared<PwizMsRunReader>(ms_run_id);
414 m_oboPsiModTermNativeIDFormat = pwiz_reader->getOboPsiModTermNativeIDFormat();
415 return pwiz_reader;
416 }
418 {
419 // qDebug() << "Returning a XyMsRunReader.";
420
421 return std::make_shared<XyMsRunReader>(ms_run_id);
422 }
424 {
425 qDebug() << "Returning a TimsMsRunReader Enums::FileReaderType::tims";
426 return std::make_shared<TimsMsRunReader>(ms_run_id);
427 }
429 {
430 qDebug() << "Returning a TimsFramesMsRunReader Enums::FileReaderType::tims_frames.";
431
432 return std::make_shared<TimsFramesMsRunReader>(ms_run_id);
433 }
435 {
436 qDebug() << "Returning a TimsMsRunReaderMs2 Enums::FileReaderType::tims_ms2";
437
438 return std::make_shared<TimsMsRunReaderMs2>(ms_run_id);
439 }
441 {
442 qDebug() << "Returning a Enums::FileReaderType::tims_dia";
443
444 // qInfo() << "std::make_shared<TimsMsRunReaderDia>(ms_run_id);";
445 return std::make_shared<TimsMsRunReaderDia>(ms_run_id);
446 }
448 {
449 // qDebug() << "Returning a BafAsciiMsRunReader.";
450
451 return std::make_shared<BafAsciiMsRunReader>(ms_run_id);
452 }
454 {
455 if(ms_run_id.get()->getMsDataFormat() == Enums::MsDataFormat::xy)
456 {
457 return std::make_shared<XyMsRunReader>(ms_run_id);
458 }
459 else
460 {
461 auto pwiz_reader = std::make_shared<PwizMsRunReader>(ms_run_id);
462 m_oboPsiModTermNativeIDFormat = pwiz_reader->getOboPsiModTermNativeIDFormat();
463 return pwiz_reader;
464 }
465 }
466 else
467 {
468 throw PappsoException(QObject::tr("No file format was found."));
469 }
470
471 return nullptr;
472}
Enums::FileReaderType getpreferredFileReaderType(Enums::MsDataFormat format)

References pappso::Enums::bafascii, getpreferredFileReaderType(), m_fileFormat, m_fileName, m_oboPsiModTermNativeIDFormat, pappso::Enums::pwiz, pappso::Enums::tims, pappso::Enums::tims_dia, pappso::Enums::tims_frames, pappso::Enums::tims_ms2, pappso::Enums::unknown, and pappso::Enums::xy.

Referenced by pappso::TandemWrapperRun::convertOrginalMsData2mzXmlData(), getMsRunReaderSPtrByRunId(), msRunReaderSPtr(), and msRunReaderSPtrForSelectedMsRunId().

◆ msRunReaderSPtr() [2/2]

MsRunReaderSPtr pappso::MsFileAccessor::msRunReaderSPtr ( std::size_t  ms_run_id_index)

Definition at line 476 of file msfileaccessor.cpp.

477{
478 std::vector<MsRunIdCstSPtr> ms_run_ids = getMsRunIds();
479 if(ms_run_id_index >= ms_run_ids.size())
480 throw PappsoException(QObject::tr("MsRunId request out-of-bound error."));
481
482 return msRunReaderSPtr(ms_run_ids.at(ms_run_id_index));
483}

References getMsRunIds(), and msRunReaderSPtr().

◆ msRunReaderSPtrForSelectedMsRunId()

MsRunReaderSPtr pappso::MsFileAccessor::msRunReaderSPtrForSelectedMsRunId ( )

Definition at line 487 of file msfileaccessor.cpp.

488{
489 // qDebug();
490
492}

References mcsp_selectedMsRunId, and msRunReaderSPtr().

◆ setPreferredFileReaderType()

void pappso::MsFileAccessor::setPreferredFileReaderType ( Enums::MsDataFormat  format,
Enums::FileReaderType  reader_type 
)

given an mz format, explicitly set the preferred reader

Definition at line 315 of file msfileaccessor.cpp.

317{
318 // qDebug();
319
320 auto ret = m_preferredFileReaderTypeMap.insert(
321 std::pair<Enums::MsDataFormat, Enums::FileReaderType>(format, reader_type));
322
323 if(!ret.second)
324 {
325 // replace
326 ret.first->second = reader_type;
327 }
328}

References m_preferredFileReaderTypeMap.

Referenced by pappso::TandemWrapperRun::convertOrginalMsData2mzXmlData(), and pappso::masschroq::JsonInput::readMzDataFiles().

◆ setSelectedMsRunId()

void pappso::MsFileAccessor::setSelectedMsRunId ( MsRunIdCstSPtr  ms_run_id_csp)

Definition at line 355 of file msfileaccessor.cpp.

356{
357 mcsp_selectedMsRunId = ms_run_id_csp;
358}

References mcsp_selectedMsRunId.

Member Data Documentation

◆ m_fileFormat

◆ m_fileName

QString pappso::MsFileAccessor::m_fileName
private

◆ m_fileReaderType

Enums::FileReaderType pappso::MsFileAccessor::m_fileReaderType
private

◆ m_oboPsiModTermNativeIDFormat

OboPsiModTerm pappso::MsFileAccessor::m_oboPsiModTermNativeIDFormat
private

◆ m_preferredFileReaderTypeMap

std::map<Enums::MsDataFormat, Enums::FileReaderType> pappso::MsFileAccessor::m_preferredFileReaderTypeMap
private

◆ m_xmlPrefix

const QString pappso::MsFileAccessor::m_xmlPrefix
private

Definition at line 113 of file msfileaccessor.h.

Referenced by buildTimsMsRunReaderMs2SPtr(), and getMsRunIds().

◆ mcsp_selectedMsRunId

MsRunIdCstSPtr pappso::MsFileAccessor::mcsp_selectedMsRunId = nullptr
private

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