31 #include "../../exception/exceptionnotimplemented.h"
33 #include <QtConcurrent/QtConcurrent>
54 msp_timsData = std::make_shared<TimsData>(mcsp_msRunId.get()->getFileName());
55 if(msp_timsData ==
nullptr)
58 QObject::tr(
"ERROR in TimsMsRunReaderMs2::initialize "
59 "msp_timsData is null for MsRunId %1")
60 .arg(mcsp_msRunId.get()->toString()));
75 QObject::tr(
"ERROR in TimsMsRunReaderMs2::setMs2BuiltinCentroid "
76 "msp_timsData is null"));
91 QObject::tr(
"ERROR in TimsMsRunReaderMs2::setMs2FilterCstSPtr "
92 "msp_timsData is null"));
107 QObject::tr(
"ERROR in TimsMsRunReaderMs2::setMs1FilterCstSPtr "
108 "msp_timsData is null"));
115 qDebug() << file_name;
140 bool want_binary_data)
const
143 std::size_t precursor_index = (spectrum_index / 2) + 1;
145 if(spectrum_index % 2 == 0)
151 spectrum_index, precursor_index, want_binary_data);
158 return mass_spectrum_ms1;
165 mass_spectrum_ms2, spectrum_index, precursor_index, want_binary_data);
172 return mass_spectrum_ms2;
207 std::size_t process_list_size = 300;
213 bool want_binary_data;
216 for(std::size_t i = 0; i < spectrum_list_size; i += process_list_size)
223 qDebug() <<
"The operation was cancelled. Breaking the loop.";
226 std::vector<tmp_item> item_list;
227 for(std::size_t iter = 0;
228 (iter < process_list_size) && ((iter + i) < spectrum_list_size);
232 bool get_data = want_binary_data;
233 if((iter + i) % 2 == 0)
245 qDebug() << item_list.size();
248 QtConcurrent::blockingMap(
249 item_list.begin(), item_list.end(), [
this](tmp_item &one_item) {
250 qDebug() << one_item.iter;
251 one_item.qualified_mass_spectrum =
252 qualifiedMassSpectrum(one_item.iter, one_item.want_binary_data);
258 qDebug() << item_list.size();
259 for(
auto &item : item_list)
271 for(std::size_t iter = 0; iter < spectrum_list_size; iter++)
278 qDebug() <<
"The operation was cancelled. Breaking the loop.";
281 bool get_data = want_binary_data;
310 return (
msp_timsData->getTotalNumberOfPrecursors() * 2);
341 std::vector<std::size_t>
347 return msp_timsData->getPrecursorsFromMzRtCharge(charge, mz_val, rt_sec, k0);
void setMsRunId(MsRunIdCstSPtr other)
base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory
const MsRunIdCstSPtr & getMsRunId() const
Class representing a fully specified mass spectrum.
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
void setMassSpectrumId(const MassSpectrumId &iD)
Set the MassSpectrumId.
MassSpectrumSPtr getMassSpectrumSPtr() const
Get the MassSpectrumSPtr.
interface to collect spectrums from the MsRunReader class
virtual bool shouldStop()
virtual bool isReadAhead() const
tells if we want to read ahead spectrum
virtual bool needPeakList() const =0
tells if we need the peak list (if we want the binary data) for each spectrum
virtual void loadingEnded()
virtual bool needMsLevelPeakList(unsigned int ms_level) const final
tells if we need the peak list (if we want the binary data) for each spectrum, given an MS level
virtual void spectrumListHasSize(std::size_t size)
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum)=0
void setMs2FilterCstSPtr(pappso::FilterInterfaceCstSPtr filter)
void setMs1FilterCstSPtr(pappso::FilterInterfaceCstSPtr filter)
virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data=true) const override
get a QualifiedMassSpectrum class given its scan number
TimsMsRunReaderMs2(MsRunIdCstSPtr &msrun_id_csp)
virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override
get a MassSpectrumSPtr class given its spectrum index
pappso::FilterInterfaceCstSPtr msp_ms2Filter
virtual std::size_t spectrumListSize() const override
get the totat number of spectrum conained in the MSrun data file
virtual bool releaseDevice() override
release data back end device if a the data back end is released, the developper has to use acquireDev...
pappso::FilterInterfaceCstSPtr msp_ms1Filter
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
virtual std::vector< std::size_t > getPrecursorsIDFromMzRt(int charge, double mz_val, double rt_sec, double k0)
Get all the precursors id which match the values.
virtual void initialize() override
bool m_builtinMs2Centroid
enable builtin centroid on raw tims integers by default
void setMs2BuiltinCentroid(bool centroid)
enable or disable simple centroid filter on raw tims data for MS2
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 bool acquireDevice() override
acquire data back end device
virtual bool hasScanNumbers() const override
tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided func...
virtual ~TimsMsRunReaderMs2()
virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override
virtual TimsDataSp getTimsDataSPtr()
give an access to the underlying raw data pointer
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,...
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
std::shared_ptr< TimsData > TimsDataSp
shared pointer on a TimsData object
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
std::shared_ptr< const FilterInterface > FilterInterfaceCstSPtr
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
MSrun file reader for native Bruker TimsTOF specialized for MS2 purpose.