libpappsomspp
Library for mass spectrometry
|
#include <timsdata.h>
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... | |
Private Member Functions | |
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< 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::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) |
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 |
MzCalibrationStore * | mpa_mzCalibrationStore |
QMutex | m_mutex |
Definition at line 70 of file timsdata.h.
TimsData::TimsData | ( | QDir | timsDataDirectory | ) |
build using the tims data directory
Definition at line 46 of file timsdata.cpp.
References m_mapMzCalibrationRecord, m_timsDataDirectory, m_totalNumberOfPrecursors, m_totalNumberOfScans, mcsp_ms1Filter, mcsp_ms2Filter, mpa_mzCalibrationStore, mpa_timsBinDec, openDatabaseConnection(), and pappso::FilterTriangle::setTriangleSlope().
pappso::TimsData::TimsData | ( | const TimsData & | other | ) |
Copy constructor
other | TODO |
TimsData::~TimsData | ( | ) |
|
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 1277 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, and pappso::TimsXicExtractorInterface::setXicExtractMethod().
|
private |
Definition at line 658 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 532 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 319 of file timsdata.cpp.
References getMassSpectrumCstSPtr(), and getScanCoordinateFromRawIndex().
Referenced by pappso::TimsMsRunReader::massSpectrumCstSPtr().
|
private |
Definition at line 632 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 219 of file timsdata.cpp.
References m_builtinMs2Centroid.
unsigned int TimsData::getMsLevelBySpectrumIndex | ( | std::size_t | spectrum_index | ) |
Definition at line 682 of file timsdata.cpp.
References getScanCoordinateFromRawIndex(), and getTimsFrameCstSPtrCached().
Referenced by pappso::TimsMsRunReader::readSpectrumCollection().
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 553 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 691 of file timsdata.cpp.
References pappso::QualifiedMassSpectrum::appendPrecursorIonData(), getRawIndexFromCoordinate(), getScanCoordinateFromRawIndex(), getTimsFrameBaseCstSPtrCached(), getTimsFrameCstSPtrCached(), m_timsDataDirectory, 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 810 of file timsdata.cpp.
References pappso::TracePlusCombiner::combine(), getTimsFrameCstSPtrCached(), m_timsDataDirectory, mcsp_ms1Filter, 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(), and pappso::MassSpectrumId::setSpectrumIndex().
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 975 of file timsdata.cpp.
References pappso::QualifiedMassSpectrum::appendPrecursorIonData(), getTimsFrameCstSPtrCached(), m_builtinMs2Centroid, m_timsDataDirectory, mcsp_ms2Filter, 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(), and pappso::MassSpectrumId::setSpectrumIndex().
Referenced by pappso::TimsMsRunReaderMs2Selected::qualifiedMassSpectrum().
|
private |
Definition at line 270 of file timsdata.cpp.
References m_timsDataDirectory, and openDatabaseConnection().
Referenced by getQualifiedMassSpectrumByRawIndex().
|
private |
Definition at line 225 of file timsdata.cpp.
References m_timsDataDirectory, and openDatabaseConnection().
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 328 of file timsdata.cpp.
References pappso::MzCalibrationStore::getInstance(), m_mapMzCalibrationRecord, m_timsDataDirectory, mpa_mzCalibrationStore, and openDatabaseConnection().
Referenced by getTimsFrameBaseCstSPtrCached().
|
private |
Definition at line 1228 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 446 of file timsdata.cpp.
References pappso::MzCalibrationStore::getInstance(), pappso::TimsBinDec::getTimsFrameSPtrByOffset(), m_mapMzCalibrationRecord, m_timsDataDirectory, mpa_mzCalibrationStore, mpa_timsBinDec, and openDatabaseConnection().
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 1247 of file timsdata.cpp.
References getTimsFrameCstSPtr(), m_cacheSize, m_mutex, and m_timsFrameCache.
Referenced by getMassSpectrumCstSPtr(), getMsLevelBySpectrumIndex(), getQualifiedMassSpectrumByRawIndex(), getQualifiedMs1MassSpectrumByPrecursorId(), and getQualifiedMs2MassSpectrumByPrecursorId().
std::vector< std::size_t > TimsData::getTimsMS1FrameIdRange | ( | double | rt_begin, |
double | rt_end | ||
) | const |
Definition at line 412 of file timsdata.cpp.
References m_timsDataDirectory, and openDatabaseConnection().
Referenced by pappso::TimsDirectXicExtractor::extractTimsXicList().
std::size_t TimsData::getTotalNumberOfPrecursors | ( | ) | const |
get the number of precursors analyzes by PASEF
Definition at line 547 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 540 of file timsdata.cpp.
References m_totalNumberOfScans.
Referenced by pappso::TimsMsRunReader::spectrumListSize().
|
private |
Definition at line 168 of file timsdata.cpp.
References m_timsDataDirectory.
Referenced by TimsData(), extractXicListByPrecursorIds(), getPrecursorsFromMzRtCharge(), getQualifiedMassSpectrumByRawIndex(), getQualifiedMs1MassSpectrumByPrecursorId(), getQualifiedMs2MassSpectrumByPrecursorId(), getRawIndexFromCoordinate(), getScanCoordinateFromRawIndex(), getTimsFrameBaseCstSPtr(), getTimsFrameCstSPtr(), 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 1271 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 213 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 1266 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 228 of file timsdata.h.
Referenced by getMs2BuiltinCentroid(), getQualifiedMs2MassSpectrumByPrecursorId(), and setMs2BuiltinCentroid().
|
private |
Definition at line 219 of file timsdata.h.
Referenced by getTimsFrameBaseCstSPtrCached(), and getTimsFrameCstSPtrCached().
|
private |
Definition at line 231 of file timsdata.h.
Referenced by TimsData(), getTimsFrameBaseCstSPtr(), and getTimsFrameCstSPtr().
|
private |
Definition at line 235 of file timsdata.h.
Referenced by getTimsFrameBaseCstSPtrCached(), and getTimsFrameCstSPtrCached().
|
private |
Definition at line 214 of file timsdata.h.
Referenced by TimsData(), extractXicListByPrecursorIds(), getPrecursorsFromMzRtCharge(), getQualifiedMassSpectrumByRawIndex(), getQualifiedMs1MassSpectrumByPrecursorId(), getQualifiedMs2MassSpectrumByPrecursorId(), getRawIndexFromCoordinate(), getScanCoordinateFromRawIndex(), getTimsFrameBaseCstSPtr(), getTimsFrameCstSPtr(), getTimsMS1FrameIdRange(), and openDatabaseConnection().
|
private |
Definition at line 221 of file timsdata.h.
Referenced by getTimsFrameBaseCstSPtrCached().
|
private |
Definition at line 220 of file timsdata.h.
Referenced by getTimsFrameCstSPtrCached().
|
private |
Definition at line 218 of file timsdata.h.
Referenced by TimsData(), and getTotalNumberOfPrecursors().
|
private |
Definition at line 217 of file timsdata.h.
Referenced by TimsData(), and getTotalNumberOfScans().
|
private |
Definition at line 224 of file timsdata.h.
Referenced by TimsData(), getQualifiedMs1MassSpectrumByPrecursorId(), and setMs1FilterCstSPtr().
|
private |
Definition at line 223 of file timsdata.h.
Referenced by TimsData(), getQualifiedMs2MassSpectrumByPrecursorId(), and setMs2FilterCstSPtr().
|
private |
Definition at line 233 of file timsdata.h.
Referenced by TimsData(), getTimsFrameBaseCstSPtr(), and getTimsFrameCstSPtr().
|
private |
Definition at line 215 of file timsdata.h.
Referenced by TimsData(), ~TimsData(), and getTimsFrameCstSPtr().