37 QFile file(file_name);
40 QObject::tr(
"File %1 not found.").arg(QFileInfo(file_name).absoluteFilePath())));
46 "No nativeID format indicates that the file tagged with this term does not "
47 "contain spectra that can have a nativeID format.";
88 term.
m_name =
"SCIEX TOF/TOF T2D format";
90 "Applied Biosystems/MDS Analytical Technologies TOF/TOF instrument "
95 term.
m_name =
"ABI WIFF format";
96 term.
m_definition =
"Applied Biosystems WIFF file format.";
100 term.
m_name =
"Agilent MassHunter format";
102 "A data file format found in an Agilent MassHunter directory which "
103 "contains raw data acquired by an Agilent mass spectrometer.";
109 term.
m_name =
"Bruker FID format";
114 term.
m_name =
"Bruker TDF format";
119 term.
m_name =
"Bruker/Agilent YEP format";
124 term.
m_name =
"Mascot MGF format";
131 term.
m_name =
"mz5 format";
132 term.
m_definition =
"mz5 file format, modelled after mzML.";
136 term.
m_name =
"mzML format";
137 term.
m_definition =
"Proteomics Standards Inititative mzML file format.";
141 term.
m_name =
"ISB mzXML format";
142 term.
m_definition =
"Institute of Systems Biology mzXML file format.";
149 term.
m_name =
"Thermo RAW format";
150 term.
m_definition =
"Thermo Scientific RAW file format.";
156 term.
m_name =
"Waters raw format";
158 "Waters data file format found in a Waters RAW directory, generated "
159 "from an MS acquisition.";
163 term.
m_name =
"BafAscii text format";
165 "Simple text file format obtained by exporting Bruker Baf to ascii "
166 "using Bruker software";
170 term.
m_name =
"text format";
172 "Simple text file format of \"m/z<separator>intensity\" value pairs "
173 "for a single mass spectrum, a PMF (or single MS2) search.";
192std::vector<MsRunIdCstSPtr>
202 if(ms_run_ids.size())
204 qDebug() <<
"Might well be handled using the Pwiz code.";
220 qDebug() <<
"The Pwiz reader did not work.";
225 if(!QFileInfo(tims_dir).isDir())
227 tims_dir = QFileInfo(
m_fileName).absolutePath();
234 if(ms_run_ids.size())
236 qDebug() <<
"Might well be handled using the Bruker code";
248 qDebug() <<
"Returning Bruker::tims ms run(s)."
254 qDebug() <<
"The Tims reader did not work.";
265 if(ms_run_ids.size())
267 qDebug() <<
"Might well be handled using the BafAscii code";
285 qDebug() <<
"This is not a BafAscii code file" << error.
qwhat();
289 qDebug() <<
"The BafAscii reader did not work.";
297 if(ms_run_ids.size())
299 qDebug() <<
"Might well be handled using the XY code";
308 qDebug() <<
"The XY reader did not work.";
320 std::pair<Enums::MsDataFormat, Enums::FileReaderType>(format, reader_type));
325 ret.first->second = reader_type;
371 if(!QFileInfo(tims_dir).isDir())
373 tims_dir = QFileInfo(
m_fileName).absolutePath();
379 if(ms_run_ids.size())
386 return std::make_shared<TimsMsRunReaderMs2>(ms_run_ids.front());
391 QObject::tr(
"Unable to read mz data directory %1 with TimsTOF reader.").arg(tims_dir)));
407 "MsFileAccessor.")));
412 auto pwiz_reader = std::make_shared<PwizMsRunReader>(ms_run_id);
420 return std::make_shared<XyMsRunReader>(ms_run_id);
426 return std::make_shared<TimsMsRunReader>(ms_run_id);
432 return std::make_shared<TimsFramesMsRunReader>(ms_run_id);
438 return std::make_shared<TimsMsRunReaderMs2>(ms_run_id);
445 return std::make_shared<TimsMsRunReaderDia>(ms_run_id);
451 return std::make_shared<BafAsciiMsRunReader>(ms_run_id);
457 return std::make_shared<XyMsRunReader>(ms_run_id);
461 auto pwiz_reader = std::make_shared<PwizMsRunReader>(ms_run_id);
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."));
505 QFile file(ms_run_id.get()->getFileName());
507 throw(
ExceptionNotFound(QObject::tr(
"unable to build a reader : file %1 not found.")
508 .arg(QFileInfo(ms_run_id.get()->getFileName()).absoluteFilePath())));
516 return std::make_shared<XyMsRunReader>(ms_run_id);
522 return std::make_shared<BafAsciiMsRunReader>(ms_run_id);
526 throw(
PappsoException(QObject::tr(
"unable to build a reader for %1 : unknown file format")
527 .arg(QFileInfo(ms_run_id.get()->getFileName()).absoluteFilePath())));
534 return std::make_shared<TimsMsRunReader>(ms_run_id);
538 return std::make_shared<TimsMsRunReaderMs2>(ms_run_id);
542 qDebug() <<
"returning std::make_shared<TimsFramesMsRunReader>(ms_run_id).";
543 return std::make_shared<TimsFramesMsRunReader>(ms_run_id);
546 return std::make_shared<TimsMsRunReader>(ms_run_id);
551 return std::make_shared<PwizMsRunReader>(ms_run_id);
559 std::vector<MsRunIdCstSPtr> run_list =
getMsRunIds();
563 if(original_run_id.get()->getRunId() == run_id)
565 MsRunId new_run_id(*original_run_id.get());
572 if((run_id.isEmpty()) && (run_list.size() == 1))
574 MsRunId new_run_id(*run_list[0].get());
581 if(reader_sp ==
nullptr)
585 .arg(QFileInfo(
m_fileName).absoluteFilePath())));
virtual Enums::MsDataFormat getFileFormat() override
virtual std::vector< MsRunIdCstSPtr > getMsRunIds(const QString &run_prefix) override
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
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