Loading...
Searching...
No Matches
pappso::TimsDiaSlices Class Reference

`#include <timsdiaslices.h>`

## Classes

struct | MsMsWindow
struct | MsMsWindowGroup
struct | MsMsWindowGroupList
struct | FrameSliceRange

## Public Member Functions

| TimsDiaSlices (QSqlQuery &query, TimsData *tims_data_origin)
| ~TimsDiaSlices ()
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
std::size_t | getTotalSlicesCount () const
| get the number of DIA MS2 slices analyzed by PASEF
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
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 corresponding to a global slice
std::size_t | getLastMs1FrameIdByMs2FrameId (std::size_t frame_id) const

## Private Member Functions

const FrameSliceRange & | getFrameSliceRangeByGlobalSliceIndex (std::size_t global_slice_index) const

## Private Attributes

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
bool | m_builtinMs2Centroid = true
| enable builtin centroid on raw tims integers by default
std::size_t | m_totalSlicesCount

## Detailed Description

Todo
  write docs

Definition at line 37 of file timsdiaslices.h.

## Constructor & Destructor Documentation

## TimsDiaSlices()

pappso::TimsDiaSlices::TimsDiaSlices | ( | QSqlQuery & | query,
|  | TimsData * | tims_data_origin )

Default constructor

Definition at line 110 of file timsdiaslices.cpp.

: mp_timsDataOrigin(tims_data_origin)
{
/*
CREATE TABLE IF NOT EXISTS "DiaFrameMsMsWindows" (
"WindowGroup" INTEGER NOT NULL,
"ScanNumBegin" INTEGER NOT NULL,
"ScanNumEnd" INTEGER NOT NULL,
"IsolationMz" REAL NOT NULL,
"IsolationWidth" REAL NOT NULL,
"CollisionEnergy" REAL NOT NULL,
FOREIGN KEY("WindowGroup") REFERENCES "FrameMsMsWindowGroups"("Id"),
PRIMARY KEY("WindowGroup","ScanNumBegin")
) WITHOUT ROWID;
*/
if(!query.exec("SELECT WindowGroup, ScanNumBegin, ScanNumEnd, IsolationMz, "
"IsolationWidth, CollisionEnergy FROM DiaFrameMsMsWindows;"))
{
qDebug();
throw ExceptionNotFound(QObject::tr("ERROR : executing %1 :\n%2")
.arg(query.lastQuery())
.arg(query.lastError().text()));
}
else
{
qDebug() << query.size();
if(query.size() == 0)
{
qDebug();
// FIXME: this exception is thrown, but my file is DDA.
// That's not a nice info...
throw ExceptionNotFound(
QObject::tr("ERROR : DiaFrameMsMsWindows table is empty in SqlLite database"));
}
MsMsWindow msms_window;
while(query.next())
{
qDebug();
msms_window.WindowGroup = query.value(0).toLongLong();
msms_window.ScanNumBegin = query.value(1).toLongLong();
msms_window.ScanNumEnd = query.value(2).toLongLong();
msms_window.IsolationMz = query.value(3).toDouble();
msms_window.IsolationWidth = query.value(4).toDouble();
msms_window.CollisionEnergy = query.value(5).toDouble();
qDebug();
m_msMsWindowGroupList.addInGroup(msms_window);
}
if(m_msMsWindowGroupList.size() == 0)
{
qDebug();
// FIXME: this exception is thrown, but my file is DDA.
// That's not a nice info...
throw ExceptionNotFound(
QObject::tr("ERROR : no DiaFrameMsMsWindows in SqlLite database"));
}
}
qDebug();
std::size_t max_frame_id = 0;
if(!query.exec("SELECT Frame, WindowGroup FROM DiaFrameMsMsInfo;"))
{
qDebug();
throw pappso::ExceptionNotFound(
QObject::tr("ERROR : no DiaFrameMsMsInfo in SqlLite database"));
}
else
{
qDebug() << query.size();
if(query.size() == 0)
{
qDebug();
throw pappso::ExceptionNotFound(
QObject::tr("ERROR : no DiaFrameMsMsInfo in SqlLite database"));
}
while(query.next())
{
qDebug();
max_frame_id = query.value(0).toLongLong();
m_mapFrame2WindowGroupPtr[query.value(0).toLongLong()] =
m_msMsWindowGroupList.getWindowGroupPtrByGroupId(query.value(1).toLongLong());
}
if(m_mapFrame2WindowGroupPtr.size() == 0)
{
qDebug();
throw ExceptionNotFound(QObject::tr("ERROR : no DiaFrameMsMsInfo in SqlLite database"));
}
}
qDebug();
m_frameId2GlobalSliceIndexBegin.resize(max_frame_id + 1);
m_ms2frameId2Ms1FrameId.resize(max_frame_id + 1);
std::size_t last_ms1 = 0;
std::size_t previous_frame = 0;
std::size_t cumul_global_slice = 0;
m_ms1frameIdList.clear();
for(const std::pair<std::size_t, MsMsWindowGroup *> pair_frame_pgroup : m_mapFrame2WindowGroupPtr)
{
if(previous_frame != pair_frame_pgroup.first - 1)
{
last_ms1 = previous_frame + 1;
m_ms1frameIdList.push_back(last_ms1);
}
previous_frame = pair_frame_pgroup.first;
qDebug() << pair_frame_pgroup.first << " " << m_frameId2GlobalSliceIndexBegin.size();
FrameSliceRange slice_range;
qDebug() << pair_frame_pgroup.first;
slice_range.frame_id = pair_frame_pgroup.first;
slice_range.begin_global_slice_index = cumul_global_slice;
m_frameId2GlobalSliceIndexBegin[pair_frame_pgroup.first] = cumul_global_slice;
m_ms2frameId2Ms1FrameId[pair_frame_pgroup.first] = last_ms1;
cumul_global_slice += pair_frame_pgroup.second->size();
if(cumul_global_slice > 0)
slice_range.end_global_slice_index = cumul_global_slice - 1;
m_frameSliceRangeList.push_back(slice_range);
}
qDebug();
m_totalSlicesCount = cumul_global_slice;
}
pappso::TimsDiaSlices::m_ms2frameId2Ms1FrameId
std::vector< std::size_t > m_ms2frameId2Ms1FrameId
Definition timsdiaslices.h:143
pappso::TimsDiaSlices::m_msMsWindowGroupList
MsMsWindowGroupList m_msMsWindowGroupList
Definition timsdiaslices.h:140
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::m_frameId2GlobalSliceIndexBegin
std::vector< std::size_t > m_frameId2GlobalSliceIndexBegin
Definition timsdiaslices.h:142
pappso::TimsDiaSlices::m_frameSliceRangeList
std::vector< FrameSliceRange > m_frameSliceRangeList
Definition timsdiaslices.h:145
pappso::TimsDiaSlices::mp_timsDataOrigin
TimsData * mp_timsDataOrigin
Definition timsdiaslices.h:139
pappso::TimsDiaSlices::FrameSliceRange
Definition timsdiaslices.h:129
pappso::TimsDiaSlices::FrameSliceRange::frame_id
std::size_t frame_id
Definition timsdiaslices.h:130
pappso::TimsDiaSlices::MsMsWindow
Definition timsdiaslices.h:51

References m_msMsWindowGroupList, and mp_timsDataOrigin.

## ~TimsDiaSlices()

pappso::TimsDiaSlices::~TimsDiaSlices | ( |  | ) |

Destructor

Definition at line 240 of file timsdiaslices.cpp.

{
}

References ~TimsDiaSlices().

Referenced by ~TimsDiaSlices().

## Member Function Documentation

## getCombinedMs2ScansByGlobalSliceIndex()

TimsDataFastMap & pappso::TimsDiaSlices::getCombinedMs2ScansByGlobalSliceIndex | ( | std::size_t | global_slice_index | ) | const

Definition at line 318 of file timsdiaslices.cpp.

{
qDebug();
TimsDataFastMap &raw_spectrum = TimsDataFastMap::getTimsDataFastMapInstance();
raw_spectrum.clear();
try
{
FrameSliceRange range = getFrameSliceRangeByGlobalSliceIndex(global_slice_index);
MsMsWindow window = m_mapFrame2WindowGroupPtr.at(range.frame_id)
->at(global_slice_index - range.begin_global_slice_index);
qDebug();
TimsFrameCstSPtr tims_frame;
tims_frame = mp_timsDataOrigin->getTimsFrameCstSPtrCached(range.frame_id);
qDebug();
/*combiner.combine(combiner_result,
tims_frame.get()->cumulateScanToTrace(
scan_mobility_start, scan_mobility_end));*/
tims_frame.get()->combineScansInTofIndexIntensityMap(
raw_spectrum, window.ScanNumBegin, window.ScanNumEnd);
qDebug();
}
catch(PappsoException &error)
{
throw PappsoException(QObject::tr("ERROR in %1 (global_slice_index=%2):\n%3")
.arg(__FUNCTION__)
.arg(global_slice_index)
.arg(error.qwhat()));
}
catch(std::exception &error)
{
qDebug() << QString("Failure %1 ").arg(error.what());
}
return raw_spectrum;
qDebug();
}
pappso::TimsDataFastMap::getTimsDataFastMapInstance
static TimsDataFastMap & getTimsDataFastMapInstance()
Definition timsdatafastmap.cpp:40
pappso::TimsDiaSlices::getFrameSliceRangeByGlobalSliceIndex
const FrameSliceRange & getFrameSliceRangeByGlobalSliceIndex(std::size_t global_slice_index) const
Definition timsdiaslices.cpp:267
pappso::TimsFrameCstSPtr
std::shared_ptr< const TimsFrame > TimsFrameCstSPtr
Definition timsframe.h:44

References pappso::TimsDiaSlices::FrameSliceRange::begin_global_slice_index, pappso::TimsDataFastMap::clear(), pappso::TimsDiaSlices::FrameSliceRange::frame_id, getCombinedMs2ScansByGlobalSliceIndex(), getFrameSliceRangeByGlobalSliceIndex(), pappso::TimsDataFastMap::getTimsDataFastMapInstance(), m_mapFrame2WindowGroupPtr, mp_timsDataOrigin, pappso::PappsoException::qwhat(), pappso::TimsDiaSlices::MsMsWindow::ScanNumBegin, pappso::TimsDiaSlices::MsMsWindow::ScanNumEnd, and pappso::PappsoException::what().

Referenced by getCombinedMs2ScansByGlobalSliceIndex().

## getFrameIdByGlobalSliceIndex()

std::size_t pappso::TimsDiaSlices::getFrameIdByGlobalSliceIndex | ( | std::size_t | global_slice_id | ) | const

Definition at line 261 of file timsdiaslices.cpp.

{
return (getFrameSliceRangeByGlobalSliceIndex(global_slice_id).frame_id);
}

References getFrameIdByGlobalSliceIndex(), and getFrameSliceRangeByGlobalSliceIndex().

Referenced by getFrameIdByGlobalSliceIndex().

## getFrameSliceRangeByGlobalSliceIndex()

const TimsDiaSlices::FrameSliceRange & pappso::TimsDiaSlices::getFrameSliceRangeByGlobalSliceIndex | ( | std::size_t | global_slice_index | ) | const

private

Definition at line 267 of file timsdiaslices.cpp.

{
qDebug();
auto it = std::find_if(m_frameSliceRangeList.cbegin(),
m_frameSliceRangeList.cend(),
[global_slice_index](const FrameSliceRange &x) {
if(global_slice_index < x.begin_global_slice_index)
return false;
if(global_slice_index > x.end_global_slice_index)
return false;
return true;
});
if(it != m_frameSliceRangeList.cend())
{
return *it;
}
qDebug();
throw ExceptionNotFound(
QObject::tr("ERROR : GlobalSliceIndex %1 not found").arg(global_slice_index));
}
pappso::PeptideIonCter::x
@ x
Definition peptide.h:92

References getFrameSliceRangeByGlobalSliceIndex(), m_frameSliceRangeList, and pappso::x.

Referenced by getCombinedMs2ScansByGlobalSliceIndex(), getFrameIdByGlobalSliceIndex(), getFrameSliceRangeByGlobalSliceIndex(), getMs1QualifiedSpectrumByGlobalSliceIndex(), getMs2QualifiedSpectrumByGlobalSliceIndex(), and getMsMsWindowByGlobalSliceIndex().

## getGlobalSliceIndexBeginByFrameId()

std::size_t pappso::TimsDiaSlices::getGlobalSliceIndexBeginByFrameId | ( | std::size_t | frame_id | ) | const

Definition at line 256 of file timsdiaslices.cpp.

{
return (m_frameId2GlobalSliceIndexBegin[frame_id]);
}

References getGlobalSliceIndexBeginByFrameId(), and m_frameId2GlobalSliceIndexBegin.

Referenced by getGlobalSliceIndexBeginByFrameId().

## getLastMs1FrameIdByMs2FrameId()

std::size_t pappso::TimsDiaSlices::getLastMs1FrameIdByMs2FrameId | ( | std::size_t | frame_id | ) | const

Definition at line 310 of file timsdiaslices.cpp.

{
return m_ms2frameId2Ms1FrameId.at(frame_id);
}

References getLastMs1FrameIdByMs2FrameId(), and m_ms2frameId2Ms1FrameId.

Referenced by getLastMs1FrameIdByMs2FrameId(), and getMs1QualifiedSpectrumByGlobalSliceIndex().

## getMapFrame2WindowGroupPtr()

const std::map< std::size_t, TimsDiaSlices::MsMsWindowGroup * > & pappso::TimsDiaSlices::getMapFrame2WindowGroupPtr | ( |  | ) | const

Definition at line 245 of file timsdiaslices.cpp.

{
return m_mapFrame2WindowGroupPtr;
}

References getMapFrame2WindowGroupPtr(), and m_mapFrame2WindowGroupPtr.

Referenced by getMapFrame2WindowGroupPtr().

## getMs1QualifiedSpectrumByGlobalSliceIndex()

void pappso::TimsDiaSlices::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 corresponding to a global slice

Parameters

  msrun_id |
  mass_spectrum |
  global_slice_index |
  want_binary_data |
  rt_position | relative MS1 frame retention time : 0 latest MS1 frame, +1 next MS1 frame, -1 previous MS1 frame

Definition at line 498 of file timsdiaslices.cpp.

{
qDebug();
try
{
FrameSliceRange range = getFrameSliceRangeByGlobalSliceIndex(global_slice_index);
MsMsWindow window = m_mapFrame2WindowGroupPtr.at(range.frame_id)
->at(global_slice_index - range.begin_global_slice_index);
std::size_t ms1_frame_id = getLastMs1FrameIdByMs2FrameId(range.frame_id);
if(rt_position != 0)
{
std::size_t i = 0;
for(i = 0; i < m_ms1frameIdList.size(); i++)
{
if(m_ms1frameIdList.at(i) == ms1_frame_id)
break;
}
long index = (long)i + rt_position;
if((index > -1) && (index < (long)m_ms1frameIdList.size()))
ms1_frame_id = m_ms1frameIdList.at(index);
}
MassSpectrumId spectrum_id;
spectrum_id.setSpectrumIndex(global_slice_index);
spectrum_id.setNativeId(
QString("global_slice_index=%1 frame=%2 begin=%3 end=%4 group=%5 slice=%6")
.arg(global_slice_index)
.arg(ms1_frame_id)
.arg(window.ScanNumBegin)
.arg(window.ScanNumEnd)
.arg(window.WindowGroup)
.arg(window.SliceIndex));
spectrum_id.setMsRunId(msrun_id);
mass_spectrum.setMassSpectrumId(spectrum_id);
mass_spectrum.setMsLevel(1);
// mass_spectrum.setPrecursorSpectrumIndex(spectrum_descr.ms1_index);
mass_spectrum.setEmptyMassSpectrum(true);
qDebug();
// get precursor ion data
// mass_spectrum.appendPrecursorIonData(spectrum_descr.precursor_ion_data);
qDebug() << window.ScanNumBegin;
mass_spectrum.setParameterValue(QualifiedMassSpectrumParameter::TimsFrameIonMobScanIndexBegin,
(qulonglong)window.ScanNumBegin);
qDebug() << window.ScanNumEnd;
mass_spectrum.setParameterValue(QualifiedMassSpectrumParameter::TimsFrameIonMobScanIndexEnd,
(qulonglong)window.ScanNumEnd);
qDebug();
TimsFrameBaseCstSPtr tims_frame;
if(want_binary_data)
{
qDebug() << "bindec";
tims_frame = mp_timsDataOrigin->getTimsFrameCstSPtrCached(ms1_frame_id);
}
else
{
tims_frame = mp_timsDataOrigin->getTimsFrameBaseCstSPtrCached(ms1_frame_id);
}
mass_spectrum.setRtInSeconds(tims_frame.get()->getRtInSeconds());
mass_spectrum.setParameterValue(
QualifiedMassSpectrumParameter::IonMobOneOverK0Begin,
tims_frame.get()->getOneOverK0Transformation(window.ScanNumBegin));
mass_spectrum.setParameterValue(
QualifiedMassSpectrumParameter::IonMobOneOverK0End,
tims_frame.get()->getOneOverK0Transformation(window.ScanNumEnd));
qDebug();
/*combiner.combine(combiner_result,
tims_frame.get()->cumulateScanToTrace(
scan_mobility_start, scan_mobility_end));*/
if(want_binary_data)
{
double mz = (window.IsolationMz - (window.IsolationWidth / 2));
qDebug() << mz;
quint32 tof_index_begin =
tims_frame.get()->getMzCalibrationInterfaceSPtr().get()->getTofIndexFromMz(mz);
mz = (window.IsolationMz + (window.IsolationWidth / 2));
qDebug() << mz;
quint32 tof_index_end =
tims_frame.get()->getMzCalibrationInterfaceSPtr().get()->getTofIndexFromMz(mz);
qDebug() << "tof_index_begin=" << tof_index_begin << " tof_index_end=" << tof_index_end;
TimsDataFastMap &raw_spectrum = TimsDataFastMap::getTimsDataFastMapInstance();
raw_spectrum.clear();
tims_frame.get()->combineScansInTofIndexIntensityMap(
raw_spectrum, window.ScanNumBegin, window.ScanNumEnd, tof_index_begin, tof_index_end);
Trace trace;
if(m_builtinMs2Centroid)
{
// raw_spectrum.removeArtefactualSpike();
raw_spectrum.builtInCentroid();
}
trace = tims_frame.get()->getTraceFromTofIndexIntensityMap(raw_spectrum);
if(trace.size() > 0)
{
mass_spectrum.setMassSpectrumSPtr(MassSpectrum(trace).makeMassSpectrumSPtr());
mass_spectrum.setEmptyMassSpectrum(false);
}
else
{
mass_spectrum.setMassSpectrumSPtr(nullptr);
mass_spectrum.setEmptyMassSpectrum(true);
}
}
qDebug();
}
catch(PappsoException &error)
{
throw PappsoException(QObject::tr("ERROR in %1 (global_slice_index=%2):\n%3")
.arg(__FUNCTION__)
.arg(global_slice_index)
.arg(error.qwhat()));
}
catch(std::exception &error)
{
qDebug() << QString("Failure %1 ").arg(error.what());
}
qDebug();
}
pappso::TimsDiaSlices::getLastMs1FrameIdByMs2FrameId
std::size_t getLastMs1FrameIdByMs2FrameId(std::size_t frame_id) const
Definition timsdiaslices.cpp:310
pappso::TimsDiaSlices::m_builtinMs2Centroid
bool m_builtinMs2Centroid
enable builtin centroid on raw tims integers by default
Definition timsdiaslices.h:149
pappso::Enums::PrecisionUnit::mz
@ mz
Definition types.h:101
pappso::TimsFrameBaseCstSPtr
std::shared_ptr< const TimsFrameBase > TimsFrameBaseCstSPtr
Definition timsframebase.h:43
pappso::QualifiedMassSpectrumParameter::TimsFrameIonMobScanIndexBegin
@ TimsFrameIonMobScanIndexBegin
Definition qualifiedmassspectrum.h:55
pappso::QualifiedMassSpectrumParameter::TimsFrameIonMobScanIndexEnd
@ TimsFrameIonMobScanIndexEnd
Definition qualifiedmassspectrum.h:56
pappso::QualifiedMassSpectrumParameter::IonMobOneOverK0Begin
@ IonMobOneOverK0Begin
1/K0 range's begin value
Definition qualifiedmassspectrum.h:51
pappso::QualifiedMassSpectrumParameter::IonMobOneOverK0End
@ IonMobOneOverK0End
1/K0 range's end value
Definition qualifiedmassspectrum.h:52

References pappso::TimsDiaSlices::FrameSliceRange::begin_global_slice_index, pappso::TimsDataFastMap::builtInCentroid(), pappso::TimsDataFastMap::clear(), pappso::TimsDiaSlices::FrameSliceRange::frame_id, getFrameSliceRangeByGlobalSliceIndex(), getLastMs1FrameIdByMs2FrameId(), getMs1QualifiedSpectrumByGlobalSliceIndex(), pappso::TimsDataFastMap::getTimsDataFastMapInstance(), pappso::IonMobOneOverK0Begin, pappso::IonMobOneOverK0End, pappso::TimsDiaSlices::MsMsWindow::IsolationMz, pappso::TimsDiaSlices::MsMsWindow::IsolationWidth, m_builtinMs2Centroid, m_mapFrame2WindowGroupPtr, m_ms1frameIdList, mp_timsDataOrigin, pappso::PappsoException::qwhat(), pappso::TimsDiaSlices::MsMsWindow::ScanNumBegin, pappso::TimsDiaSlices::MsMsWindow::ScanNumEnd, pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), pappso::QualifiedMassSpectrum::setMassSpectrumId(), pappso::QualifiedMassSpectrum::setMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::setMsLevel(), pappso::MassSpectrumId::setMsRunId(), pappso::MassSpectrumId::setNativeId(), pappso::QualifiedMassSpectrum::setParameterValue(), pappso::QualifiedMassSpectrum::setRtInSeconds(), pappso::MassSpectrumId::setSpectrumIndex(), pappso::TimsDiaSlices::MsMsWindow::SliceIndex, pappso::TimsFrameIonMobScanIndexBegin, pappso::TimsFrameIonMobScanIndexEnd, pappso::PappsoException::what(), and pappso::TimsDiaSlices::MsMsWindow::WindowGroup.

Referenced by getMs1QualifiedSpectrumByGlobalSliceIndex().

## getMs2QualifiedSpectrumByGlobalSliceIndex()

void pappso::TimsDiaSlices::getMs2QualifiedSpectrumByGlobalSliceIndex | ( | const MsRunIdCstSPtr & | msrun_id,
|  | QualifiedMassSpectrum & | mass_spectrum,
|  | std::size_t | global_slice_index,
|  | bool | want_binary_data ) const

Definition at line 357 of file timsdiaslices.cpp.

{
qDebug();
try
{
FrameSliceRange range = getFrameSliceRangeByGlobalSliceIndex(global_slice_index);
MsMsWindow window = m_mapFrame2WindowGroupPtr.at(range.frame_id)
->at(global_slice_index - range.begin_global_slice_index);
MassSpectrumId spectrum_id;
spectrum_id.setSpectrumIndex(global_slice_index);
spectrum_id.setNativeId(
QString("global_slice_index=%1 frame=%2 begin=%3 end=%4 group=%5 slice=%6")
.arg(global_slice_index)
.arg(range.frame_id)
.arg(window.ScanNumBegin)
.arg(window.ScanNumEnd)
.arg(window.WindowGroup)
.arg(window.SliceIndex));
spectrum_id.setMsRunId(msrun_id);
mass_spectrum.setMassSpectrumId(spectrum_id);
mass_spectrum.setMsLevel(2);
// mass_spectrum.setPrecursorSpectrumIndex(spectrum_descr.ms1_index);
mass_spectrum.setEmptyMassSpectrum(true);
qDebug();
// get precursor ion data
// mass_spectrum.appendPrecursorIonData(spectrum_descr.precursor_ion_data);
mass_spectrum.setPrecursorNativeId(QString("frame_id=%1 begin=%2 end=%3 group=%4 slice=%5")
.arg(m_ms2frameId2Ms1FrameId.at(range.frame_id))
.arg(window.ScanNumBegin)
.arg(window.ScanNumEnd)
.arg(window.WindowGroup)
.arg(window.SliceIndex));
mass_spectrum.setParameterValue(QualifiedMassSpectrumParameter::IsolationMz,
window.IsolationMz);
mass_spectrum.setParameterValue(QualifiedMassSpectrumParameter::IsolationMzWidth,
window.IsolationWidth);
mass_spectrum.setParameterValue(QualifiedMassSpectrumParameter::CollisionEnergy,
window.CollisionEnergy);
qDebug() << window.ScanNumBegin;
mass_spectrum.setParameterValue(QualifiedMassSpectrumParameter::TimsFrameIonMobScanIndexBegin,
(qulonglong)window.ScanNumBegin);
qDebug() << window.ScanNumEnd;
mass_spectrum.setParameterValue(QualifiedMassSpectrumParameter::TimsFrameIonMobScanIndexEnd,
(qulonglong)window.ScanNumEnd);
qDebug();
TimsFrameBaseCstSPtr tims_frame;
if(want_binary_data)
{
qDebug() << "bindec";
tims_frame = mp_timsDataOrigin->getTimsFrameCstSPtrCached(range.frame_id);
}
else
{
tims_frame = mp_timsDataOrigin->getTimsFrameBaseCstSPtrCached(range.frame_id);
}
mass_spectrum.setRtInSeconds(tims_frame.get()->getRtInSeconds());
mass_spectrum.setParameterValue(
QualifiedMassSpectrumParameter::IonMobOneOverK0Begin,
tims_frame.get()->getOneOverK0Transformation(window.ScanNumBegin));
mass_spectrum.setParameterValue(
QualifiedMassSpectrumParameter::IonMobOneOverK0End,
tims_frame.get()->getOneOverK0Transformation(window.ScanNumEnd));
qDebug();
/*combiner.combine(combiner_result,
tims_frame.get()->cumulateScanToTrace(
scan_mobility_start, scan_mobility_end));*/
if(want_binary_data)
{
TimsDataFastMap &raw_spectrum = TimsDataFastMap::getTimsDataFastMapInstance();
raw_spectrum.clear();
tims_frame.get()->combineScansInTofIndexIntensityMap(
raw_spectrum, window.ScanNumBegin, window.ScanNumEnd);
Trace trace;
if(m_builtinMs2Centroid)
{
// raw_spectrum.removeArtefactualSpike();
raw_spectrum.builtInCentroid();
}
trace = tims_frame.get()->getTraceFromTofIndexIntensityMap(raw_spectrum);
if(trace.size() > 0)
{
mass_spectrum.setMassSpectrumSPtr(MassSpectrum(trace).makeMassSpectrumSPtr());
mass_spectrum.setEmptyMassSpectrum(false);
}
else
{
mass_spectrum.setMassSpectrumSPtr(nullptr);
mass_spectrum.setEmptyMassSpectrum(true);
}
}
qDebug();
}
catch(PappsoException &error)
{
throw PappsoException(QObject::tr("ERROR in %1 (global_slice_index=%2):\n%3")
.arg(__FUNCTION__)
.arg(global_slice_index)
.arg(error.qwhat()));
}
catch(std::exception &error)
{
qDebug() << QString("Failure %1 ").arg(error.what());
}
qDebug();
}
pappso::QualifiedMassSpectrumParameter::IsolationMzWidth
@ IsolationMzWidth
m/z isolation window width (left + right)
Definition qualifiedmassspectrum.h:59
pappso::QualifiedMassSpectrumParameter::CollisionEnergy
@ CollisionEnergy
Bruker's timsTOF collision energy.
Definition qualifiedmassspectrum.h:61
pappso::QualifiedMassSpectrumParameter::IsolationMz
@ IsolationMz
Isolation m/z value.
Definition qualifiedmassspectrum.h:58

References pappso::TimsDiaSlices::FrameSliceRange::begin_global_slice_index, pappso::TimsDataFastMap::builtInCentroid(), pappso::TimsDataFastMap::clear(), pappso::CollisionEnergy, pappso::TimsDiaSlices::MsMsWindow::CollisionEnergy, pappso::TimsDiaSlices::FrameSliceRange::frame_id, getFrameSliceRangeByGlobalSliceIndex(), getMs2QualifiedSpectrumByGlobalSliceIndex(), pappso::TimsDataFastMap::getTimsDataFastMapInstance(), pappso::IonMobOneOverK0Begin, pappso::IonMobOneOverK0End, pappso::IsolationMz, pappso::TimsDiaSlices::MsMsWindow::IsolationMz, pappso::IsolationMzWidth, pappso::TimsDiaSlices::MsMsWindow::IsolationWidth, m_builtinMs2Centroid, m_mapFrame2WindowGroupPtr, m_ms2frameId2Ms1FrameId, mp_timsDataOrigin, pappso::PappsoException::qwhat(), pappso::TimsDiaSlices::MsMsWindow::ScanNumBegin, pappso::TimsDiaSlices::MsMsWindow::ScanNumEnd, pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), pappso::QualifiedMassSpectrum::setMassSpectrumId(), pappso::QualifiedMassSpectrum::setMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::setMsLevel(), pappso::MassSpectrumId::setMsRunId(), pappso::MassSpectrumId::setNativeId(), pappso::QualifiedMassSpectrum::setParameterValue(), pappso::QualifiedMassSpectrum::setPrecursorNativeId(), pappso::QualifiedMassSpectrum::setRtInSeconds(), pappso::MassSpectrumId::setSpectrumIndex(), pappso::TimsDiaSlices::MsMsWindow::SliceIndex, pappso::TimsFrameIonMobScanIndexBegin, pappso::TimsFrameIonMobScanIndexEnd, pappso::PappsoException::what(), and pappso::TimsDiaSlices::MsMsWindow::WindowGroup.

Referenced by getMs2QualifiedSpectrumByGlobalSliceIndex().

## getMsMsWindowByGlobalSliceIndex()

const TimsDiaSlices::MsMsWindow & pappso::TimsDiaSlices::getMsMsWindowByGlobalSliceIndex | ( | std::size_t | global_slice_index | ) | const

Definition at line 297 of file timsdiaslices.cpp.

{
qDebug() << global_slice_index;
const TimsDiaSlices::FrameSliceRange &range =
getFrameSliceRangeByGlobalSliceIndex(global_slice_index);
qDebug() << "range.frame_id=" << range.frame_id
<< " range.begin_global_slice_index=" << range.begin_global_slice_index;
return m_mapFrame2WindowGroupPtr.at(range.frame_id)
->at(global_slice_index - range.begin_global_slice_index);
}

References pappso::TimsDiaSlices::FrameSliceRange::begin_global_slice_index, pappso::TimsDiaSlices::FrameSliceRange::frame_id, getFrameSliceRangeByGlobalSliceIndex(), getMsMsWindowByGlobalSliceIndex(), and m_mapFrame2WindowGroupPtr.

Referenced by getMsMsWindowByGlobalSliceIndex().

## getMsMsWindowGroupList()

const TimsDiaSlices::MsMsWindowGroupList & pappso::TimsDiaSlices::getMsMsWindowGroupList | ( |  | ) | const

Definition at line 250 of file timsdiaslices.cpp.

{
return m_msMsWindowGroupList;
}

References getMsMsWindowGroupList(), and m_msMsWindowGroupList.

Referenced by getMsMsWindowGroupList().

## getTotalSlicesCount()

std::size_t pappso::TimsDiaSlices::getTotalSlicesCount | ( |  | ) | const

get the number of DIA MS2 slices analyzed by PASEF

Definition at line 291 of file timsdiaslices.cpp.

{
return m_totalSlicesCount;
}

References getTotalSlicesCount(), and m_totalSlicesCount.

Referenced by getTotalSlicesCount().

## Member Data Documentation

## m_builtinMs2Centroid

bool pappso::TimsDiaSlices::m_builtinMs2Centroid = true

private

enable builtin centroid on raw tims integers by default

Definition at line 149 of file timsdiaslices.h.

Referenced by getMs1QualifiedSpectrumByGlobalSliceIndex(), and getMs2QualifiedSpectrumByGlobalSliceIndex().

## m_frameId2GlobalSliceIndexBegin

std::vector<std::size_t> pappso::TimsDiaSlices::m_frameId2GlobalSliceIndexBegin

private

Definition at line 142 of file timsdiaslices.h.

Referenced by getGlobalSliceIndexBeginByFrameId().

## m_frameSliceRangeList

std::vector<FrameSliceRange> pappso::TimsDiaSlices::m_frameSliceRangeList

private

Definition at line 145 of file timsdiaslices.h.

Referenced by getFrameSliceRangeByGlobalSliceIndex().

## m_mapFrame2WindowGroupPtr

std::map<std::size_t, MsMsWindowGroup *> pappso::TimsDiaSlices::m_mapFrame2WindowGroupPtr

private

Definition at line 141 of file timsdiaslices.h.

Referenced by getCombinedMs2ScansByGlobalSliceIndex(), getMapFrame2WindowGroupPtr(), getMs1QualifiedSpectrumByGlobalSliceIndex(), getMs2QualifiedSpectrumByGlobalSliceIndex(), and getMsMsWindowByGlobalSliceIndex().

## m_ms1frameIdList

std::vector<std::size_t> pappso::TimsDiaSlices::m_ms1frameIdList

private

Definition at line 144 of file timsdiaslices.h.

Referenced by getMs1QualifiedSpectrumByGlobalSliceIndex().

## m_ms2frameId2Ms1FrameId

std::vector<std::size_t> pappso::TimsDiaSlices::m_ms2frameId2Ms1FrameId

private

Definition at line 143 of file timsdiaslices.h.

Referenced by getLastMs1FrameIdByMs2FrameId(), and getMs2QualifiedSpectrumByGlobalSliceIndex().

## m_msMsWindowGroupList

MsMsWindowGroupList pappso::TimsDiaSlices::m_msMsWindowGroupList

private

Definition at line 140 of file timsdiaslices.h.

Referenced by TimsDiaSlices(), and getMsMsWindowGroupList().

## m_totalSlicesCount

std::size_t pappso::TimsDiaSlices::m_totalSlicesCount

private

Definition at line 151 of file timsdiaslices.h.

Referenced by getTotalSlicesCount().

## mp_timsDataOrigin

TimsData* pappso::TimsDiaSlices::mp_timsDataOrigin

private

Definition at line 139 of file timsdiaslices.h.

Referenced by TimsDiaSlices(), getCombinedMs2ScansByGlobalSliceIndex(), getMs1QualifiedSpectrumByGlobalSliceIndex(), and getMs2QualifiedSpectrumByGlobalSliceIndex().

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

- pappsomspp/core/vendors/tims/timsdiaslices.h
- pappsomspp/core/vendors/tims/timsdiaslices.cpp