Loading...
Searching...
No Matches
timsdiaslices.h
Go to the documentation of this file.
/**
* \file pappsomspp/vendors/tims/timsdiaslices.h
* \date 02/07/2024
* \brief handle specific data for DIA MS runs
*/
/*******************************************************************************
* Copyright (c) 2024 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include "timsdata.h"
#include "pappsomspp/export-import-config.h"
namespace pappso
{
/**
* @todo write docs
*/
class PMSPP_LIB_DECL TimsDiaSlices
{
public:
/**
* Default constructor
*/
TimsDiaSlices(QSqlQuery &query, TimsData *tims_data_origin);
/**
* Destructor
*/
~TimsDiaSlices();
struct MsMsWindow
{
/** @brief tell if given mz is in range for this window
*/
bool isMzInRange(double mz) const;
std::size_t SliceIndex = 0;
std::size_t WindowGroup;
std::size_t ScanNumBegin;
std::size_t ScanNumEnd;
double IsolationMz;
double IsolationWidth;
double CollisionEnergy;
};
struct MsMsWindowGroup : std::vector<MsMsWindow>
{
std::size_t WindowGroup;
};
struct MsMsWindowGroupList : std::vector<MsMsWindowGroup *>
{
~MsMsWindowGroupList();
void addInGroup(const MsMsWindow &window);
MsMsWindowGroup *
getWindowGroupPtrByGroupId(std::size_t window_group_id) const;
};
const MsMsWindowGroupList &getMsMsWindowGroupList() const;
const std::map<std::size_t, MsMsWindowGroup *> &
getMapFrame2WindowGroupPtr() const;
std::size_t getGlobalSliceIndexBeginByFrameId(std::size_t frame_id) const;
std::size_t getFrameIdByGlobalSliceIndex(std::size_t global_slice_id) const;
/** @brief get the number of DIA MS2 slices analyzed by PASEF
*/
std::size_t getTotalSlicesCount() const;
const MsMsWindow &
getMsMsWindowByGlobalSliceIndex(std::size_t global_slice_index) const;
TimsDataFastMap &
getCombinedMs2ScansByGlobalSliceIndex(std::size_t global_slice_index) const;
void getMs2QualifiedSpectrumByGlobalSliceIndex(
const MsRunIdCstSPtr &msrun_id,
QualifiedMassSpectrum &mass_spectrum,
std::size_t global_slice_index,
bool want_binary_data) const;
/** @brief get MS1 spectrum corresponding to the given slice
* extract MS1 mz range and mobility range corresponding to a global slice
* @param msrun_id
* @param mass_spectrum
* @param global_slice_index
* @param want_binary_data
* @param rt_position relative MS1 frame retention time : 0 latest MS1 frame,
* +1 next MS1 frame, -1 previous MS1 frame
*/
void getMs1QualifiedSpectrumByGlobalSliceIndex(
const MsRunIdCstSPtr &msrun_id,
QualifiedMassSpectrum &mass_spectrum,
std::size_t global_slice_index,
bool want_binary_data,
int rt_position = 0) const;
std::size_t getLastMs1FrameIdByMs2FrameId(std::size_t frame_id) const;
private:
struct FrameSliceRange
{
std::size_t frame_id;
std::size_t begin_global_slice_index;
std::size_t end_global_slice_index;
};
const FrameSliceRange &
getFrameSliceRangeByGlobalSliceIndex(std::size_t global_slice_index) const;
private:
TimsData *mp_timsDataOrigin;
MsMsWindowGroupList m_msMsWindowGroupList;
std::map<std::size_t, MsMsWindowGroup *> m_mapFrame2WindowGroupPtr;
std::vector<std::size_t> m_frameId2GlobalSliceIndexBegin;
std::vector<std::size_t> m_ms2frameId2Ms1FrameId;
std::vector<std::size_t> m_ms1frameIdList;
std::vector<FrameSliceRange> m_frameSliceRangeList;
/** @brief enable builtin centroid on raw tims integers by default
*/
bool m_builtinMs2Centroid = true;
std::size_t m_totalSlicesCount;
};
} // namespace pappso
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition qualifiedmassspectrum.h:99
pappso::TimsDataFastMap
replacement for std::map
Definition timsdatafastmap.h:46
pappso::TimsData
Definition timsdata.h:68
pappso::TimsDiaSlices::m_ms2frameId2Ms1FrameId
std::vector< std::size_t > m_ms2frameId2Ms1FrameId
Definition timsdiaslices.h:143
pappso::TimsDiaSlices::getCombinedMs2ScansByGlobalSliceIndex
TimsDataFastMap & getCombinedMs2ScansByGlobalSliceIndex(std::size_t global_slice_index) const
Definition timsdiaslices.cpp:318
pappso::TimsDiaSlices::getGlobalSliceIndexBeginByFrameId
std::size_t getGlobalSliceIndexBeginByFrameId(std::size_t frame_id) const
Definition timsdiaslices.cpp:256
pappso::TimsDiaSlices::getLastMs1FrameIdByMs2FrameId
std::size_t getLastMs1FrameIdByMs2FrameId(std::size_t frame_id) const
Definition timsdiaslices.cpp:310
pappso::TimsDiaSlices::getFrameSliceRangeByGlobalSliceIndex
const FrameSliceRange & getFrameSliceRangeByGlobalSliceIndex(std::size_t global_slice_index) const
Definition timsdiaslices.cpp:267
pappso::TimsDiaSlices::m_msMsWindowGroupList
MsMsWindowGroupList m_msMsWindowGroupList
Definition timsdiaslices.h:140
pappso::TimsDiaSlices::getMsMsWindowByGlobalSliceIndex
const MsMsWindow & getMsMsWindowByGlobalSliceIndex(std::size_t global_slice_index) const
Definition timsdiaslices.cpp:297
pappso::TimsDiaSlices::m_builtinMs2Centroid
bool m_builtinMs2Centroid
enable builtin centroid on raw tims integers by default
Definition timsdiaslices.h:149
pappso::TimsDiaSlices::m_ms1frameIdList
std::vector< std::size_t > m_ms1frameIdList
Definition timsdiaslices.h:144
pappso::TimsDiaSlices::m_mapFrame2WindowGroupPtr
std::map< std::size_t, MsMsWindowGroup * > m_mapFrame2WindowGroupPtr
Definition timsdiaslices.h:141
pappso::TimsDiaSlices::m_totalSlicesCount
std::size_t m_totalSlicesCount
Definition timsdiaslices.h:151
pappso::TimsDiaSlices::getFrameIdByGlobalSliceIndex
std::size_t getFrameIdByGlobalSliceIndex(std::size_t global_slice_id) const
Definition timsdiaslices.cpp:261
pappso::TimsDiaSlices::m_frameId2GlobalSliceIndexBegin
std::vector< std::size_t > m_frameId2GlobalSliceIndexBegin
Definition timsdiaslices.h:142
pappso::TimsDiaSlices::getMs2QualifiedSpectrumByGlobalSliceIndex
void getMs2QualifiedSpectrumByGlobalSliceIndex(const MsRunIdCstSPtr &msrun_id, QualifiedMassSpectrum &mass_spectrum, std::size_t global_slice_index, bool want_binary_data) const
Definition timsdiaslices.cpp:357
pappso::TimsDiaSlices::getMapFrame2WindowGroupPtr
const std::map< std::size_t, MsMsWindowGroup * > & getMapFrame2WindowGroupPtr() const
Definition timsdiaslices.cpp:245
pappso::TimsDiaSlices::getMs1QualifiedSpectrumByGlobalSliceIndex
void getMs1QualifiedSpectrumByGlobalSliceIndex(const MsRunIdCstSPtr &msrun_id, QualifiedMassSpectrum &mass_spectrum, std::size_t global_slice_index, bool want_binary_data, int rt_position=0) const
get MS1 spectrum corresponding to the given slice extract MS1 mz range and mobility range correspondi...
Definition timsdiaslices.cpp:498
pappso::TimsDiaSlices::TimsDiaSlices
TimsDiaSlices(QSqlQuery &query, TimsData *tims_data_origin)
Definition timsdiaslices.cpp:110
pappso::TimsDiaSlices::m_frameSliceRangeList
std::vector< FrameSliceRange > m_frameSliceRangeList
Definition timsdiaslices.h:145
pappso::TimsDiaSlices::getTotalSlicesCount
std::size_t getTotalSlicesCount() const
get the number of DIA MS2 slices analyzed by PASEF
Definition timsdiaslices.cpp:291
pappso::TimsDiaSlices::getMsMsWindowGroupList
const MsMsWindowGroupList & getMsMsWindowGroupList() const
Definition timsdiaslices.cpp:250
pappso::TimsDiaSlices::mp_timsDataOrigin
TimsData * mp_timsDataOrigin
Definition timsdiaslices.h:139
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::MsRunIdCstSPtr
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46
pappso::TimsDiaSlices::FrameSliceRange
Definition timsdiaslices.h:129
pappso::TimsDiaSlices::FrameSliceRange::end_global_slice_index
std::size_t end_global_slice_index
Definition timsdiaslices.h:132
pappso::TimsDiaSlices::FrameSliceRange::frame_id
std::size_t frame_id
Definition timsdiaslices.h:130
pappso::TimsDiaSlices::FrameSliceRange::begin_global_slice_index
std::size_t begin_global_slice_index
Definition timsdiaslices.h:131
pappso::TimsDiaSlices::MsMsWindowGroupList
Definition timsdiaslices.h:71
pappso::TimsDiaSlices::MsMsWindowGroupList::getWindowGroupPtrByGroupId
MsMsWindowGroup * getWindowGroupPtrByGroupId(std::size_t window_group_id) const
Definition timsdiaslices.cpp:93
pappso::TimsDiaSlices::MsMsWindowGroupList::addInGroup
void addInGroup(const MsMsWindow &window)
Definition timsdiaslices.cpp:56
pappso::TimsDiaSlices::MsMsWindowGroup
Definition timsdiaslices.h:66
pappso::TimsDiaSlices::MsMsWindowGroup::WindowGroup
std::size_t WindowGroup
Definition timsdiaslices.h:67
pappso::TimsDiaSlices::MsMsWindow
Definition timsdiaslices.h:51
pappso::TimsDiaSlices::MsMsWindow::IsolationMz
double IsolationMz
Definition timsdiaslices.h:60
pappso::TimsDiaSlices::MsMsWindow::ScanNumBegin
std::size_t ScanNumBegin
Definition timsdiaslices.h:58
pappso::TimsDiaSlices::MsMsWindow::CollisionEnergy
double CollisionEnergy
Definition timsdiaslices.h:62
pappso::TimsDiaSlices::MsMsWindow::WindowGroup
std::size_t WindowGroup
Definition timsdiaslices.h:57
pappso::TimsDiaSlices::MsMsWindow::isMzInRange
bool isMzInRange(double mz) const
tell if given mz is in range for this window
Definition timsdiaslices.cpp:37
pappso::TimsDiaSlices::MsMsWindow::SliceIndex
std::size_t SliceIndex
Definition timsdiaslices.h:56
pappso::TimsDiaSlices::MsMsWindow::ScanNumEnd
std::size_t ScanNumEnd
Definition timsdiaslices.h:59
pappso::TimsDiaSlices::MsMsWindow::IsolationWidth
double IsolationWidth
Definition timsdiaslices.h:61
timsdata.h