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

#include <timsmsrunreaderbase.h>

Inheritance diagram for pappso::TimsMsRunReaderBase:
pappso::MsRunReader pappso::TimsFramesMsRunReader pappso::TimsMsRunReader pappso::TimsMsRunReaderDia pappso::TimsMsRunReaderMs2 pappso::TimsMsRunReaderMs2Selected

Public Member Functions

 TimsMsRunReaderBase (MsRunIdCstSPtr &msrun_id_csp)
 
 TimsMsRunReaderBase (const TimsMsRunReaderBase &msrun_reader_base)
 
virtual ~TimsMsRunReaderBase ()
 
virtual TimsDataSp getTimsDataSPtr ()
 give an access to the underlying raw data pointer
 
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
 
virtual Trace getTicChromatogram () override
 get a TIC chromatogram
 
virtual std::vector< double > getRetentionTimeLine () override
 retention timeline get retention times along the MSrun in seconds
 
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 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
 
- Public Member Functions inherited from pappso::MsRunReader
 MsRunReader (const MsRunIdCstSPtr &ms_run_id)
 
 MsRunReader (const MsRunReader &other)
 
virtual ~MsRunReader ()
 
const MsRunIdCstSPtrgetMsRunId () const
 
virtual MassSpectrumSPtr massSpectrumSPtr (std::size_t spectrum_index)=0
 get a MassSpectrumSPtr class given its spectrum index
 
virtual MassSpectrumCstSPtr massSpectrumCstSPtr (std::size_t spectrum_index)=0
 
virtual QualifiedMassSpectrum qualifiedMassSpectrum (std::size_t spectrum_index, bool want_binary_data=true) const =0
 get a QualifiedMassSpectrum class given its scan number
 
virtual std::size_t spectrumListSize () const =0
 get the totat number of spectrum conained in the MSrun data file
 
virtual void readSpectrumCollection (SpectrumCollectionHandlerInterface &handler)=0
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
 
virtual void readSpectrumCollection2 (const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler)=0
 
virtual void readSpectrumCollectionByMsLevel (SpectrumCollectionHandlerInterface &handler, unsigned int ms_level)=0
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels
 
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::size_t spectrumStringIdentifier2SpectrumIndex (const QString &spectrum_identifier)=0
 if possible, get the spectrum index given a string identifier throw a not found exception if spectrum identifier is not found
 
void setMonoThread (bool is_mono_thread)
 set only one is_mono_thread to true
 
bool isMonoThread () const
 

Protected Member Functions

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
 

Protected Attributes

TimsDataSp msp_timsData = nullptr
 
- Protected Attributes inherited from pappso::MsRunReader
MsRunIdCstSPtr mcsp_msRunId
 
MsRunReaderScanNumberMultiMapmpa_multiMapScanNumber = nullptr
 

Friends

class MsFileAccessor
 

Detailed Description

Definition at line 37 of file timsmsrunreaderbase.h.

Constructor & Destructor Documentation

◆ TimsMsRunReaderBase() [1/2]

◆ TimsMsRunReaderBase() [2/2]

pappso::TimsMsRunReaderBase::TimsMsRunReaderBase ( const TimsMsRunReaderBase & msrun_reader_base)

Definition at line 43 of file timsmsrunreaderbase.cpp.

44 : MsRunReader(msrun_reader_base.getMsRunId()), msp_timsData(msrun_reader_base.msp_timsData)
45{
46 initialize();
47}

References pappso::MsRunReader::MsRunReader(), TimsMsRunReaderBase(), pappso::MsRunReader::getMsRunId(), initialize(), and msp_timsData.

◆ ~TimsMsRunReaderBase()

pappso::TimsMsRunReaderBase::~TimsMsRunReaderBase ( )
virtual

Destructor

Definition at line 50 of file timsmsrunreaderbase.cpp.

51{
52
53 msp_timsData = nullptr;
54}

References msp_timsData.

Member Function Documentation

◆ accept()

bool pappso::TimsMsRunReaderBase::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.

Reimplemented in pappso::TimsMsRunReaderMs2, and pappso::TimsMsRunReaderMs2Selected.

Definition at line 72 of file timsmsrunreaderbase.cpp.

73{
74 qDebug() << file_name;
75 return true;
76}

Referenced by MsFileAccessor.

◆ acquireDevice()

bool pappso::TimsMsRunReaderBase::acquireDevice ( )
overridevirtual

acquire data back end device

Returns
bool true if done

Implements pappso::MsRunReader.

Reimplemented in pappso::TimsMsRunReaderDia, and pappso::TimsMsRunReaderMs2.

Definition at line 93 of file timsmsrunreaderbase.cpp.

94{
95 if(msp_timsData == nullptr)
96 {
97 initialize();
98 }
99 return true;
100}

References initialize(), and msp_timsData.

Referenced by pappso::TimsMsRunReaderDia::acquireDevice(), getTicChromatogram(), getTimsDataSPtr(), and MsFileAccessor.

◆ getOboPsiModTermInstrumentModelName()

const pappso::OboPsiModTerm pappso::TimsMsRunReaderBase::getOboPsiModTermInstrumentModelName ( ) const
overridevirtual

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

Reimplemented from pappso::MsRunReader.

Definition at line 152 of file timsmsrunreaderbase.cpp.

153{
154
155 pappso::FilterOboPsiModMap psims_map;
156
157 pappso::OboPsiMs psims_file(psims_map);
158
159 pappso::OboPsiModTerm term;
160
161 term = psims_map.getOboPsiModTermWithAccession("MS:1003123");
162 /*
163 * [Term]
164 id: MS:1003123
165 name: Bruker Daltonics timsTOF series
166 def: "Bruker Daltonics timsTOF series" [PSI:MS]
167 is_a: MS:1000122 ! Bruker Daltonics instrument model
168 */
169 /*
170 *
171[Term]
172id: MS:1003124
173name: timsTOF fleX
174def: "Bruker Daltonics' timsTOF fleX" [PSI:MS]
175is_a: MS:1003123 ! Bruker Daltonics timsTOF series
176
177[Term]
178id: MS:1003229
179name: timsTOF
180def: "Bruker Daltonics' timsTOF." [PSI:MS]
181is_a: MS:1003123 ! Bruker Daltonics timsTOF series
182
183[Term]
184id: MS:1003230
185name: timsTOF Pro 2
186def: "Bruker Daltonics' timsTOF Pro 2." [PSI:MS]
187is_a: MS:1003123 ! Bruker Daltonics timsTOF series
188
189[Term]
190id: MS:1003231
191name: timsTOF SCP
192def: "Bruker Daltonics' timsTOF SCP." [PSI:MS]
193is_a: MS:1003123 ! Bruker Daltonics timsTOF series
194
195[Term]
196id: MS:1003383
197name: timsTOF Ultra
198def: "Bruker Daltonics' timsTOF Ultra." [PSI:MS]
199is_a: MS:1003123 ! Bruker Daltonics timsTOF series
200
201
202[Term]
203id: MS:1003397
204name: timsTOF fleX MALDI-2
205def: "Bruker Daltonics' timsTOF fleX MALDI-2." [PSI:MS]
206is_a: MS:1003123 ! Bruker Daltonics timsTOF series
207
208
209[Term]
210id: MS:1003404
211name: timsTOF HT
212def: "Bruker Daltonics' timsTOF HT." [PSI:MS]
213is_a: MS:1003123 ! Bruker Daltonics timsTOF series
214
215
216[Term]
217id: MS:1003412
218name: timsTOF Ultra 2
219def: "Bruker Daltonics timsTOF Ultra 2." [PSI:MS]
220is_a: MS:1003123 ! Bruker Daltonics timsTOF series
221*/
222 QStringList timstof_list;
223 timstof_list << "MS:1003005"
224 << "MS:1003412"
225 << "MS:1003404"
226 << "MS:1003397"
227 << "MS:1003383"
228 << "MS:1003231"
229 << "MS:1003230"
230 << "MS:1003229"
231 << "MS:1003124";
232
233 QString instrument_name = msp_timsData.get()->getGlobalMetadataValue("InstrumentName").toString();
234
235 for(auto &accession : timstof_list)
236 {
237 pappso::OboPsiModTerm test_term = psims_map.getOboPsiModTermWithAccession(accession);
238 if(test_term.m_name == instrument_name)
239 {
240 term = test_term;
241 break;
242 }
243 }
244 return term;
245}
const OboPsiModTerm & getOboPsiModTermWithAccession(const QString &accession) const

References pappso::FilterOboPsiModMap::getOboPsiModTermWithAccession(), pappso::OboPsiModTerm::m_name, and msp_timsData.

Referenced by MsFileAccessor.

◆ getRetentionTimeLine()

std::vector< double > pappso::TimsMsRunReaderBase::getRetentionTimeLine ( )
overridevirtual

retention timeline get retention times along the MSrun in seconds

Returns
vector of retention times (seconds)

Reimplemented from pappso::MsRunReader.

Reimplemented in pappso::TimsMsRunReaderMs2.

Definition at line 124 of file timsmsrunreaderbase.cpp.

125{
126 return msp_timsData.get()->getRetentionTimeLineInSeconds();
127}

References msp_timsData.

Referenced by MsFileAccessor.

◆ getTicChromatogram()

Trace pappso::TimsMsRunReaderBase::getTicChromatogram ( )
overridevirtual

get a TIC chromatogram

for each retention time, computes the sum of all intensities. For IM-MS, combines the mobility spectra

Note that, formally, a TIC chromatogram is computed only for MS1 spectra.

Returns
a trace (x=rt, y=intensities)

Reimplemented from pappso::MsRunReader.

Reimplemented in pappso::TimsMsRunReaderMs2.

Definition at line 111 of file timsmsrunreaderbase.cpp.

112{
113 // Use the Sqlite database to fetch the total ion current chromatogram (TIC
114 // chromatogram).
115
117
118 // The time unit here is seconds, not minutes!!!
119 return msp_timsData->getTicChromatogram();
120}
virtual bool acquireDevice() override
acquire data back end device

References acquireDevice(), and msp_timsData.

Referenced by MsFileAccessor.

◆ getTimsDataSPtr()

TimsDataSp pappso::TimsMsRunReaderBase::getTimsDataSPtr ( )
virtual

give an access to the underlying raw data pointer

Reimplemented in pappso::TimsMsRunReaderMs2.

Definition at line 103 of file timsmsrunreaderbase.cpp.

104{
106 return msp_timsData;
107}

References acquireDevice(), and msp_timsData.

Referenced by MsFileAccessor.

◆ hasScanNumbers()

bool pappso::TimsMsRunReaderBase::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.

Reimplemented in pappso::TimsMsRunReaderMs2, and pappso::TimsMsRunReaderMs2Selected.

Definition at line 79 of file timsmsrunreaderbase.cpp.

80{
81 return false;
82}

Referenced by MsFileAccessor.

◆ initialize()

void pappso::TimsMsRunReaderBase::initialize ( )
overrideprotectedvirtual

Implements pappso::MsRunReader.

Reimplemented in pappso::TimsMsRunReaderDia, pappso::TimsMsRunReaderMs2, and pappso::TimsMsRunReaderMs2Selected.

Definition at line 57 of file timsmsrunreaderbase.cpp.

58{
59 if(msp_timsData == nullptr)
60 msp_timsData = std::make_shared<TimsData>(mcsp_msRunId.get()->getFileName());
61
62 if(msp_timsData.get() == nullptr)
63 {
64 throw PappsoException(QObject::tr("ERROR in TimsMsRunReaderBase::initialize "
65 "msp_timsData is null for MsRunId %1")
66 .arg(mcsp_msRunId.get()->toString()));
67 }
68}
MsRunIdCstSPtr mcsp_msRunId

References pappso::MsRunReader::mcsp_msRunId, and msp_timsData.

Referenced by pappso::TimsMsRunReader::TimsMsRunReader(), pappso::TimsMsRunReader::TimsMsRunReader(), TimsMsRunReaderBase(), TimsMsRunReaderBase(), acquireDevice(), and MsFileAccessor.

◆ newXicCoordSPtrFromQualifiedMassSpectrum()

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

get a xic coordinate object from a given spectrum

Implements pappso::MsRunReader.

Reimplemented in pappso::TimsMsRunReaderDia, and pappso::TimsMsRunReaderMs2.

Definition at line 140 of file timsmsrunreaderbase.cpp.

143{
144 throw ExceptionNotImplemented(
145 QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
146}

Referenced by MsFileAccessor.

◆ newXicCoordSPtrFromSpectrumIndex()

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

get a xic coordinate object from a given spectrum index

Implements pappso::MsRunReader.

Reimplemented in pappso::TimsMsRunReaderDia, and pappso::TimsMsRunReaderMs2.

Definition at line 131 of file timsmsrunreaderbase.cpp.

134{
135 throw ExceptionNotImplemented(
136 QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
137}

Referenced by MsFileAccessor.

◆ releaseDevice()

bool pappso::TimsMsRunReaderBase::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.

Reimplemented in pappso::TimsMsRunReaderMs2.

Definition at line 86 of file timsmsrunreaderbase.cpp.

87{
88 msp_timsData = nullptr;
89 return true;
90}

References msp_timsData.

Referenced by MsFileAccessor.

Friends And Related Symbol Documentation

◆ MsFileAccessor

Member Data Documentation

◆ msp_timsData


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