libpappsomspp
Library for mass spectrometry
|
#include <timsdata.h>
Classes | |
struct | FrameIdDescr |
Public Member Functions | |
TimsData (QDir timsDataDirectory) | |
build using the tims data directory More... | |
TimsData (const TimsData &other) | |
~TimsData () | |
pappso::MassSpectrumCstSPtr | getMassSpectrumCstSPtrByRawIndex (std::size_t raw_index) |
get a mass spectrum given its spectrum index More... | |
pappso::MassSpectrumCstSPtr | getMassSpectrumCstSPtr (std::size_t timsId, std::size_t scanNum) |
get a mass spectrum given the tims frame database id and scan number within tims frame More... | |
std::size_t | getTotalNumberOfScans () const |
get the total number of scans More... | |
std::size_t | getTotalNumberOfPrecursors () const |
get the number of precursors analyzes by PASEF More... | |
std::vector< std::size_t > | getPrecursorsFromMzRtCharge (int charge, double mz_val, double rt_sec, double k0) |
guess possible precursor ids given a charge, m/z, retention time and k0 More... | |
unsigned int | getMsLevelBySpectrumIndex (std::size_t spectrum_index) |
QualifiedMassSpectrum | getQualifiedMassSpectrumByRawIndex (std::size_t spectrum_index, bool want_binary_data) |
void | getQualifiedMs2MassSpectrumByPrecursorId (QualifiedMassSpectrum &mass_spectrum, std::size_t ms2_index, std::size_t precursor_index, bool want_binary_data) |
QualifiedMassSpectrum | getQualifiedMs1MassSpectrumByPrecursorId (std::size_t ms2_index, std::size_t precursor_index, bool want_binary_data) |
void | setMs2FilterCstSPtr (pappso::FilterInterfaceCstSPtr &filter) |
filter interface to apply just after raw MS2 specturm extraction the filter can be a list of filters inside a FilterSuite object More... | |
void | setMs1FilterCstSPtr (pappso::FilterInterfaceCstSPtr &filter) |
filter interface to apply just after raw MS1 specturm extraction the filter can be a list of filters inside a FilterSuite object More... | |
void | setMs2BuiltinCentroid (bool centroid) |
enable or disable simple centroid filter on raw tims data for MS2 More... | |
bool | getMs2BuiltinCentroid () const |
tells if simple centroid filter on raw tims data for MS2 is enabled or not More... | |
std::vector< std::size_t > | getTimsMS1FrameIdRange (double rt_begin, double rt_end) const |
TimsFrameCstSPtr | getTimsFrameCstSPtr (std::size_t timsId) const |
get a Tims frame with his database ID More... | |
TimsXicStructure | getTimsXicStructureFromPrecursorId (std::size_t precursor_id, PrecisionPtr precision_ptr) const |
void | extractXicListByTimsXicStructureList (std::vector< TimsXicStructure > &tims_xic_structure_list, XicExtractMethod xicExtractMethod, double rtRange) const |
extract a list of XICs from Tims data More... | |
std::map< quint32, quint32 > | getRawMs2ByPrecursorId (std::size_t precursor_index) |
get cumulated raw signal for a given precursor only to use to see the raw signal More... | |
Private Member Functions | |
std::vector< TimsXicStructure > | extractXicListByPrecursorIds (const std::vector< std::size_t > &precursor_id_list, PrecisionPtr precision_ptr, XicExtractMethod xicExtractMethod, double rtRange) const |
extract a list of XICs from Tims data More... | |
std::pair< std::size_t, std::size_t > | getScanCoordinateFromRawIndex (std::size_t spectrum_index) const |
std::size_t | getRawIndexFromCoordinate (std::size_t frame_id, std::size_t scan_num) const |
QSqlDatabase | openDatabaseConnection () const |
TimsFrameBaseCstSPtr | getTimsFrameBaseCstSPtr (std::size_t timsId) const |
get a Tims frame base (no binary data file access) with his database ID More... | |
TimsFrameCstSPtr | getTimsFrameCstSPtrCached (std::size_t timsId) |
get a Tims frame with his database ID but look in the cache first More... | |
TimsFrameBaseCstSPtr | getTimsFrameBaseCstSPtrCached (std::size_t timsId) |
std::vector< std::size_t > | getMatchPrecursorIdByKo (std::vector< std::vector< double >> ids, double ko_value) |
std::vector< std::size_t > | getClosestPrecursorIdByMz (std::vector< std::vector< double >> ids, double mz_value) |
void | fillFrameIdDescrList () |
private function to fill m_frameIdDescrList More... | |
Private Attributes | |
QDir | m_timsDataDirectory |
TimsBinDec * | mpa_timsBinDec = nullptr |
std::size_t | m_totalNumberOfScans |
std::size_t | m_totalNumberOfPrecursors |
std::size_t | m_cacheSize = 60 |
std::deque< TimsFrameCstSPtr > | m_timsFrameCache |
std::deque< TimsFrameBaseCstSPtr > | m_timsFrameBaseCache |
pappso::FilterInterfaceCstSPtr | mcsp_ms2Filter = nullptr |
pappso::FilterInterfaceCstSPtr | mcsp_ms1Filter = nullptr |
bool | m_builtinMs2Centroid = true |
enable builtin centroid on raw tims integers by default More... | |
std::map< int, QSqlRecord > | m_mapMzCalibrationRecord |
std::map< int, QSqlRecord > | m_mapTimsCalibrationRecord |
std::map< std::size_t, QSqlRecord > | m_mapFramesRecord |
MzCalibrationStore * | mpa_mzCalibrationStore |
std::vector< FrameIdDescr > | m_frameIdDescrList |
store every frame id and corresponding sizes More... | |
std::map< std::size_t, std::size_t > | m_thousandIndexToFrameIdDescrListIndex |
index to find quickly a frameId in the description list with the raw index of spectrum modulo 1000 More... | |
QMutex | m_mutex |
Definition at line 90 of file timsdata.h.
TimsData::TimsData | ( | QDir | timsDataDirectory | ) |
build using the tims data directory
Definition at line 46 of file timsdata.cpp.
References fillFrameIdDescrList(), m_mapFramesRecord, m_mapMzCalibrationRecord, m_mapTimsCalibrationRecord, m_timsDataDirectory, m_totalNumberOfPrecursors, m_totalNumberOfScans, mcsp_ms1Filter, mcsp_ms2Filter, mpa_mzCalibrationStore, mpa_timsBinDec, and openDatabaseConnection().
pappso::TimsData::TimsData | ( | const TimsData & | other | ) |
Copy constructor
other | TODO |
TimsData::~TimsData | ( | ) |
Destructor
Definition at line 253 of file timsdata.cpp.
References mpa_mzCalibrationStore, and mpa_timsBinDec.
|
private |
extract a list of XICs from Tims data
precursor_id_list | the list of precursors to extract |
precision_ptr | precision to compute the mz range to extract for each precursor mass |
xicExtractMethod | XIC extraction method (sum or max) to use |
rtRange | retention time range in seconds to extract XIC from rtTarget
|
Definition at line 1329 of file timsdata.cpp.
References pappso::TimsXicExtractorInterface::extractTimsXicList(), m_timsDataDirectory, pappso::TimsXicStructure::mzRange, openDatabaseConnection(), pappso::TimsXicStructure::precursorId, pappso::TimsXicStructure::rtTarget, pappso::TimsXicStructure::scanNumBegin, pappso::TimsXicStructure::scanNumEnd, pappso::TimsXicExtractorInterface::setXicExtractMethod(), pappso::PappsoException::what(), and pappso::TimsXicStructure::xicSptr.
void pappso::TimsData::extractXicListByTimsXicStructureList | ( | std::vector< TimsXicStructure > & | tims_xic_structure_list, |
pappso::XicExtractMethod | xicExtractMethod, | ||
double | rtRange | ||
) | const |
extract a list of XICs from Tims data
tims_xic_structure_list | the list of tims XIC structure to extract |
xicExtractMethod | XIC extraction method (sum or max) to use |
rtRange | retention time range in seconds to extract XIC from rtTarget
|
Definition at line 1409 of file timsdata.cpp.
References pappso::TimsXicExtractorInterface::extractTimsXicList(), pappso::TimsXicExtractorInterface::setXicExtractMethod(), and pappso::PappsoException::what().
|
private |
private function to fill m_frameIdDescrList
Definition at line 279 of file timsdata.cpp.
References m_frameIdDescrList, m_thousandIndexToFrameIdDescrListIndex, m_timsDataDirectory, and openDatabaseConnection().
Referenced by TimsData().
|
private |
Definition at line 710 of file timsdata.cpp.
Referenced by getPrecursorsFromMzRtCharge().
pappso::MassSpectrumCstSPtr TimsData::getMassSpectrumCstSPtr | ( | std::size_t | timsId, |
std::size_t | scanNum | ||
) |
get a mass spectrum given the tims frame database id and scan number within tims frame
Definition at line 584 of file timsdata.cpp.
References getTimsFrameCstSPtrCached().
Referenced by getMassSpectrumCstSPtrByRawIndex().
pappso::MassSpectrumCstSPtr TimsData::getMassSpectrumCstSPtrByRawIndex | ( | std::size_t | raw_index | ) |
get a mass spectrum given its spectrum index
raw_index | a number begining at 0, corresponding to a Tims Scan in the order they lies in the binary data file |
Definition at line 376 of file timsdata.cpp.
References getMassSpectrumCstSPtr(), and getScanCoordinateFromRawIndex().
Referenced by pappso::TimsMsRunReader::massSpectrumCstSPtr().
|
private |
Definition at line 684 of file timsdata.cpp.
References getScanCoordinateFromRawIndex(), and getTimsFrameBaseCstSPtrCached().
bool TimsData::getMs2BuiltinCentroid | ( | ) | const |
tells if simple centroid filter on raw tims data for MS2 is enabled or not
Definition at line 273 of file timsdata.cpp.
References m_builtinMs2Centroid.
unsigned int TimsData::getMsLevelBySpectrumIndex | ( | std::size_t | spectrum_index | ) |
Definition at line 734 of file timsdata.cpp.
References getScanCoordinateFromRawIndex(), and getTimsFrameCstSPtrCached().
Referenced by pappso::TimsMsRunReader::readSpectrumCollectionByMsLevel().
std::vector< std::size_t > TimsData::getPrecursorsFromMzRtCharge | ( | int | charge, |
double | mz_val, | ||
double | rt_sec, | ||
double | k0 | ||
) |
guess possible precursor ids given a charge, m/z, retention time and k0
Definition at line 605 of file timsdata.cpp.
References getClosestPrecursorIdByMz(), m_timsDataDirectory, and openDatabaseConnection().
QualifiedMassSpectrum TimsData::getQualifiedMassSpectrumByRawIndex | ( | std::size_t | spectrum_index, |
bool | want_binary_data | ||
) |
Definition at line 743 of file timsdata.cpp.
References pappso::QualifiedMassSpectrum::appendPrecursorIonData(), pappso::BrukerPrecursorIndex, pappso::CollisionEnergy, getRawIndexFromCoordinate(), getScanCoordinateFromRawIndex(), getTimsFrameBaseCstSPtrCached(), getTimsFrameCstSPtrCached(), pappso::IsolationMz, pappso::IsolationWidth, m_timsDataDirectory, pappso::OneOverK0, openDatabaseConnection(), pappso::QualifiedMassSpectrum::setDtInMilliSeconds(), pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), pappso::QualifiedMassSpectrum::setMassSpectrumId(), pappso::QualifiedMassSpectrum::setMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::setMsLevel(), pappso::MassSpectrumId::setNativeId(), pappso::QualifiedMassSpectrum::setParameterValue(), pappso::QualifiedMassSpectrum::setPrecursorNativeId(), pappso::QualifiedMassSpectrum::setPrecursorSpectrumIndex(), pappso::QualifiedMassSpectrum::setRtInSeconds(), pappso::MassSpectrumId::setSpectrumIndex(), and pappso::QualifiedMassSpectrum::size().
Referenced by pappso::TimsMsRunReader::qualifiedMassSpectrum().
QualifiedMassSpectrum TimsData::getQualifiedMs1MassSpectrumByPrecursorId | ( | std::size_t | ms2_index, |
std::size_t | precursor_index, | ||
bool | want_binary_data | ||
) |
Definition at line 862 of file timsdata.cpp.
References pappso::TracePlusCombiner::combine(), getTimsFrameCstSPtrCached(), m_timsDataDirectory, mcsp_ms1Filter, pappso::OneOverK0begin, pappso::OneOverK0end, openDatabaseConnection(), pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), pappso::QualifiedMassSpectrum::setMassSpectrumId(), pappso::QualifiedMassSpectrum::setMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::setMsLevel(), pappso::MassSpectrumId::setNativeId(), pappso::QualifiedMassSpectrum::setParameterValue(), pappso::QualifiedMassSpectrum::setPrecursorSpectrumIndex(), pappso::QualifiedMassSpectrum::setRtInSeconds(), pappso::MassSpectrumId::setSpectrumIndex(), and pappso::PappsoException::what().
Referenced by pappso::TimsMsRunReaderMs2Selected::qualifiedMassSpectrum().
void TimsData::getQualifiedMs2MassSpectrumByPrecursorId | ( | QualifiedMassSpectrum & | mass_spectrum, |
std::size_t | ms2_index, | ||
std::size_t | precursor_index, | ||
bool | want_binary_data | ||
) |
Definition at line 1027 of file timsdata.cpp.
References pappso::QualifiedMassSpectrum::appendPrecursorIonData(), pappso::BrukerPrecursorIndex, pappso::CollisionEnergy, getTimsFrameCstSPtrCached(), pappso::IsolationMz, pappso::IsolationWidth, m_builtinMs2Centroid, m_timsDataDirectory, mcsp_ms2Filter, pappso::OneOverK0begin, pappso::OneOverK0end, openDatabaseConnection(), pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), pappso::QualifiedMassSpectrum::setMassSpectrumId(), pappso::QualifiedMassSpectrum::setMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::setMsLevel(), pappso::MassSpectrumId::setNativeId(), pappso::QualifiedMassSpectrum::setParameterValue(), pappso::QualifiedMassSpectrum::setPrecursorNativeId(), pappso::QualifiedMassSpectrum::setPrecursorSpectrumIndex(), pappso::QualifiedMassSpectrum::setRtInSeconds(), pappso::MassSpectrumId::setSpectrumIndex(), and pappso::PappsoException::what().
Referenced by pappso::TimsMsRunReaderMs2Selected::qualifiedMassSpectrum().
|
private |
Definition at line 353 of file timsdata.cpp.
References m_frameIdDescrList.
Referenced by getQualifiedMassSpectrumByRawIndex().
std::map< quint32, quint32 > TimsData::getRawMs2ByPrecursorId | ( | std::size_t | precursor_index | ) |
get cumulated raw signal for a given precursor only to use to see the raw signal
precursor_index | precursor index to extract signal from |
Definition at line 1498 of file timsdata.cpp.
References getTimsFrameCstSPtrCached(), m_timsDataDirectory, openDatabaseConnection(), and pappso::PappsoException::what().
|
private |
Definition at line 319 of file timsdata.cpp.
References m_frameIdDescrList, and m_thousandIndexToFrameIdDescrListIndex.
Referenced by getMassSpectrumCstSPtrByRawIndex(), getMatchPrecursorIdByKo(), getMsLevelBySpectrumIndex(), and getQualifiedMassSpectrumByRawIndex().
|
private |
get a Tims frame base (no binary data file access) with his database ID
Definition at line 385 of file timsdata.cpp.
References pappso::MzCalibrationStore::getInstance(), m_mapFramesRecord, m_mapMzCalibrationRecord, m_mapTimsCalibrationRecord, and mpa_mzCalibrationStore.
Referenced by getTimsFrameBaseCstSPtrCached().
|
private |
Definition at line 1280 of file timsdata.cpp.
References getTimsFrameBaseCstSPtr(), m_cacheSize, m_mutex, and m_timsFrameBaseCache.
Referenced by getMatchPrecursorIdByKo(), and getQualifiedMassSpectrumByRawIndex().
TimsFrameCstSPtr TimsData::getTimsFrameCstSPtr | ( | std::size_t | timsId | ) | const |
get a Tims frame with his database ID
Definition at line 496 of file timsdata.cpp.
References pappso::MzCalibrationStore::getInstance(), pappso::TimsBinDec::getTimsFrameSPtrByOffset(), m_mapFramesRecord, m_mapMzCalibrationRecord, m_mapTimsCalibrationRecord, mpa_mzCalibrationStore, and mpa_timsBinDec.
Referenced by pappso::TimsDirectXicExtractor::extractTimsXicList(), and getTimsFrameCstSPtrCached().
|
private |
get a Tims frame with his database ID but look in the cache first
Definition at line 1299 of file timsdata.cpp.
References getTimsFrameCstSPtr(), m_cacheSize, m_mutex, and m_timsFrameCache.
Referenced by getMassSpectrumCstSPtr(), getMsLevelBySpectrumIndex(), getQualifiedMassSpectrumByRawIndex(), getQualifiedMs1MassSpectrumByPrecursorId(), getQualifiedMs2MassSpectrumByPrecursorId(), and getRawMs2ByPrecursorId().
std::vector< std::size_t > TimsData::getTimsMS1FrameIdRange | ( | double | rt_begin, |
double | rt_end | ||
) | const |
Definition at line 460 of file timsdata.cpp.
References m_timsDataDirectory, and openDatabaseConnection().
Referenced by pappso::TimsDirectXicExtractor::extractTimsXicList().
pappso::TimsXicStructure pappso::TimsData::getTimsXicStructureFromPrecursorId | ( | std::size_t | precursor_id, |
PrecisionPtr | precision_ptr | ||
) | const |
Definition at line 1435 of file timsdata.cpp.
References pappso::TimsXicStructure::mzRange, pappso::TimsXicStructure::precursorId, pappso::TimsXicStructure::rtTarget, pappso::TimsXicStructure::scanNumBegin, pappso::TimsXicStructure::scanNumEnd, pappso::PappsoException::what(), and pappso::TimsXicStructure::xicSptr.
std::size_t TimsData::getTotalNumberOfPrecursors | ( | ) | const |
get the number of precursors analyzes by PASEF
Definition at line 599 of file timsdata.cpp.
References m_totalNumberOfPrecursors.
Referenced by pappso::TimsMsRunReaderMs2Selected::spectrumListSize().
std::size_t TimsData::getTotalNumberOfScans | ( | ) | const |
get the total number of scans
Definition at line 592 of file timsdata.cpp.
References m_totalNumberOfScans.
Referenced by pappso::TimsMsRunReader::spectrumListSize().
|
private |
Definition at line 218 of file timsdata.cpp.
References m_timsDataDirectory.
Referenced by TimsData(), extractXicListByPrecursorIds(), fillFrameIdDescrList(), getPrecursorsFromMzRtCharge(), getQualifiedMassSpectrumByRawIndex(), getQualifiedMs1MassSpectrumByPrecursorId(), getQualifiedMs2MassSpectrumByPrecursorId(), getRawMs2ByPrecursorId(), and getTimsMS1FrameIdRange().
void TimsData::setMs1FilterCstSPtr | ( | pappso::FilterInterfaceCstSPtr & | filter | ) |
filter interface to apply just after raw MS1 specturm extraction the filter can be a list of filters inside a FilterSuite object
Definition at line 1323 of file timsdata.cpp.
References mcsp_ms1Filter.
Referenced by pappso::TimsMsRunReaderMs2Selected::setMs1FilterCstSPtr().
void TimsData::setMs2BuiltinCentroid | ( | bool | centroid | ) |
enable or disable simple centroid filter on raw tims data for MS2
Definition at line 267 of file timsdata.cpp.
References m_builtinMs2Centroid.
void TimsData::setMs2FilterCstSPtr | ( | pappso::FilterInterfaceCstSPtr & | filter | ) |
filter interface to apply just after raw MS2 specturm extraction the filter can be a list of filters inside a FilterSuite object
Definition at line 1318 of file timsdata.cpp.
References mcsp_ms2Filter.
Referenced by pappso::TimsMsRunReaderMs2Selected::setMs2FilterCstSPtr().
|
private |
enable builtin centroid on raw tims integers by default
Definition at line 283 of file timsdata.h.
Referenced by getMs2BuiltinCentroid(), getQualifiedMs2MassSpectrumByPrecursorId(), and setMs2BuiltinCentroid().
|
private |
Definition at line 274 of file timsdata.h.
Referenced by getTimsFrameBaseCstSPtrCached(), and getTimsFrameCstSPtrCached().
|
private |
store every frame id and corresponding sizes
Definition at line 302 of file timsdata.h.
Referenced by fillFrameIdDescrList(), getRawIndexFromCoordinate(), and getScanCoordinateFromRawIndex().
|
private |
Definition at line 288 of file timsdata.h.
Referenced by TimsData(), getTimsFrameBaseCstSPtr(), and getTimsFrameCstSPtr().
|
private |
Definition at line 286 of file timsdata.h.
Referenced by TimsData(), getTimsFrameBaseCstSPtr(), and getTimsFrameCstSPtr().
|
private |
Definition at line 287 of file timsdata.h.
Referenced by TimsData(), getTimsFrameBaseCstSPtr(), and getTimsFrameCstSPtr().
|
private |
Definition at line 309 of file timsdata.h.
Referenced by getTimsFrameBaseCstSPtrCached(), and getTimsFrameCstSPtrCached().
|
private |
index to find quickly a frameId in the description list with the raw index of spectrum modulo 1000
Definition at line 307 of file timsdata.h.
Referenced by fillFrameIdDescrList(), and getScanCoordinateFromRawIndex().
|
private |
Definition at line 269 of file timsdata.h.
Referenced by TimsData(), extractXicListByPrecursorIds(), fillFrameIdDescrList(), getPrecursorsFromMzRtCharge(), getQualifiedMassSpectrumByRawIndex(), getQualifiedMs1MassSpectrumByPrecursorId(), getQualifiedMs2MassSpectrumByPrecursorId(), getRawMs2ByPrecursorId(), getTimsMS1FrameIdRange(), and openDatabaseConnection().
|
private |
Definition at line 276 of file timsdata.h.
Referenced by getTimsFrameBaseCstSPtrCached().
|
private |
Definition at line 275 of file timsdata.h.
Referenced by getTimsFrameCstSPtrCached().
|
private |
Definition at line 273 of file timsdata.h.
Referenced by TimsData(), and getTotalNumberOfPrecursors().
|
private |
Definition at line 272 of file timsdata.h.
Referenced by TimsData(), and getTotalNumberOfScans().
|
private |
Definition at line 279 of file timsdata.h.
Referenced by TimsData(), getQualifiedMs1MassSpectrumByPrecursorId(), and setMs1FilterCstSPtr().
|
private |
Definition at line 278 of file timsdata.h.
Referenced by TimsData(), getQualifiedMs2MassSpectrumByPrecursorId(), and setMs2FilterCstSPtr().
|
private |
Definition at line 290 of file timsdata.h.
Referenced by TimsData(), ~TimsData(), getTimsFrameBaseCstSPtr(), and getTimsFrameCstSPtr().
|
private |
Definition at line 270 of file timsdata.h.
Referenced by TimsData(), ~TimsData(), and getTimsFrameCstSPtr().