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

#include <pwizmsrunreader.h>

Inheritance diagram for pappso::PwizMsRunReader:
pappso::MsRunReader

Public Member Functions

 PwizMsRunReader (MsRunIdCstSPtr &msrun_id_csp)
virtual ~PwizMsRunReader ()
const pwiz::msdata::MSDataPtr getMsDataPtr () const
virtual MassSpectrumSPtr massSpectrumSPtr (std::size_t spectrum_index) override
 get a MassSpectrumSPtr class given its spectrum index
virtual MassSpectrumCstSPtr massSpectrumCstSPtr (std::size_t spectrum_index) override
virtual QualifiedMassSpectrum qualifiedMassSpectrum (std::size_t spectrum_index, bool want_binary_data=true) const override
 get a QualifiedMassSpectrum class given its scan number
virtual void readSpectrumCollection (SpectrumCollectionHandlerInterface &handler) override
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
virtual void readSpectrumCollection2 (const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler) override
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex (std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
 get a xic coordinate object from a given spectrum index
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum (const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
 get a xic coordinate object from a given spectrum
virtual void readSpectrumCollectionByMsLevel (SpectrumCollectionHandlerInterface &handler, unsigned int ms_level) override
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels
virtual std::size_t spectrumListSize () const override
 get the totat number of spectrum conained in the MSrun data file
virtual bool hasScanNumbers () const override
 tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided functions can check if scan numbers are available in the current file
virtual bool releaseDevice () override
 release data back end device if a the data back end is released, the developper has to use acquireDevice before using the msrunreader object
virtual bool acquireDevice () override
 acquire data back end device
const OboPsiModTerm getOboPsiModTermNativeIDFormat () const
 get OboPsiModTerm corresponding to the nativeID format format of mz data
virtual std::size_t spectrumStringIdentifier2SpectrumIndex (const QString &spectrum_identifier) override
 if possible, get the spectrum index given a string identifier throw a not found exception if spectrum identifier is not found
Public Member Functions inherited from pappso::MsRunReader
 MsRunReader (const MsRunIdCstSPtr &ms_run_id)
 MsRunReader (const MsRunReader &other)
virtual ~MsRunReader ()
const MsRunIdCstSPtr & getMsRunId () const
virtual std::size_t scanNumber2SpectrumIndex (std::size_t scan_number)
 if possible, converts a scan number into a spectrum index This is a convenient function to help transition from the old scan number (not implemented by all vendors) to more secure spectrum index (not vendor dependant). It is better to not rely on this function.
virtual std::vector< double > getRetentionTimeLine ()
 retention timeline get retention times along the MSrun in seconds
virtual Trace getTicChromatogram ()
 get a TIC chromatogram
void setMonoThread (bool is_mono_thread)
 set only one is_mono_thread to true
bool isMonoThread () const

Protected Member Functions

virtual void readSpectrumCollectionWithMsrunReadConfig (const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler)
virtual void initialize () override
virtual bool accept (const QString &file_name) const override
 tells if the reader is able to handle this file must be implemented by private MS run reader, specific of one or more file format
bool processRetentionTime (pwiz::msdata::Spectrum *spectrum_p, QualifiedMassSpectrum &qualified_mass_spectrum) const
bool processDriftTime (pwiz::msdata::Spectrum *spectrum_p, QualifiedMassSpectrum &qualified_mass_spectrum) const
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizMSData (std::size_t spectrum_index, bool want_binary_data, bool &ok) const
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizSpectrumPtr (const MassSpectrumId &massSpectrumId, pwiz::msdata::Spectrum *spectrum_p, bool want_binary_data, bool &ok) const
pwiz::msdata::SpectrumPtr getPwizSpectrumPtr (pwiz::msdata::SpectrumList *p_spectrum_list, std::size_t spectrum_index, bool want_binary_data) const
virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName () const override
 get OboPsiModTerm corresponding to the instrument model name child of : [Term] id: MS:1000031 name: instrument model def: "Instrument model name not including the vendor's name." [PSI:MS] relationship: part_of MS:1000463 ! instrument
void checkNativeId (const pwiz::msdata::Spectrum *pwiz_spectrum_ptr, MassSpectrumId &mass_spectrum_id) const

Static Protected Member Functions

static std::string setGlobalLocaleToEnglish ()
static void setGlobalLocaleToCurrentOs (const std::string &environment_locale)

Protected Attributes

pwiz::msdata::MSDataPtr msp_msData = nullptr
Protected Attributes inherited from pappso::MsRunReader
MsRunIdCstSPtr mcsp_msRunId
MsRunReaderScanNumberMultiMap * mpa_multiMapScanNumber = nullptr

Static Protected Attributes

static QMutex m_mutex

Private Attributes

bool m_hasScanNumbers = false

Friends

class MsFileAccessor

Detailed Description

Definition at line 45 of file pwizmsrunreader.h.

Constructor & Destructor Documentation

◆ PwizMsRunReader()

pappso::PwizMsRunReader::PwizMsRunReader ( MsRunIdCstSPtr & msrun_id_csp)

Definition at line 57 of file pwizmsrunreader.cpp.

57 : MsRunReader(msrun_id_csp)
58{
59 // The initialization needs to be done immediately so that we get the pwiz
60 // MsDataPtr corresponding to the right ms_run_id in the parameter. That
61 // pointer will be set to msp_msData.
62
63 initialize();
64}
virtual void initialize() override
class PMSPP_LIB_DECL MsRunReader
Definition msrunreader.h:56

References pappso::MsRunReader::MsRunReader(), and initialize().

Referenced by MsFileAccessor.

◆ ~PwizMsRunReader()

pappso::PwizMsRunReader::~PwizMsRunReader ( )
virtual

Definition at line 165 of file pwizmsrunreader.cpp.

166{
167}

Member Function Documentation

◆ accept()

bool pappso::PwizMsRunReader::accept ( const QString & file_name) const
overrideprotectedvirtual

tells if the reader is able to handle this file must be implemented by private MS run reader, specific of one or more file format

Implements pappso::MsRunReader.

Definition at line 777 of file pwizmsrunreader.cpp.

778{
779 // We want to know if we can handle the file_name.
780 pwiz::msdata::ReaderList reader_list;
781
782 std::string reader_type = reader_list.identify(file_name.toStdString());
783
784 if(!reader_type.empty())
785 return true;
786
787 return false;
788}

Referenced by MsFileAccessor.

◆ acquireDevice()

bool pappso::PwizMsRunReader::acquireDevice ( )
overridevirtual

acquire data back end device

Returns
bool true if done

Implements pappso::MsRunReader.

Definition at line 1177 of file pwizmsrunreader.cpp.

1178{
1179 if(msp_msData == nullptr)
1180 {
1181 initialize();
1182 }
1183 return true;
1184}
pwiz::msdata::MSDataPtr msp_msData

References initialize(), and msp_msData.

Referenced by MsFileAccessor, readSpectrumCollectionByMsLevel(), readSpectrumCollectionWithMsrunReadConfig(), and spectrumStringIdentifier2SpectrumIndex().

◆ checkNativeId()

void pappso::PwizMsRunReader::checkNativeId ( const pwiz::msdata::Spectrum * pwiz_spectrum_ptr,
MassSpectrumId & mass_spectrum_id ) const
protected

Definition at line 998 of file pwizmsrunreader.cpp.

1000{
1001 QString native_id = QString::fromStdString(pwiz_spectrum_ptr->id);
1002 mass_spectrum_id.setNativeId(native_id);
1003
1004
1005 // qWarning() << "native_id";
1006 if(mcsp_msRunId->getMsDataFormat() == Enums::MsDataFormat::MGF)
1007 {
1008 std::vector<pwiz::data::CVParam>::const_iterator it =
1009 find_if(pwiz_spectrum_ptr->cvParams.cbegin(),
1010 pwiz_spectrum_ptr->cvParams.cend(),
1011 pwiz::data::CVParamIs(pwiz::cv::MS_spectrum_title));
1012 if(it != pwiz_spectrum_ptr->cvParams.cend())
1013 {
1014 mass_spectrum_id.setNativeId(QString::fromStdString(it->value));
1015 // qWarning() << QString::fromStdString(it->value);
1016 }
1017 }
1018}
MsRunIdCstSPtr mcsp_msRunId
@ MGF
Mascot format.
Definition types.h:145

References pappso::MsRunReader::mcsp_msRunId, pappso::Enums::MGF, and pappso::MassSpectrumId::setNativeId().

Referenced by MsFileAccessor, qualifiedMassSpectrumFromPwizMSData(), readSpectrumCollectionByMsLevel(), and readSpectrumCollectionWithMsrunReadConfig().

◆ getMsDataPtr()

const pwiz::msdata::MSDataPtr pappso::PwizMsRunReader::getMsDataPtr ( ) const

Definition at line 171 of file pwizmsrunreader.cpp.

172{
173 return msp_msData;
174}

References msp_msData.

Referenced by MsFileAccessor.

◆ getOboPsiModTermInstrumentModelName()

const pappso::OboPsiModTerm pappso::PwizMsRunReader::getOboPsiModTermInstrumentModelName ( ) const
overrideprotectedvirtual

get OboPsiModTerm corresponding to the instrument model name child of : [Term] id: MS:1000031 name: instrument model def: "Instrument model name not including the vendor's name." [PSI:MS] relationship: part_of MS:1000463 ! instrument

Velos Plus: Thermo Scientific second generation Velos.

LTQ Orbitrap Elite: Thermo Scientific LTQ Orbitrap Elite, often just referred to as the Orbitrap Elite.

Orbitrap Fusion: Thermo Scientific Orbitrap Fusion.

LTQ Orbitrap Elite: Thermo Scientific LTQ Orbitrap Elite, often just referred to as the Orbitrap Elite.

Q Exactive HF: Thermo Scientific Q Exactive.

LTQ Orbitrap Elite: Thermo Scientific LTQ Orbitrap Elite, often just referred to as the Orbitrap Elite.

Exactive Plus: Thermo Scientific Exactive Plus MS.

Q Exactive Plus: Thermo Scientific Q Exactive Plus.

Orbitrap Fusion Lumos: Thermo Scientific Orbitrap Fusion Lumos mass spectrometer with Tribrid architecture consisting of quadrupole mass filter, linear ion trap and Orbitrap mass analyzers.

Q Exactive HF-X: Thermo Scientific Q Exactive HF-X Hybrid Quadrupole Orbitrap MS.

Orbitrap Exploris 480: Thermo Scientific Orbitrap Exploris 480 Quadrupole Orbitrap MS.

Orbitrap Eclipse: Thermo Scientific Orbitrap Eclipse mass spectrometer with Tribrid architecture consisting of quadrupole mass filter, linear ion trap and Orbitrap mass analyzers.

Orbitrap Exploris 240: Thermo Scientific Orbitrap Exploris 240 Quadrupole Orbitrap MS.

Orbitrap Exploris 120: Thermo Scientific Orbitrap Exploris 120 Quadrupole Orbitrap MS.

LTQ Orbitrap Velos Pro: Thermo Scientific LTQ Orbitrap Velos Pro, often just referred to as the Orbitrap Velos Pro.

Q Exactive UHMR: Thermo Scientific Q Exactive UHMR (Ultra High Mass Range) Hybrid Quadrupole Orbitrap MS.

TSQ Altis Plus: Thermo Scientific TSQ Altis Plus Triple Quadrupole MS.

Orbitrap Ascend: Thermo Scientific Orbitrap Ascend mass spectrometer with Tribrid architecture consisting of quadrupole mass filter, linear ion trap and Orbitrap mass analyzers.

Orbitrap Astral: Thermo Scientific Orbitrap Astral mass spectrometer contains three mass analyzers: a quadrupole analyzer, an Orbitrap analyzer, and the Astral analyzer.

Reimplemented from pappso::MsRunReader.

Definition at line 1273 of file pwizmsrunreader.cpp.

1274{
1275
1276
1277 pappso::OboPsiModTerm term;
1278
1279 if(getOboPsiModTermNativeIDFormat().getAccession() == "MS:1000768")
1280 {
1281
1282 pappso::FilterOboPsiModMap psims_map;
1283
1284 pappso::OboPsiMs psims_file(psims_map);
1285 // it should be a Thermo instrument
1286 /*
1287 * [Term]
1288 id: MS:1000494
1289 name: Thermo Scientific instrument model
1290 def: "Thermo Scientific instrument model." [PSI:MS]
1291 is_a: MS:1000483 ! Thermo Fisher Scientific instrument model
1292
1293 */
1294 term = psims_map.getOboPsiModTermWithAccession("MS:1000494");
1295
1296 for(auto &param_group : msp_msData.get()->paramGroupPtrs)
1297 {
1298 for(const auto &cv_param : param_group.get()->cvParams)
1299 {
1300 if(cv_param.cvid == pwiz::cv::CVID::MS_Q_Exactive)
1301 {
1302 term = psims_map.getOboPsiModTermWithAccession("MS:1001911");
1303 }
1304 else if(cv_param.cvid == pwiz::cv::CVID::MS_Velos_Plus)
1305 {
1306 /// Velos Plus: Thermo Scientific second generation Velos.
1307 term = psims_map.getOboPsiModTermWithAccession("MS:1001909");
1308 }
1309 else if(cv_param.cvid == pwiz::cv::CVID::MS_LTQ_Orbitrap_Elite)
1310 {
1311 /// LTQ Orbitrap Elite: Thermo Scientific LTQ Orbitrap Elite, often just referred
1312 /// to as the Orbitrap Elite.
1313
1314 term = psims_map.getOboPsiModTermWithAccession("MS:1001910");
1315 }
1316
1317 /// Orbitrap Fusion: Thermo Scientific Orbitrap Fusion.
1318 else if(cv_param.cvid == pwiz::cv::CVID::MS_Orbitrap_Fusion)
1319 {
1320 /// LTQ Orbitrap Elite: Thermo Scientific LTQ Orbitrap Elite, often just referred
1321 /// to as the Orbitrap Elite.
1322
1323 term = psims_map.getOboPsiModTermWithAccession("MS:1002416");
1324 }
1325 /// Q Exactive HF: Thermo Scientific Q Exactive.
1326 // MS_Q_Exactive_HF = 1002523,
1327 else if(cv_param.cvid == pwiz::cv::CVID::MS_Q_Exactive_HF)
1328 {
1329 /// LTQ Orbitrap Elite: Thermo Scientific LTQ Orbitrap Elite, often just referred
1330 /// to as the Orbitrap Elite.
1331
1332 term = psims_map.getOboPsiModTermWithAccession("MS:1002523");
1333 }
1334 //
1335 /// Exactive Plus: Thermo Scientific Exactive Plus MS.
1336 else if(cv_param.cvid == pwiz::cv::CVID::MS_Exactive_Plus)
1337 {
1338 term = psims_map.getOboPsiModTermWithAccession("MS:1002526");
1339 }
1340 /// Q Exactive Plus: Thermo Scientific Q Exactive Plus.
1341 else if(cv_param.cvid == pwiz::cv::CVID::MS_Q_Exactive_Plus)
1342 {
1343 term = psims_map.getOboPsiModTermWithAccession("MS:1002634");
1344 }
1345 /// Orbitrap Fusion Lumos: Thermo Scientific Orbitrap Fusion Lumos mass spectrometer
1346 /// with Tribrid architecture consisting of quadrupole mass filter, linear ion trap
1347 /// and Orbitrap mass analyzers.
1348 else if(cv_param.cvid == pwiz::cv::CVID::MS_Orbitrap_Fusion_Lumos)
1349 {
1350 term = psims_map.getOboPsiModTermWithAccession("MS:1002732");
1351 }
1352 /// Q Exactive HF-X: Thermo Scientific Q Exactive HF-X Hybrid Quadrupole Orbitrap MS.
1353 else if(cv_param.cvid == pwiz::cv::CVID::MS_Q_Exactive_HF_X)
1354 {
1355 term = psims_map.getOboPsiModTermWithAccession("MS:1002877");
1356 }
1357 /// Orbitrap Exploris 480: Thermo Scientific Orbitrap Exploris 480 Quadrupole Orbitrap
1358 /// MS.
1359
1360 else if(cv_param.cvid == pwiz::cv::CVID::MS_Orbitrap_Exploris_480)
1361 {
1362 term = psims_map.getOboPsiModTermWithAccession("MS:1003028");
1363 }
1364 /// Orbitrap Eclipse: Thermo Scientific Orbitrap Eclipse mass spectrometer with
1365 /// Tribrid architecture consisting of quadrupole mass filter, linear ion trap and
1366 /// Orbitrap mass analyzers.
1367 else if(cv_param.cvid == pwiz::cv::CVID::MS_Orbitrap_Eclipse)
1368 {
1369 term = psims_map.getOboPsiModTermWithAccession("MS:1003029");
1370 }
1371 /// Orbitrap Exploris 240: Thermo Scientific Orbitrap Exploris 240 Quadrupole Orbitrap
1372 /// MS.
1373
1374 else if(cv_param.cvid == pwiz::cv::CVID::MS_Orbitrap_Exploris_240)
1375 {
1376 term = psims_map.getOboPsiModTermWithAccession("MS:1003094");
1377 }
1378 /// Orbitrap Exploris 120: Thermo Scientific Orbitrap Exploris 120 Quadrupole Orbitrap
1379 /// MS.
1380
1381 else if(cv_param.cvid == pwiz::cv::CVID::MS_Orbitrap_Exploris_120)
1382 {
1383 term = psims_map.getOboPsiModTermWithAccession("MS:1003095");
1384 }
1385 /// LTQ Orbitrap Velos Pro: Thermo Scientific LTQ Orbitrap Velos Pro, often just
1386 /// referred to as the Orbitrap Velos Pro.
1387 else if(cv_param.cvid == pwiz::cv::CVID::MS_LTQ_Orbitrap_Velos_Pro)
1388 {
1389 term = psims_map.getOboPsiModTermWithAccession("MS:1003096");
1390 }
1391 /// Q Exactive UHMR: Thermo Scientific Q Exactive UHMR (Ultra High Mass Range) Hybrid
1392 /// Quadrupole Orbitrap MS.
1393 else if(cv_param.cvid == pwiz::cv::CVID::MS_Q_Exactive_UHMR)
1394 {
1395 term = psims_map.getOboPsiModTermWithAccession("MS:1003245");
1396 }
1397 /// TSQ Altis Plus: Thermo Scientific TSQ Altis Plus Triple Quadrupole MS.
1398 else if(cv_param.cvid == pwiz::cv::CVID::MS_TSQ_Altis_Plus)
1399 {
1400 term = psims_map.getOboPsiModTermWithAccession("MS:1003292");
1401 }
1402 /// Orbitrap Ascend: Thermo Scientific Orbitrap Ascend mass spectrometer with Tribrid
1403 /// architecture consisting of quadrupole mass filter, linear ion trap and Orbitrap
1404 /// mass analyzers.
1405 else if(cv_param.cvid == pwiz::cv::CVID::MS_Orbitrap_Ascend)
1406 {
1407 term = psims_map.getOboPsiModTermWithAccession("MS:1003356");
1408 }
1409 /// Orbitrap Astral: Thermo Scientific Orbitrap Astral mass spectrometer contains
1410 /// three mass analyzers: a quadrupole analyzer, an Orbitrap analyzer, and the Astral
1411 /// analyzer.
1412 else if(cv_param.cvid == pwiz::cv::CVID::MS_Orbitrap_Astral)
1413 {
1414 term = psims_map.getOboPsiModTermWithAccession("MS:1003378");
1415 }
1416 }
1417 }
1418 }
1419 else
1420 {
1421
1422 throw ExceptionNotFound(QObject::tr("instrument model name not found in %1")
1423 .arg(mcsp_msRunId.get()->getFileName()));
1424 }
1425
1426 return term;
1427}
const OboPsiModTerm & getOboPsiModTermWithAccession(const QString &accession) const
const OboPsiModTerm getOboPsiModTermNativeIDFormat() const
get OboPsiModTerm corresponding to the nativeID format format of mz data

References getOboPsiModTermNativeIDFormat(), pappso::FilterOboPsiModMap::getOboPsiModTermWithAccession(), pappso::MsRunReader::mcsp_msRunId, and msp_msData.

Referenced by MsFileAccessor.

◆ getOboPsiModTermNativeIDFormat()

const OboPsiModTerm pappso::PwizMsRunReader::getOboPsiModTermNativeIDFormat ( ) const

get OboPsiModTerm corresponding to the nativeID format format of mz data

Definition at line 177 of file pwizmsrunreader.cpp.

178{
179
180 OboPsiModTerm term;
181
182 term.setAccession("MS:1000824");
183 term.m_name = "no nativeID format";
184 term.m_definition =
185 "No nativeID format indicates that the file tagged with this term does "
186 "not "
187 "contain spectra that can have a nativeID format.";
188
189
190 pwiz::cv::CVID cvid = pwiz::msdata::id::getDefaultNativeIDFormat(*(msp_msData.get()));
191
192 switch(cvid)
193 {
194 case pwiz::cv::MS_Thermo_nativeID_format:
195 term.setAccession("MS:1000768");
196 term.m_name = "Thermo nativeID format";
197 term.m_definition =
198 "Native format defined by controllerType=xsd:nonNegativeInteger "
199 "controllerNumber=xsd:positiveInteger scan=xsd:positiveInteger.";
200 break;
201 default:
202 break;
203 }
204 return term;
205}

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

Referenced by getOboPsiModTermInstrumentModelName(), and MsFileAccessor.

◆ getPwizSpectrumPtr()

pwiz::msdata::SpectrumPtr pappso::PwizMsRunReader::getPwizSpectrumPtr ( pwiz::msdata::SpectrumList * p_spectrum_list,
std::size_t spectrum_index,
bool want_binary_data ) const
protected

Definition at line 208 of file pwizmsrunreader.cpp.

211{
212 pwiz::msdata::SpectrumPtr native_pwiz_spectrum_sp;
213
214 try
215 {
216 native_pwiz_spectrum_sp = p_spectrum_list->spectrum(spectrum_index, want_binary_data);
217 }
218 catch(std::runtime_error &error)
219 {
220 // qDebug() << "getPwizSpectrumPtr error " << error.what() << " " << typeid(error).name();
221
222 throw ExceptionNotFound(QObject::tr("Pwiz spectrum index %1 not found in "
223 "MS file std::runtime_error :\n%2")
224 .arg(spectrum_index)
225 .arg(error.what()));
226 }
227 catch(std::exception &error)
228 {
229 // qDebug() << "getPwizSpectrumPtr error " << error.what() << typeid(error).name();
230
231 throw ExceptionNotFound(QObject::tr("Pwiz spectrum index %1 not found in MS file :\n%2")
232 .arg(spectrum_index)
233 .arg(error.what()));
234 }
235
236 if(native_pwiz_spectrum_sp.get() == nullptr)
237 {
238 throw ExceptionNotFound(
239 QObject::tr("Pwiz spectrum index %1 not found in MS file : null pointer")
240 .arg(spectrum_index));
241 }
242
243 return native_pwiz_spectrum_sp;
244}

Referenced by MsFileAccessor, qualifiedMassSpectrumFromPwizMSData(), readSpectrumCollectionByMsLevel(), and readSpectrumCollectionWithMsrunReadConfig().

◆ hasScanNumbers()

bool pappso::PwizMsRunReader::hasScanNumbers ( ) const
overridevirtual

tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided functions can check if scan numbers are available in the current file

Reimplemented from pappso::MsRunReader.

Definition at line 1164 of file pwizmsrunreader.cpp.

1165{
1166 return m_hasScanNumbers;
1167}

References m_hasScanNumbers.

Referenced by MsFileAccessor.

◆ initialize()

void pappso::PwizMsRunReader::initialize ( )
overrideprotectedvirtual

Implements pappso::MsRunReader.

Definition at line 68 of file pwizmsrunreader.cpp.

69{
70 std::string file_name_std = Utils::toUtf8StandardString(mcsp_msRunId->getFileName());
71
72
73 // Now actually search the useful MSDataPtr to the member variable.
74
75 pwiz::msdata::DefaultReaderList defaultReaderList;
76
77 std::vector<pwiz::msdata::MSDataPtr> msDataPtrVector;
78
79 try
80 {
81 defaultReaderList.read(file_name_std, msDataPtrVector);
82 }
83 catch(std::exception &error)
84 {
85 // qDebug() << QString("Failed to read the data from file %1")
86 //.arg(QString::fromStdString(file_name_std));
87
88 throw(PappsoException(QString("Error reading file %1 in PwizMsRunReader, for msrun %2:\n%3")
89 .arg(mcsp_msRunId->getFileName())
90 .arg(mcsp_msRunId.get()->toString())
91 .arg(error.what())));
92 }
93
94 // qDebug() << "The number of runs is:" << msDataPtrVector.size()
95 //<< "The number of spectra in first run is:"
96 //<< msDataPtrVector.at(0)->run.spectrumListPtr->size();
97
98 // Single-run file handling here.
99
100 // Specific case of the MGF data format: we do not have a run id for that
101 // kind of data. In this case there must be a single run!
102
103 if(mcsp_msRunId->getRunId().isEmpty())
104 {
105 if(msDataPtrVector.size() != 1)
106 throw(
107 ExceptionNotPossible("For the kind of file at hand there can only be "
108 "one run in the file."));
109
110 // At this point we know the single msDataPtr is the one we are looking
111 // for.
112
113 msp_msData = msDataPtrVector.front();
114 }
115 else
116 {
117 // Multi-run file handling here.
118 for(const pwiz::msdata::MSDataPtr &msDataPtr : msDataPtrVector)
119 {
120 // qDebug() << "msDataPtr->run.id=" << msDataPtr->run.id.c_str();
121 // qDebug() << "mcsp_msRunId->getRunId()=" << mcsp_msRunId->getRunId();
122 // qDebug() << "mcsp_msRunId->getXmlId()=" << mcsp_msRunId->getXmlId();
123 // qDebug() << "mcsp_msRunId->getSampleName()=" << mcsp_msRunId->getSampleName();
124
125 if(msDataPtr->run.id == mcsp_msRunId->getRunId().toStdString())
126 {
127 msp_msData = msDataPtr;
128
129 // qDebug() << "Found the right MSDataPtr for run id.";
130
131 break;
132 }
133 }
134 }
135
136 if(msp_msData == nullptr)
137 {
138 throw(ExceptionNotPossible(QString("Could not find a pwiz MSDataPtr "
139 "matching the requested run id : %1")
140 .arg(mcsp_msRunId.get()->toString())));
141 }
142
143
144 // check if this MS run can be used with scan numbers
145 // MS:1000490 Agilent instrument model
146 pwiz::cv::CVID native_id_format = pwiz::msdata::id::getDefaultNativeIDFormat(*msp_msData.get());
147
148 // msp_msData.get()->getDefaultNativeIDFormat();
149
150 if(native_id_format == pwiz::cv::CVID::MS_Thermo_nativeID_format)
151 {
152 m_hasScanNumbers = true;
153 }
154 else
155 {
156 m_hasScanNumbers = false;
157 }
158
159 if(mcsp_msRunId.get()->getMsDataFormat() == Enums::MsDataFormat::mzXML)
160 {
161 m_hasScanNumbers = true;
162 }
163}
static std::string toUtf8StandardString(const QString &text)
Definition utils.cpp:166

References m_hasScanNumbers, pappso::MsRunReader::mcsp_msRunId, msp_msData, pappso::Enums::mzXML, and pappso::Utils::toUtf8StandardString().

Referenced by PwizMsRunReader(), acquireDevice(), and MsFileAccessor.

◆ massSpectrumCstSPtr()

pappso::MassSpectrumCstSPtr pappso::PwizMsRunReader::massSpectrumCstSPtr ( std::size_t spectrum_index)
overridevirtual

Implements pappso::MsRunReader.

Definition at line 799 of file pwizmsrunreader.cpp.

800{
801 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
802 return qualifiedMassSpectrum(spectrum_index, true).getMassSpectrumCstSPtr();
803}
virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data=true) const override
get a QualifiedMassSpectrum class given its scan number
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.

References pappso::QualifiedMassSpectrum::getMassSpectrumCstSPtr(), and qualifiedMassSpectrum().

Referenced by MsFileAccessor.

◆ massSpectrumSPtr()

pappso::MassSpectrumSPtr pappso::PwizMsRunReader::massSpectrumSPtr ( std::size_t spectrum_index)
overridevirtual

get a MassSpectrumSPtr class given its spectrum index

Implements pappso::MsRunReader.

Definition at line 792 of file pwizmsrunreader.cpp.

793{
794 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
795 return qualifiedMassSpectrum(spectrum_index, true).getMassSpectrumSPtr();
796}
MassSpectrumSPtr getMassSpectrumSPtr() const
Get the MassSpectrumSPtr.

References pappso::QualifiedMassSpectrum::getMassSpectrumSPtr(), and qualifiedMassSpectrum().

Referenced by MsFileAccessor.

◆ newXicCoordSPtrFromQualifiedMassSpectrum()

XicCoordSPtr pappso::PwizMsRunReader::newXicCoordSPtrFromQualifiedMassSpectrum ( const pappso::QualifiedMassSpectrum & mass_spectrum,
pappso::PrecisionPtr precision ) const
overridevirtual

get a xic coordinate object from a given spectrum

Implements pappso::MsRunReader.

Definition at line 1198 of file pwizmsrunreader.cpp.

1200{
1201 XicCoordSPtr xic_coord = std::make_shared<XicCoord>();
1202
1203 xic_coord.get()->rtTarget = mass_spectrum.getRtInSeconds();
1204
1205 xic_coord.get()->mzRange = MzRange(mass_spectrum.getPrecursorMz(), precision);
1206
1207 return xic_coord;
1208}
pappso_double getPrecursorMz(bool *ok=nullptr) const
get precursor mz
pappso_double getRtInSeconds() const
Get the retention time in seconds.
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44

References pappso::QualifiedMassSpectrum::getPrecursorMz(), and pappso::QualifiedMassSpectrum::getRtInSeconds().

Referenced by MsFileAccessor, and newXicCoordSPtrFromSpectrumIndex().

◆ newXicCoordSPtrFromSpectrumIndex()

XicCoordSPtr pappso::PwizMsRunReader::newXicCoordSPtrFromSpectrumIndex ( std::size_t spectrum_index,
pappso::PrecisionPtr precision ) const
overridevirtual

get a xic coordinate object from a given spectrum index

Implements pappso::MsRunReader.

Definition at line 1188 of file pwizmsrunreader.cpp.

1190{
1191
1192 QualifiedMassSpectrum mass_spectrum = qualifiedMassSpectrum(spectrum_index, false);
1193
1194 return newXicCoordSPtrFromQualifiedMassSpectrum(mass_spectrum, precision);
1195}
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum

References newXicCoordSPtrFromQualifiedMassSpectrum(), and qualifiedMassSpectrum().

Referenced by MsFileAccessor.

◆ processDriftTime()

bool pappso::PwizMsRunReader::processDriftTime ( pwiz::msdata::Spectrum * spectrum_p,
QualifiedMassSpectrum & qualified_mass_spectrum ) const
protected

Definition at line 311 of file pwizmsrunreader.cpp.

313{
314 // Not all the acquisitions have ion mobility data. We need to test
315 // that:
316
317 if(spectrum_p->scanList.scans[0].hasCVParam(pwiz::msdata::MS_ion_mobility_drift_time))
318 {
319
320 // qDebug() << "as strings:"
321 //<< QString::fromStdString(
322 // spectrum_p->scanList.scans[0]
323 //.cvParam(pwiz::msdata::MS_ion_mobility_drift_time)
324 //.valueAs<std::string>());
325
326 pappso_double driftTime = spectrum_p->scanList.scans[0]
327 .cvParam(pwiz::msdata::MS_ion_mobility_drift_time)
328 .valueAs<double>();
329
330 // qDebug() << "driftTime:" << driftTime;
331
332 // Old version requiring use of QString.
333 // pappso_double driftTime =
334 // QString(spectrum_p->scanList.scans[0]
335 //.cvParam(pwiz::msdata::MS_ion_mobility_drift_time)
336 //.value.c_str())
337 //.toDouble();
338
339 // Now make positively sure that the obtained value is correct.
340 // Note that I suffered a lot with Waters Synapt data that
341 // contained apparently correct drift time XML element that in
342 // fact contained either NaN or inf. When such mass spectra were
343 // encountered, the mz,i data were bogus and crashed the data
344 // loading functions. We just want to skip this kind of bogus mass
345 // spectrum by letting the caller know that the drift time was
346 // bogus ("I" is Filippo Rusconi).
347
348 if(std::isnan(driftTime) || std::isinf(driftTime))
349 {
350 // qDebug() << "detected as nan or inf.";
351
352 return false;
353 }
354 else
355 {
356 // The mzML standard stipulates that drift times are in
357 // milliseconds.
358 qualified_mass_spectrum.setDtInMilliSeconds(driftTime);
359 }
360 }
361 // End of
362 // if(spectrum_p->scanList.scans[0].hasCVParam(
363 // pwiz::msdata::MS_ion_mobility_drift_time))
364 else
365 {
366 // Not a bogus mass spectrum but also not a drift spectrum, set -1
367 // as the drift time value.
368 qualified_mass_spectrum.setDtInMilliSeconds(-1);
369 }
370
371 return true;
372}
double pappso_double
A type definition for doubles.
Definition types.h:60

References pappso::QualifiedMassSpectrum::setDtInMilliSeconds().

Referenced by MsFileAccessor, and qualifiedMassSpectrumFromPwizSpectrumPtr().

◆ processRetentionTime()

bool pappso::PwizMsRunReader::processRetentionTime ( pwiz::msdata::Spectrum * spectrum_p,
QualifiedMassSpectrum & qualified_mass_spectrum ) const
protected

Definition at line 248 of file pwizmsrunreader.cpp.

250{
251
252 // We now have to set the retention time at which this mass spectrum
253 // was acquired. This is the scan start time.
254
255 if(!spectrum_p->scanList.scans[0].hasCVParam(pwiz::msdata::MS_scan_start_time))
256 {
257 if(mcsp_msRunId.get()->getMsDataFormat() == Enums::MsDataFormat::MGF)
258 { // MGF could not have scan start time
259 qualified_mass_spectrum.setRtInSeconds(-1);
260 }
261 else
262 {
263 throw(ExceptionNotPossible("The spectrum has no scan start time value set."));
264 }
265 }
266 else
267 {
268 pwiz::data::CVParam retention_time_cv_param =
269 spectrum_p->scanList.scans[0].cvParam(pwiz::msdata::MS_scan_start_time);
270
271 // Try to get the units of the retention time value.
272
273 std::string unit_name = retention_time_cv_param.unitsName();
274 // qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"
275 //<< "Unit name for the retention time:"
276 //<< QString::fromStdString(unit_name);
277
278 if(unit_name == "second")
279 {
280 qualified_mass_spectrum.setRtInSeconds(retention_time_cv_param.valueAs<double>());
281 }
282 else if(unit_name == "minute")
283 {
284 qualified_mass_spectrum.setRtInSeconds(retention_time_cv_param.valueAs<double>() * 60);
285 }
286 else
287 throw(
288 ExceptionNotPossible("Could not determine the unit for the "
289 "scan start time value."));
290 }
291
292 // qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"
293 //<< "Retention time for spectrum is:"
294 //<< qualified_mass_spectrum.getRtInSeconds();
295
296 // Old version not checking unit (by default unit is minutes for RT,
297 // not seconds)
298 //
299 // pappso_double retentionTime =
300 // QString(spectrum_p->scanList.scans[0]
301 //.cvParam(pwiz::msdata::MS_scan_start_time)
302 //.value.c_str())
303 //.toDouble();
304 // qualified_mass_spectrum.setRtInSeconds(retentionTime);
305
306 return true;
307}

References pappso::MsRunReader::mcsp_msRunId, pappso::Enums::MGF, and pappso::QualifiedMassSpectrum::setRtInSeconds().

Referenced by MsFileAccessor, and qualifiedMassSpectrumFromPwizSpectrumPtr().

◆ qualifiedMassSpectrum()

QualifiedMassSpectrum pappso::PwizMsRunReader::qualifiedMassSpectrum ( std::size_t spectrum_index,
bool want_binary_data = true ) const
overridevirtual

get a QualifiedMassSpectrum class given its scan number

Implements pappso::MsRunReader.

Definition at line 806 of file pwizmsrunreader.cpp.

807{
808
809 QualifiedMassSpectrum spectrum;
810 bool ok = false;
811
812 spectrum = qualifiedMassSpectrumFromPwizMSData(spectrum_index, want_binary_data, ok);
813
814 if(mcsp_msRunId->getMsDataFormat() == Enums::MsDataFormat::MGF)
815 {
816 if(spectrum.getRtInSeconds() == 0)
817 {
818 // spectrum = qualifiedMassSpectrumFromPwizMSData(scan_num - 1);
819 }
820 }
821
822 // if(!ok)
823 // qDebug() << "Encountered a mass spectrum for which the status is bad.";
824
825 return spectrum;
826}
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizMSData(std::size_t spectrum_index, bool want_binary_data, bool &ok) const

References pappso::QualifiedMassSpectrum::getRtInSeconds(), pappso::MsRunReader::mcsp_msRunId, pappso::Enums::MGF, and qualifiedMassSpectrumFromPwizMSData().

Referenced by massSpectrumCstSPtr(), massSpectrumSPtr(), MsFileAccessor, and newXicCoordSPtrFromSpectrumIndex().

◆ qualifiedMassSpectrumFromPwizMSData()

QualifiedMassSpectrum pappso::PwizMsRunReader::qualifiedMassSpectrumFromPwizMSData ( std::size_t spectrum_index,
bool want_binary_data,
bool & ok ) const
protected

Definition at line 732 of file pwizmsrunreader.cpp.

735{
736
737 std::string backup_env = setGlobalLocaleToEnglish();
738
739 MassSpectrumId massSpectrumId(mcsp_msRunId);
740
741 if(msp_msData == nullptr)
742 {
743 setGlobalLocaleToCurrentOs(backup_env);
744 return (QualifiedMassSpectrum(massSpectrumId));
745 }
746
747 // const bool want_binary_data = true;
748
749 pwiz::msdata::SpectrumListPtr spectrum_list_p = msp_msData->run.spectrumListPtr;
750
751 if(spectrum_index == spectrum_list_p.get()->size())
752 {
753 setGlobalLocaleToCurrentOs(backup_env);
754 throw ExceptionNotFound(
755 QObject::tr("The spectrum index cannot be equal to the size of the "
756 "spectrum list."));
757 }
758
759 // At this point we know the spectrum index might be sane, so store it in
760 // the mass spec id object.
761 massSpectrumId.setSpectrumIndex(spectrum_index);
762
763 pwiz::msdata::SpectrumPtr native_pwiz_spectrum_sp =
764 getPwizSpectrumPtr(spectrum_list_p.get(), spectrum_index, want_binary_data);
765
766 setGlobalLocaleToCurrentOs(backup_env);
767
768 checkNativeId(native_pwiz_spectrum_sp.get(), massSpectrumId);
769
770
772 massSpectrumId, native_pwiz_spectrum_sp.get(), want_binary_data, ok);
773}
static std::string setGlobalLocaleToEnglish()
void checkNativeId(const pwiz::msdata::Spectrum *pwiz_spectrum_ptr, MassSpectrumId &mass_spectrum_id) const
static void setGlobalLocaleToCurrentOs(const std::string &environment_locale)
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizSpectrumPtr(const MassSpectrumId &massSpectrumId, pwiz::msdata::Spectrum *spectrum_p, bool want_binary_data, bool &ok) const
pwiz::msdata::SpectrumPtr getPwizSpectrumPtr(pwiz::msdata::SpectrumList *p_spectrum_list, std::size_t spectrum_index, bool want_binary_data) const

References checkNativeId(), getPwizSpectrumPtr(), pappso::MsRunReader::mcsp_msRunId, msp_msData, qualifiedMassSpectrumFromPwizSpectrumPtr(), setGlobalLocaleToCurrentOs(), setGlobalLocaleToEnglish(), and pappso::MassSpectrumId::setSpectrumIndex().

Referenced by MsFileAccessor, and qualifiedMassSpectrum().

◆ qualifiedMassSpectrumFromPwizSpectrumPtr()

QualifiedMassSpectrum pappso::PwizMsRunReader::qualifiedMassSpectrumFromPwizSpectrumPtr ( const MassSpectrumId & massSpectrumId,
pwiz::msdata::Spectrum * spectrum_p,
bool want_binary_data,
bool & ok ) const
protected

Definition at line 376 of file pwizmsrunreader.cpp.

380{
381 // qDebug();
382
383 if(spectrum_p == nullptr)
384 qFatal("Spectrum pointer cannot be nullptr.");
385
386 std::string backup_env = setGlobalLocaleToEnglish();
387
388 QualifiedMassSpectrum qualified_mass_spectrum(massSpectrumId);
389
390 try
391 {
392
393 // We want to store the ms level for this spectrum
394
395 int msLevel = (spectrum_p->cvParam(pwiz::msdata::MS_ms_level).valueAs<int>());
396
397 qualified_mass_spectrum.setMsLevel(msLevel);
398
399 if(!spectrum_p->scanList.scans[0].hasCVParam(pwiz::msdata::MS_peak_list_scans))
400 {
401
402 // qDebug() << spectrum_p->cvParam(pwiz::msdata::MS_peak_list_scans)
403 // .valueAs<double>();
404 qualified_mass_spectrum.setParameterValue(
406 spectrum_p->cvParam(pwiz::msdata::MS_peak_list_scans).valueAs<double>());
407 }
408 // We want to know if this spectrum is a fragmentation spectrum obtained
409 // from a selected precursor ion.
410
411 std::size_t precursor_list_size = spectrum_p->precursors.size();
412
413 // qDebug() << "For spectrum at index:" <<
414 // massSpectrumId.getSpectrumIndex()
415 //<< "msLevel:" << msLevel
416 //<< "with number of precursors:" << precursor_list_size;
417
418 if(precursor_list_size > 0)
419 {
420
421 // Sanity check
422 if(msLevel < 2)
423 {
424 // qDebug() << "Going to throw: msLevel cannot be less than two for "
425 //"a spectrum that has items in its Precursor list.";
426
427 throw(
428 ExceptionNotPossible("msLevel cannot be less than two for "
429 "a spectrum that has items in its Precursor list."));
430 }
431
432 // See what is the first precursor in the list.
433
434 for(auto &precursor : spectrum_p->precursors)
435 {
436
437 // Set this variable ready as we need that default value in
438 // certain circumstances.
439
440 std::size_t precursor_spectrum_index = std::numeric_limits<std::size_t>::max();
441
442 // The spectrum ID of the precursor might be empty.
443
444 if(precursor.spectrumID.empty())
445 {
446 // qDebug() << "The precursor's spectrum ID is empty.";
447
448 if(mcsp_msRunId.get()->getMsDataFormat() == Enums::MsDataFormat::MGF)
449 {
450 // qDebug()
451 //<< "Format is MGF, precursor's spectrum ID can be
452 // empty.";
453 }
454 else
455 {
456 // When performing Lumos Fusion fragmentation
457 // experiments in Tune mode and with recording, the
458 // first spectrum of the list is a fragmentation
459 // spectrum (ms level 2) that has no identity for the
460 // precursor spectrum because there is no full scan
461 // accquisition.
462 }
463 }
464 // End of
465 // if(precursor.spectrumID.empty())
466 else
467 {
468 // We could get a native precursor spectrum id, so convert
469 // that native id to a spectrum index.
470
471 qualified_mass_spectrum.setPrecursorNativeId(
472 QString::fromStdString(precursor.spectrumID));
473
474 if(qualified_mass_spectrum.getPrecursorNativeId().isEmpty())
475 {
476 // qDebug() << "The native id of the precursor spectrum
477 // is empty.";
478 }
479
480 // Get the spectrum index of the spectrum that contained
481 // the precursor ion.
482
483 precursor_spectrum_index =
484 msp_msData->run.spectrumListPtr->find(precursor.spectrumID);
485
486 // Note that the Mascot MGF format has a peculiar handling
487 // of the precursor ion stuff so we cannot throw.
488 if(precursor_spectrum_index == msp_msData->run.spectrumListPtr->size())
489 {
490 if(mcsp_msRunId.get()->getMsDataFormat() != Enums::MsDataFormat::MGF)
491 {
492 throw(
493 ExceptionNotPossible("Failed to find the index of the "
494 "precursor ion's spectrum."));
495 }
496 }
497
498 qualified_mass_spectrum.setPrecursorSpectrumIndex(precursor_spectrum_index);
499
500 // qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__
501 // <<
502 // "()"
503 //<< "Set the precursor spectrum index to:"
504 //<< qualified_mass_spectrum.getPrecursorSpectrumIndex()
505 //<< "for qualified mass spectrum:"
506 //<< &qualified_mass_spectrum;
507 }
508
509 // *****************************************************
510 // get isolation window (very simplified)
511 // *****************************************************
512 auto pwiz_cv_param =
513 precursor.isolationWindow.cvParam(pwiz::cv::MS_isolation_window_target_m_z);
514 if(pwiz_cv_param != pwiz::cv::CVID_Unknown)
515 {
516 double isolation_mz = QString(pwiz_cv_param.value.c_str()).toDouble();
517
518 qualified_mass_spectrum.setParameterValue(
520
521 double isolation_mz_width =
522 QString(
523 precursor.isolationWindow.cvParam(pwiz::cv::MS_isolation_window_lower_offset)
524 .value.c_str())
525 .toDouble();
526 qualified_mass_spectrum.setParameterValue(
528 isolation_mz_width =
529 QString(
530 precursor.isolationWindow.cvParam(pwiz::cv::MS_isolation_window_upper_offset)
531 .value.c_str())
532 .toDouble();
533 qualified_mass_spectrum.setParameterValue(
535
536 // /// isolation window target m/z: The primary or reference m/z about which the
537 // isolation window is defined. MS_isolation_window_target_m_z = 1000827,
538
539 // /// isolation window lower offset: The extent of the isolation window in m/z
540 // below the isolation window target m/z. The lower and upper offsets may be
541 // asymmetric about the target m/z. MS_isolation_window_lower_offset = 1000828,
542
543 // /// isolation window upper offset: The extent of the isolation window in m/z
544 // above the isolation window target m/z. The lower and upper offsets may be
545 // asymmetric about the target m/z. MS_isolation_window_upper_offset = 1000829,
546 }
547 // *****************************************************
548 // end get isolation window (very simplified)
549 // *****************************************************
550
551 if(!precursor.selectedIons.size())
552 {
553 // qDebug() << "Going to throw The spectrum has msLevel > 1 but the "
554 //"precursor ions's selected ions list is empty..";
555
556 throw(
557 ExceptionNotPossible("The spectrum has msLevel > 1 but the "
558 "precursor ions's selected ions "
559 "list is empty."));
560 }
561
562 pwiz::msdata::SelectedIon &ion = *(precursor.selectedIons.begin());
563
564 // selected ion m/z
565
566 pappso_double selected_ion_mz =
567 QString(ion.cvParam(pwiz::cv::MS_selected_ion_m_z).value.c_str()).toDouble();
568
569 // selected ion peak intensity
570 //<cvParam cvRef="MS" accession="MS:1000042"
571 // value="910663.949707031" name="peak intensity"
572 // unitAccession="MS:1000131" unitName="number of detector
573 // counts" unitCvRef="MS" />
574
575 pappso_double selected_ion_peak_intensity =
576 QString(ion.cvParam(pwiz::cv::MS_peak_intensity).value.c_str()).toDouble();
577
578 // charge state
579
580 unsigned int selected_ion_charge_state =
581 QString(ion.cvParam(pwiz::cv::MS_charge_state).value.c_str()).toUInt();
582
583 // At this point we can craft a new PrecursorIonData instance
584 // and push it back to the vector.
585
586 PrecursorIonData precursor_ion_data(
587 selected_ion_mz, selected_ion_charge_state, selected_ion_peak_intensity);
588
589 qualified_mass_spectrum.appendPrecursorIonData(precursor_ion_data);
590
591 // General sum-up
592
593 // qDebug()
594 //<< "Appended new PrecursorIonData:"
595 //<< "mz:"
596 //<< qualified_mass_spectrum.getPrecursorIonData().back().mz
597 //<< "charge:"
598 //<< qualified_mass_spectrum.getPrecursorIonData().back().charge
599 //<< "intensity:"
600 //<< qualified_mass_spectrum.getPrecursorIonData()
601 //.back()
602 //.intensity;
603 }
604 // End of
605 // for(auto &precursor : spectrum_p->precursors)
606 }
607 // End of
608 // if(precursor_list_size > 0)
609 else
610 {
611 // Sanity check
612
613 // Unfortunately, logic here is defeated by some vendors that have
614 // files with MS2 spectra without <precursorList>. Thus we have
615 // spectrum_p->precursors.size() == 0 and msLevel > 1.
616
617 // if(msLevel != 1)
618 //{
619 // throw(
620 // ExceptionNotPossible("msLevel cannot be different than 1 if "
621 //"there is not a single precursor ion."));
622 //}
623 }
624
625 // Sanity check.
626
627 if(precursor_list_size != qualified_mass_spectrum.getPrecursorIonData().size())
628 {
629 // qDebug() << "Going to throw The number of precursors in the file is "
630 //"different from the number of precursors in memory.";
631
632 throw pappso::PappsoException(
633 QObject::tr("The number of precursors in the file is different "
634 "from the number of precursors in memory."));
635 }
636
637 // if(precursor_list_size == 1)
638 //{
639 // qDebug() << "Trying to get the mz value of the unique precursor ion:"
640 //<< qualified_mass_spectrum.getPrecursorMz();
641 //}
642
643 processRetentionTime(spectrum_p, qualified_mass_spectrum);
644
645 processDriftTime(spectrum_p, qualified_mass_spectrum);
646
647 // for(pwiz::data::CVParam cv_param : ion.cvParams)
648 //{
649 // pwiz::msdata::CVID param_id = cv_param.cvid;
650 // qDebug() << param_id;
651 // qDebug() << cv_param.cvid.c_str();
652 // qDebug() << cv_param.name().c_str();
653 // qDebug() << cv_param.value.c_str();
654 //}
655
656 if(want_binary_data)
657 {
658
659 // Fill-in MZIntensityPair vector for convenient access to binary
660 // data
661
662 std::vector<pwiz::msdata::MZIntensityPair> pairs;
663 spectrum_p->getMZIntensityPairs(pairs);
664
665 MassSpectrum spectrum;
666 // double tic = 0;
667 // std::size_t iterCount = 0;
668
669 // Iterate through the m/z-intensity pairs
670 for(std::vector<pwiz::msdata::MZIntensityPair>::const_iterator it = pairs.begin(),
671 end = pairs.end();
672 it != end;
673 ++it)
674 {
675 //++iterCount;
676
677 // qDebug() << "it->mz " << it->mz << " it->intensity" <<
678 // it->intensity;
679 if(it->intensity)
680 {
681 spectrum.push_back(DataPoint(it->mz, it->intensity));
682 // tic += it->intensity;
683 }
684 }
685
686 if(mcsp_msRunId.get()->getMsDataFormat() == Enums::MsDataFormat::MGF)
687 {
688 // Sort peaks by mz
689 spectrum.sortMz();
690 }
691
692 // qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()
693 // "<< spectrum.size();
694 MassSpectrumSPtr spectrum_sp = spectrum.makeMassSpectrumSPtr();
695 qualified_mass_spectrum.setMassSpectrumSPtr(spectrum_sp);
696
697 // double sumY =
698 // qualified_mass_spectrum.getMassSpectrumSPtr()->sumY(); qDebug()
699 // <<
700 // __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"
701 //<< "iterCount:" << iterCount << "Spectrum size "
702 //<< spectrum.size() << "with tic:" << tic
703 //<< "and sumY:" << sumY;
704 }
705 else
706 qualified_mass_spectrum.setMassSpectrumSPtr(nullptr);
707 }
708 catch(PappsoException &errorp)
709 {
710 // qDebug() << "Going to throw";
711
712 throw pappso::PappsoException(
713 QObject::tr("Error reading data using the proteowizard library: %1").arg(errorp.qwhat()));
714 }
715 catch(std::exception &error)
716 {
717 // qDebug() << "Going to throw";
718
719 throw pappso::PappsoException(
720 QObject::tr("Error reading data using the proteowizard library: %1").arg(error.what()));
721 }
722
723 ok = true;
724
725 // qDebug() << "QualifiedMassSpectrum: " <<
726 // qualified_mass_spectrum.toString();
727 return qualified_mass_spectrum;
728}
bool processDriftTime(pwiz::msdata::Spectrum *spectrum_p, QualifiedMassSpectrum &qualified_mass_spectrum) const
bool processRetentionTime(pwiz::msdata::Spectrum *spectrum_p, QualifiedMassSpectrum &qualified_mass_spectrum) const
@ IsolationWindowTargetMz
Isolation m/z value isolation window target m/z (thomson).
@ IsolationWindowUpperOffset
isolation window upper offset (thomson)
@ IsolationWindowLowerOffset
isolation window lower offset (thomson)
std::shared_ptr< MassSpectrum > MassSpectrumSPtr

References pappso::QualifiedMassSpectrum::appendPrecursorIonData(), pappso::QualifiedMassSpectrum::getPrecursorIonData(), pappso::QualifiedMassSpectrum::getPrecursorNativeId(), pappso::IsolationWindowLowerOffset, pappso::IsolationWindowTargetMz, pappso::IsolationWindowUpperOffset, pappso::MassSpectrum::makeMassSpectrumSPtr(), pappso::MsRunReader::mcsp_msRunId, pappso::Enums::MGF, msp_msData, processDriftTime(), processRetentionTime(), pappso::PappsoException::qwhat(), pappso::ScanNumber, setGlobalLocaleToEnglish(), pappso::QualifiedMassSpectrum::setMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::setMsLevel(), pappso::QualifiedMassSpectrum::setParameterValue(), pappso::QualifiedMassSpectrum::setPrecursorNativeId(), pappso::QualifiedMassSpectrum::setPrecursorSpectrumIndex(), and pappso::MassSpectrum::sortMz().

Referenced by MsFileAccessor, qualifiedMassSpectrumFromPwizMSData(), readSpectrumCollectionByMsLevel(), and readSpectrumCollectionWithMsrunReadConfig().

◆ readSpectrumCollection()

void pappso::PwizMsRunReader::readSpectrumCollection ( SpectrumCollectionHandlerInterface & handler)
overridevirtual

function to visit an MsRunReader and get each Spectrum in a spectrum collection handler

Implements pappso::MsRunReader.

Definition at line 830 of file pwizmsrunreader.cpp.

831{
832 try
833 {
835 }
836 catch(std::exception &error)
837 {
838 // qDebug() << "Going to throw";
839
840 throw pappso::PappsoException(
841 QObject::tr("Error reading data (spectrum collection) using the "
842 "proteowizard library: %1")
843 .arg(error.what()));
844 }
845}
virtual void readSpectrumCollectionByMsLevel(SpectrumCollectionHandlerInterface &handler, unsigned int ms_level) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels

References readSpectrumCollectionByMsLevel().

Referenced by MsFileAccessor.

◆ readSpectrumCollection2()

void pappso::PwizMsRunReader::readSpectrumCollection2 ( const MsRunReadConfig & config,
SpectrumCollectionHandlerInterface & handler )
overridevirtual

function to visit an MsRunReader and get each Spectrum in a spectrum collection handler

Implements pappso::MsRunReader.

Definition at line 848 of file pwizmsrunreader.cpp.

850{
851 // qDebug();
852 try
853 {
855 }
856 catch(std::exception &error)
857 {
858 // qDebug() << "Going to throw";
859
860 throw pappso::PappsoException(
861 QObject::tr("Error reading data (spectrum collection2) using the "
862 "proteowizard library: %1")
863 .arg(error.what()));
864 }
865}
virtual void readSpectrumCollectionWithMsrunReadConfig(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler)

References readSpectrumCollectionWithMsrunReadConfig().

Referenced by MsFileAccessor.

◆ readSpectrumCollectionByMsLevel()

void pappso::PwizMsRunReader::readSpectrumCollectionByMsLevel ( SpectrumCollectionHandlerInterface & handler,
unsigned int ms_level )
overridevirtual

function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels

Implements pappso::MsRunReader.

Definition at line 868 of file pwizmsrunreader.cpp.

870{
871
873 // qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()";
874
875 // We want to iterate in the pwiz-spectrum-list and for each pwiz-spectrum
876 // create a pappso-spectrum (QualifiedMassSpectrum). Once the pappso mass
877 // spectrum has been fully qualified (that is, the member data have been
878 // set), it is transferred to the handler passed as parameter to this
879 // function for the consumer to do what it wants with it.
880
881 // Does the handler consuming the mass spectra read from file want these
882 // mass spectra to hold the binary data arrays (mz/i vectors)?
883
884 const bool want_binary_data = handler.needPeakList();
885
886 std::string backup_env = setGlobalLocaleToEnglish();
887
888 // We access the pwiz-mass-spectra via the spectrumListPtr that sits in the
889 // run member of msp_msData.
890
891 pwiz::msdata::SpectrumListPtr spectrum_list_p = msp_msData->run.spectrumListPtr;
892
893 // We'll need it to perform the looping in the spectrum list.
894 std::size_t spectrum_list_size = spectrum_list_p.get()->size();
895
896 // qDebug() << "The spectrum list has size:" << spectrum_list_size;
897
898 // Inform the handler of the spectrum list so that it can handle feedback to
899 // the user.
900 handler.spectrumListHasSize(spectrum_list_size);
901
902 // Iterate in the full list of spectra.
903
904 for(std::size_t iter = 0; iter < spectrum_list_size; iter++)
905 {
906
907 // If the user of this reader instance wants to stop reading the
908 // spectra, then break this loop.
909 if(handler.shouldStop())
910 {
911 // qDebug() << "The operation was cancelled. Breaking the loop.";
912 break;
913 }
914
915 // Get the native pwiz-spectrum from the spectrum list.
916 // Note that this pointer is a shared pointer from pwiz.
917
918 pwiz::msdata::SpectrumPtr native_pwiz_spectrum_sp =
919 getPwizSpectrumPtr(spectrum_list_p.get(), iter, want_binary_data);
920 /*
921 * we want to load metadata of the spectrum even if it does not contain
922 peaks
923
924 * if(!native_pwiz_spectrum_sp->hasBinaryData())
925 {
926 // qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ <<
927 "
928 ()"
929 //<< "native pwiz spectrum is empty, continuing.";
930 continue;
931 }
932 */
933
934 // Instantiate the mass spectrum id that will hold critical information
935 // like the the native id string and the spectrum index.
936
937 MassSpectrumId massSpectrumId(mcsp_msRunId, iter /* spectrum index*/);
938
939 // Get the spectrum native id as a QString to store it in the mass
940 // spectrum id class. This is will allow later to refer to the same
941 // spectrum starting back from the file.
942
943 checkNativeId(native_pwiz_spectrum_sp.get(), massSpectrumId);
944
945 // Finally, instantiate the qualified mass spectrum with its id. This
946 // function will continue performing pappso-spectrum detailed
947 // qualification.
948
949 bool ok = false;
950
951 QualifiedMassSpectrum qualified_mass_spectrum = qualifiedMassSpectrumFromPwizSpectrumPtr(
952 massSpectrumId, native_pwiz_spectrum_sp.get(), want_binary_data, ok);
953
954 if(!ok)
955 {
956 // qDebug() << "Encountered a mass spectrum for which the returned "
957 //"status is bad.";
958 continue;
959 }
960
961 // Before handing the mass spectrum out to the handler, see if the
962 // native mass spectrum was empty or not.
963
964 // if(!native_pwiz_spectrum_sp->defaultArrayLength)
965 // qDebug() << "The mass spectrum has not defaultArrayLength";
966
967 qualified_mass_spectrum.setEmptyMassSpectrum(!native_pwiz_spectrum_sp->defaultArrayLength);
968
969 // The handler will receive the index of the mass spectrum in the
970 // current run via the mass spectrum id member datum.
971 if(ms_level == 0)
972 {
973 handler.setQualifiedMassSpectrum(qualified_mass_spectrum);
974 }
975 else
976 {
977 if(qualified_mass_spectrum.getMsLevel() == ms_level)
978 {
979 handler.setQualifiedMassSpectrum(qualified_mass_spectrum);
980 }
981 }
982 }
983
984 setGlobalLocaleToCurrentOs(backup_env);
985 // End of
986 // for(std::size_t iter = 0; iter < spectrum_list_size; iter++)
987
988 // Now let the loading handler know that the loading of the data has ended.
989 // The handler might need this "signal" to perform additional tasks or to
990 // cleanup cruft.
991
992 // qDebug() << "Loading ended";
993 handler.loadingEnded();
994}
virtual bool acquireDevice() override
acquire data back end device

References acquireDevice(), checkNativeId(), pappso::QualifiedMassSpectrum::getMsLevel(), getPwizSpectrumPtr(), pappso::SpectrumCollectionHandlerInterface::loadingEnded(), pappso::MsRunReader::mcsp_msRunId, msp_msData, pappso::SpectrumCollectionHandlerInterface::needPeakList(), qualifiedMassSpectrumFromPwizSpectrumPtr(), pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), setGlobalLocaleToCurrentOs(), setGlobalLocaleToEnglish(), pappso::SpectrumCollectionHandlerInterface::setQualifiedMassSpectrum(), pappso::SpectrumCollectionHandlerInterface::shouldStop(), and pappso::SpectrumCollectionHandlerInterface::spectrumListHasSize().

Referenced by MsFileAccessor, and readSpectrumCollection().

◆ readSpectrumCollectionWithMsrunReadConfig()

void pappso::PwizMsRunReader::readSpectrumCollectionWithMsrunReadConfig ( const MsRunReadConfig & config,
SpectrumCollectionHandlerInterface & handler )
protectedvirtual

Definition at line 1021 of file pwizmsrunreader.cpp.

1023{
1024 acquireDevice();
1025 // qDebug();
1026
1027 // We want to iterate in the pwiz-spectrum-list and for each pwiz-spectrum
1028 // create a pappso-spectrum (QualifiedMassSpectrum). Once the pappso mass
1029 // spectrum has been fully qualified (that is, the member data have been
1030 // set), it is transferred to the handler passed as parameter to this
1031 // function for the consumer to do what it wants with it.
1032
1033 // Does the handler consuming the mass spectra read from file want these
1034 // mass spectra to hold the binary data arrays (mz/i vectors)?
1035
1036 const bool want_binary_data = config.needPeakList();
1037
1038
1039 std::string backup_env = setGlobalLocaleToEnglish();
1040
1041 // qDebug();
1042 // We access the pwiz-mass-spectra via the spectrumListPtr that sits in the
1043 // run member of msp_msData.
1044
1045 pwiz::msdata::SpectrumListPtr spectrum_list_p = msp_msData->run.spectrumListPtr;
1046
1047 // We'll need it to perform the looping in the spectrum list.
1048 std::size_t spectrum_list_size = spectrum_list_p.get()->size();
1049
1050 // qDebug() << "The spectrum list has size:" << spectrum_list_size;
1051
1052 // Inform the handler of the spectrum list so that it can handle feedback to
1053 // the user.
1054 handler.spectrumListHasSize(spectrum_list_size);
1055
1056 // Iterate in the full list of spectra.
1057
1058 // qDebug();
1059 for(std::size_t iter = 0; iter < spectrum_list_size; iter++)
1060 {
1061
1062
1063 // If the user of this reader instance wants to stop reading the
1064 // spectra, then break this loop.
1065 if(handler.shouldStop())
1066 {
1067 // qDebug() << "The operation was cancelled. Breaking the loop.";
1068 break;
1069 }
1070
1071 // qDebug();
1072 // Get the native pwiz-spectrum from the spectrum list.
1073 // Note that this pointer is a shared pointer from pwiz.
1074
1075 pwiz::msdata::SpectrumPtr native_pwiz_spectrum_sp =
1076 getPwizSpectrumPtr(spectrum_list_p.get(), iter, want_binary_data);
1077 // qDebug();
1078 /*
1079 * we want to load metadata of the spectrum even if it does not contain
1080 peaks
1081
1082 * if(!native_pwiz_spectrum_sp->hasBinaryData())
1083 {
1084 // qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ <<
1085 "
1086 ()"
1087 //<< "native pwiz spectrum is empty, continuing.";
1088 continue;
1089 }
1090 */
1091
1092 // Instantiate the mass spectrum id that will hold critical information
1093 // like the the native id string and the spectrum index.
1094
1095 MassSpectrumId massSpectrumId(mcsp_msRunId, iter /* spectrum index*/);
1096
1097 // qDebug();
1098 // Get the spectrum native id as a QString to store it in the mass
1099 // spectrum id class. This is will allow later to refer to the same
1100 // spectrum starting back from the file.
1101
1102
1103 checkNativeId(native_pwiz_spectrum_sp.get(), massSpectrumId);
1104
1105 // Finally, instantiate the qualified mass spectrum with its id. This
1106 // function will continue performing pappso-spectrum detailed
1107 // qualification.
1108
1109 bool ok = false;
1110
1111 QualifiedMassSpectrum qualified_mass_spectrum = qualifiedMassSpectrumFromPwizSpectrumPtr(
1112 massSpectrumId, native_pwiz_spectrum_sp.get(), want_binary_data, ok);
1113
1114 if(!ok)
1115 {
1116 // qDebug() << "Encountered a mass spectrum for which the returned "
1117 //"status is bad.";
1118 continue;
1119 }
1120
1121 // qDebug();
1122 // Before handing the mass spectrum out to the handler, see if the
1123 // native mass spectrum was empty or not.
1124
1125 // if(!native_pwiz_spectrum_sp->defaultArrayLength)
1126 // qDebug() << "The mass spectrum has not defaultArrayLength";
1127
1128 qualified_mass_spectrum.setEmptyMassSpectrum(!native_pwiz_spectrum_sp->defaultArrayLength);
1129
1130 // The handler will receive the index of the mass spectrum in the
1131 // current run via the mass spectrum id member datum.
1132
1133 // qDebug();
1134 if(config.acceptMsLevel(qualified_mass_spectrum.getMsLevel()))
1135 {
1136 if(config.acceptRetentionTimeInSeconds(qualified_mass_spectrum.getRtInSeconds()))
1137 {
1138 handler.setQualifiedMassSpectrum(qualified_mass_spectrum);
1139 }
1140 }
1141 }
1142
1143
1144 // qDebug();
1145 setGlobalLocaleToCurrentOs(backup_env);
1146 // End of
1147 // for(std::size_t iter = 0; iter < spectrum_list_size; iter++)
1148
1149 // Now let the loading handler know that the loading of the data has ended.
1150 // The handler might need this "signal" to perform additional tasks or to
1151 // cleanup cruft.
1152
1153 // qDebug() << "Loading ended";
1154 handler.loadingEnded();
1155}

References pappso::MsRunReadConfig::acceptMsLevel(), pappso::MsRunReadConfig::acceptRetentionTimeInSeconds(), acquireDevice(), checkNativeId(), pappso::QualifiedMassSpectrum::getMsLevel(), getPwizSpectrumPtr(), pappso::QualifiedMassSpectrum::getRtInSeconds(), pappso::SpectrumCollectionHandlerInterface::loadingEnded(), pappso::MsRunReader::mcsp_msRunId, msp_msData, pappso::MsRunReadConfig::needPeakList(), qualifiedMassSpectrumFromPwizSpectrumPtr(), pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), setGlobalLocaleToCurrentOs(), setGlobalLocaleToEnglish(), pappso::SpectrumCollectionHandlerInterface::setQualifiedMassSpectrum(), pappso::SpectrumCollectionHandlerInterface::shouldStop(), and pappso::SpectrumCollectionHandlerInterface::spectrumListHasSize().

Referenced by MsFileAccessor, and readSpectrumCollection2().

◆ releaseDevice()

bool pappso::PwizMsRunReader::releaseDevice ( )
overridevirtual

release data back end device if a the data back end is released, the developper has to use acquireDevice before using the msrunreader object

Returns
bool true if done

Implements pappso::MsRunReader.

Definition at line 1170 of file pwizmsrunreader.cpp.

1171{
1172 msp_msData = nullptr;
1173 return true;
1174}

References msp_msData.

Referenced by MsFileAccessor.

◆ setGlobalLocaleToCurrentOs()

void pappso::PwizMsRunReader::setGlobalLocaleToCurrentOs ( const std::string & environment_locale)
staticprotected

Definition at line 1234 of file pwizmsrunreader.cpp.

1235{
1236 try
1237 {
1238#ifdef MXE
1239 // std::locale::global(std::locale("C")); // set locale to default
1240 // locale
1241 std::setlocale(LC_ALL, environment_locale.c_str());
1242#else
1243 std::locale::global(std::locale("")); // sets locale according to OS environment
1244#endif
1245 }
1246 catch(std::exception &error)
1247 {
1248 throw pappso::PappsoException(
1249 QObject::tr("Error trying to set local to original system one %1 : %2")
1250 .arg(environment_locale.c_str())
1251 .arg(error.what()));
1252 }
1253}

Referenced by MsFileAccessor, qualifiedMassSpectrumFromPwizMSData(), readSpectrumCollectionByMsLevel(), and readSpectrumCollectionWithMsrunReadConfig().

◆ setGlobalLocaleToEnglish()

std::string pappso::PwizMsRunReader::setGlobalLocaleToEnglish ( )
staticprotected

Definition at line 1210 of file pwizmsrunreader.cpp.

1211{
1212 std::string env_backup;
1213 try
1214 {
1215#ifdef MXE
1216 // std::locale::global(std::locale("C")); // set locale to default
1217 // locale
1218
1219 std::string env_backup = std::setlocale(LC_ALL, nullptr);
1220 std::setlocale(LC_ALL, "C");
1221#else
1222 std::locale::global(std::locale("C")); // set locale to default locale
1223#endif
1224 }
1225 catch(std::exception &error)
1226 {
1227 throw pappso::PappsoException(
1228 QObject::tr("Error trying to set local to C : %1").arg(error.what()));
1229 }
1230 return env_backup;
1231}

Referenced by MsFileAccessor, qualifiedMassSpectrumFromPwizMSData(), qualifiedMassSpectrumFromPwizSpectrumPtr(), readSpectrumCollectionByMsLevel(), and readSpectrumCollectionWithMsrunReadConfig().

◆ spectrumListSize()

std::size_t pappso::PwizMsRunReader::spectrumListSize ( ) const
overridevirtual

get the totat number of spectrum conained in the MSrun data file

Implements pappso::MsRunReader.

Definition at line 1158 of file pwizmsrunreader.cpp.

1159{
1160 return msp_msData->run.spectrumListPtr.get()->size();
1161}

References msp_msData.

Referenced by MsFileAccessor.

◆ spectrumStringIdentifier2SpectrumIndex()

std::size_t pappso::PwizMsRunReader::spectrumStringIdentifier2SpectrumIndex ( const QString & spectrum_identifier)
overridevirtual

if possible, get the spectrum index given a string identifier throw a not found exception if spectrum identifier is not found

Parameters
spectrum_identifierstring identifier of a specific spectrum
Returns
the spectrum index

Implements pappso::MsRunReader.

Definition at line 1256 of file pwizmsrunreader.cpp.

1257{
1258 acquireDevice();
1259 std::size_t spectrum_id =
1260 msp_msData->run.spectrumListPtr->find(spectrum_identifier.toStdString());
1261 if(spectrum_id == msp_msData->run.spectrumListPtr->size())
1262 {
1263 throw pappso::ExceptionNotFound(
1264 QObject::tr("Spectrum identifier %1 not found").arg(spectrum_identifier));
1265 }
1266 return spectrum_id;
1267}

References acquireDevice(), and msp_msData.

Referenced by MsFileAccessor.

◆ MsFileAccessor

Member Data Documentation

◆ m_hasScanNumbers

bool pappso::PwizMsRunReader::m_hasScanNumbers = false
private

Definition at line 138 of file pwizmsrunreader.h.

Referenced by hasScanNumbers(), and initialize().

◆ m_mutex

QMutex pappso::PwizMsRunReader::m_mutex
staticprotected

Definition at line 133 of file pwizmsrunreader.h.

◆ msp_msData


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