39 QFile file(file_name);
42 QObject::tr(
"File %1 not found.").arg(QFileInfo(file_name).absoluteFilePath())));
48 "No nativeID format indicates that the file tagged with this term does not "
49 "contain spectra that can have a nativeID format.";
90 term.
m_name =
"SCIEX TOF/TOF T2D format";
92 "Applied Biosystems/MDS Analytical Technologies TOF/TOF instrument "
97 term.
m_name =
"ABI WIFF format";
98 term.
m_definition =
"Applied Biosystems WIFF file format.";
102 term.
m_name =
"Agilent MassHunter format";
104 "A data file format found in an Agilent MassHunter directory which "
105 "contains raw data acquired by an Agilent mass spectrometer.";
111 term.
m_name =
"Bruker FID format";
116 term.
m_name =
"Bruker TDF format";
121 term.
m_name =
"Bruker/Agilent YEP format";
126 term.
m_name =
"Mascot MGF format";
133 term.
m_name =
"mz5 format";
134 term.
m_definition =
"mz5 file format, modelled after mzML.";
138 term.
m_name =
"mzML format";
139 term.
m_definition =
"Proteomics Standards Inititative mzML file format.";
145 term.
m_name =
"mzML format";
146 term.
m_definition =
"Proteomics Standards Inititative mzML file format.";
150 term.
m_name =
"ISB mzXML format";
151 term.
m_definition =
"Institute of Systems Biology mzXML file format.";
158 term.
m_name =
"Thermo RAW format";
159 term.
m_definition =
"Thermo Scientific RAW file format.";
165 term.
m_name =
"Waters raw format";
167 "Waters data file format found in a Waters RAW directory, generated "
168 "from an MS acquisition.";
172 term.
m_name =
"BafAscii text format";
174 "Simple text file format obtained by exporting Bruker Baf to ascii "
175 "using Bruker software";
179 term.
m_name =
"text format";
181 "Simple text file format of \"m/z<separator>intensity\" value pairs "
182 "for a single mass spectrum, a PMF (or single MS2) search.";
201std::vector<MsRunIdCstSPtr>
207 std::vector<MsRunIdCstSPtr> ms_run_ids;
214 qDebug() <<
"sure, this is mzcbor";
226 if(ms_run_ids.size())
228 qDebug() <<
"Might well be handled using the Pwiz code.";
244 qDebug() <<
"The Pwiz reader did not work.";
251 if(!QFileInfo(tims_dir).isDir())
253 tims_dir = QFileInfo(
m_fileName).absolutePath();
260 if(ms_run_ids.size())
262 qDebug() <<
"Might well be handled using the Bruker code";
274 qDebug() <<
"Returning Bruker::tims ms run(s)."
275 <<
"with preferred reader type:"
283 qDebug() <<
"The Tims reader did not work.";
296 if(ms_run_ids.size())
298 qDebug() <<
"Might well be handled using the BafAscii code";
316 qDebug() <<
"This is not a BafAscii code file" << error.
qwhat();
320 qDebug() <<
"The BafAscii reader did not work.";
328 if(ms_run_ids.size())
330 qDebug() <<
"Might well be handled using the XY code";
339 qDebug() <<
"The XY reader did not work.";
353 std::pair<Enums::MsDataFormat, Enums::FileReaderType>(format, reader_type));
358 ret.first->second = reader_type;
404 if(!QFileInfo(tims_dir).isDir())
406 tims_dir = QFileInfo(
m_fileName).absolutePath();
412 if(ms_run_ids.size())
419 return std::make_shared<TimsMsRunReaderMs2>(ms_run_ids.front());
424 QObject::tr(
"Unable to read mz data directory %1 with TimsTOF reader.").arg(tims_dir)));
440 "MsFileAccessor. %1 != %2")
442 .arg(ms_run_id->getFileName())));
446 qDebug() <<
"Returning a MzcborMsRunReader.";
448 return std::make_shared<MzcborMsRunReader>(ms_run_id);
452 qDebug() <<
"Returning a PwizMsRunReader.";
453 auto pwiz_reader = std::make_shared<PwizMsRunReader>(ms_run_id);
461 return std::make_shared<XyMsRunReader>(ms_run_id);
465 qDebug() <<
"Returning a TimsMsRunReader Enums::FileReaderType::tims";
466 return std::make_shared<TimsMsRunReader>(ms_run_id);
470 qDebug() <<
"Returning a TimsFramesMsRunReader Enums::FileReaderType::tims_frames.";
472 return std::make_shared<TimsFramesMsRunReader>(ms_run_id);
476 qDebug() <<
"Returning a TimsMsRunReaderMs2 Enums::FileReaderType::tims_ms2";
478 return std::make_shared<TimsMsRunReaderMs2>(ms_run_id);
482 qDebug() <<
"Returning a Enums::FileReaderType::tims_dia";
485 return std::make_shared<TimsMsRunReaderDia>(ms_run_id);
491 return std::make_shared<BafAsciiMsRunReader>(ms_run_id);
497 return std::make_shared<XyMsRunReader>(ms_run_id);
501 auto pwiz_reader = std::make_shared<PwizMsRunReader>(ms_run_id);
518 std::vector<MsRunIdCstSPtr> ms_run_ids =
getMsRunIds();
519 if(ms_run_id_index >= ms_run_ids.size())
520 throw PappsoException(QObject::tr(
"MsRunId request out-of-bound error."));
545 QFile file(ms_run_id.get()->getFileName());
547 throw(
ExceptionNotFound(QObject::tr(
"unable to build a reader : file %1 not found.")
548 .arg(QFileInfo(ms_run_id.get()->getFileName()).absoluteFilePath())));
556 return std::make_shared<XyMsRunReader>(ms_run_id);
562 return std::make_shared<BafAsciiMsRunReader>(ms_run_id);
566 throw(
PappsoException(QObject::tr(
"unable to build a reader for %1 : unknown file format")
567 .arg(QFileInfo(ms_run_id.get()->getFileName()).absoluteFilePath())));
574 return std::make_shared<TimsMsRunReader>(ms_run_id);
578 return std::make_shared<TimsMsRunReaderMs2>(ms_run_id);
582 qDebug() <<
"returning std::make_shared<TimsFramesMsRunReader>(ms_run_id).";
583 return std::make_shared<TimsFramesMsRunReader>(ms_run_id);
586 return std::make_shared<TimsMsRunReader>(ms_run_id);
590 return std::make_shared<MzcborMsRunReader>(ms_run_id);
595 return std::make_shared<PwizMsRunReader>(ms_run_id);
603 std::vector<MsRunIdCstSPtr> run_list =
getMsRunIds();
607 if(original_run_id.get()->getRunId() == run_id)
609 MsRunId new_run_id(*original_run_id.get());
616 if((run_id.isEmpty()) && (run_list.size() == 1))
618 MsRunId new_run_id(*run_list[0].get());
625 if(reader_sp ==
nullptr)
629 .arg(QFileInfo(
m_fileName).absoluteFilePath())));
virtual Enums::MsDataFormat getFileFormat() override
virtual std::vector< MsRunIdCstSPtr > getMsRunIds(const QString &run_prefix) override
excetion to use when an item type is not recognized
const OboPsiModTerm & getOboPsiModTermNativeIDFormat() const
get OboPsiModTerm corresponding to the nativeID format format of mz data
MsRunIdCstSPtr getSelectedMsRunId() const
MsRunReaderSPtr msRunReaderSPtr(MsRunIdCstSPtr ms_run_id)
const QString m_xmlPrefix
Enums::FileReaderType m_fileReaderType
Enums::MsDataFormat m_fileFormat
void setPreferredFileReaderType(Enums::MsDataFormat format, Enums::FileReaderType reader_type)
given an mz format, explicitly set the preferred reader
virtual ~MsFileAccessor()
Enums::MsDataFormat getFileFormat() const
get the raw format of mz data
Enums::FileReaderType getFileReaderType() const
get the file reader type
MsRunReaderSPtr msRunReaderSPtrForSelectedMsRunId()
MsRunIdCstSPtr mcsp_selectedMsRunId
std::vector< MsRunIdCstSPtr > getMsRunIds()
OboPsiModTerm m_oboPsiModTermNativeIDFormat
void setSelectedMsRunId(MsRunIdCstSPtr ms_run_id_csp)
const OboPsiModTerm getOboPsiModTermFileFormat() const
get OboPsiModTerm corresponding to the raw format of mz data
MsRunReaderSPtr getMsRunReaderSPtrByRunId(const QString &run_id, const QString &xml_id)
get an msrun reader by finding the run_id in file
Enums::FileReaderType getpreferredFileReaderType(Enums::MsDataFormat format)
MsFileAccessor(const QString &file_name, const QString &xml_prefix)
static MsRunReaderSPtr buildMsRunReaderSPtr(MsRunIdCstSPtr ms_run_id)
get an MsRunReader directly from a valid MsRun ID
std::map< Enums::MsDataFormat, Enums::FileReaderType > m_preferredFileReaderTypeMap
TimsMsRunReaderMs2SPtr buildTimsMsRunReaderMs2SPtr()
if possible, builds directly a dedicated Tims TOF tdf file reader
const QString & getFileName() const
MS run identity MsRunId identifies an MS run with a unique ID (XmlId) and contains eventually informa...
void setXmlId(const QString &xml_id)
set an XML unique identifier for this MsRunId
virtual std::vector< MsRunIdCstSPtr > getMsRunIds(const QString &run_prefix) override
virtual Enums::MsDataFormat getFileFormat() override
void setAccession(const QString &accession)
virtual const QString & qwhat() const
virtual std::vector< MsRunIdCstSPtr > getMsRunIds(const QString &run_prefix) override
virtual Enums::MsDataFormat getFileFormat() override
virtual Enums::MsDataFormat getFileFormat() override
virtual std::vector< MsRunIdCstSPtr > getMsRunIds(const QString &run_prefix) override
static QString fileReaderTypeAsString(Enums::FileReaderType file_reader_type)
virtual std::vector< MsRunIdCstSPtr > getMsRunIds(const QString &run_prefix) override
virtual Enums::MsDataFormat getFileFormat() override
@ tims
TimsMsRunReader : each scan is returned as a mass spectrum.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< MsRunReader > MsRunReaderSPtr
std::shared_ptr< TimsMsRunReaderMs2 > TimsMsRunReaderMs2SPtr
std::shared_ptr< const MsRunId > MsRunIdCstSPtr