Loading...
Searching...
No Matches
pappso::masschroq::MsRunGroup Class Reference

`#include <msrungroup.h>`

## Public Member Functions

| MsRunGroup (const QString &id, const std::vector< MsRunPeptideListSp > &msrun_list)
| MsRunGroup (const MsRunGroup &other)
virtual | ~MsRunGroup ()
void | setIonMobilityGridSp (const std::shared_ptr< pappso::IonMobilityGrid > &ion_mobility_grid_sp)
void | align (CborOutputStream &cbor_output, const QString &align_id, pappso::UiMonitorInterface &m_uiMonitor) const
void | quantify (CborOutputStream &cbor_output, const QString &quantify_id, const QString &tmp_dir, pappso::UiMonitorInterface &m_uiMonitor, const QuantificationMethodSp &quantification_method, const std::vector< PeptideSp > &peptide_sp_list) const
void | setAlignmentMethodSp (const AlignmentMethodSp &alignment_method_sp, const QString &msrun_ref_id)
bool | contains (const MsRun *msrun_p) const
bool | hasTimsTofMobilityIndex () const
const std::shared_ptr< pappso::IonMobilityGrid > & | getIonMobilityGridSp () const
const QString & | getId () const

## Private Member Functions

void | alignRetentionTimeBetweenMsRuns (CborOutputStream &cbor_output, pappso::UiMonitorInterface &m_uiMonitor) const

## Private Attributes

const QString | m_id
const std::vector< MsRunPeptideListSp > | m_msRunPeptideListSpList
AlignmentMethodSp | msp_alignmentMethod
MsRunPeptideListSp | msp_msRunPeptideListAlignmentReference
bool | m_hasTimsTofMobilityIndex = false
std::shared_ptr< pappso::IonMobilityGrid > | msp_ionMobilityGrid

## Detailed Description

Todo
  write docs

Definition at line 47 of file msrungroup.h.

## Constructor & Destructor Documentation

## MsRunGroup() [1/2]

pappso::masschroq::MsRunGroup::MsRunGroup | ( | const QString & | id,
|  | const std::vector< MsRunPeptideListSp > & | msrun_list )

Default constructor

Definition at line 32 of file msrungroup.cpp.

: m_id(id), m_msRunPeptideListSpList(msrun_list)
{
if(m_msRunPeptideListSpList.size() > 0)
{
m_hasTimsTofMobilityIndex =
m_msRunPeptideListSpList.front().get()->getMsRunSp().get()->hasTimsTofMobilityIndex();
}
}
pappso::masschroq::MsRunGroup::m_hasTimsTofMobilityIndex
bool m_hasTimsTofMobilityIndex
Definition msrungroup.h:102
pappso::masschroq::MsRunGroup::m_id
const QString m_id
Definition msrungroup.h:98
pappso::masschroq::MsRunGroup::m_msRunPeptideListSpList
const std::vector< MsRunPeptideListSp > m_msRunPeptideListSpList
Definition msrungroup.h:99

References m_id, and m_msRunPeptideListSpList.

## MsRunGroup() [2/2]

pappso::masschroq::MsRunGroup::MsRunGroup | ( | const MsRunGroup & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 43 of file msrungroup.cpp.

: m_id(other.m_id), m_msRunPeptideListSpList(other.m_msRunPeptideListSpList)
{
m_hasTimsTofMobilityIndex = other.m_hasTimsTofMobilityIndex;
}

References m_hasTimsTofMobilityIndex, m_id, and m_msRunPeptideListSpList.

## ~MsRunGroup()

pappso::masschroq::MsRunGroup::~MsRunGroup | ( |  | ) |

virtual

Destructor

Definition at line 49 of file msrungroup.cpp.

{
}

## Member Function Documentation

## align()

void pappso::masschroq::MsRunGroup::align | ( | CborOutputStream & | cbor_output,
|  | const QString & | align_id,
|  | pappso::UiMonitorInterface & | m_uiMonitor ) const

Definition at line 128 of file msrungroup.cpp.

{
cbor_output.getCborStreamWriter().startMap();
cbor_output.getCborStreamWriter().append(QLatin1String("alignment_id"));
cbor_output.getCborStreamWriter().append(align_id);
cbor_output.getCborStreamWriter().append(QLatin1String("group_id"));
cbor_output.getCborStreamWriter().append(getId());
cbor_output.getCborStreamWriter().append(QLatin1String("timestamp1"));
cbor_output.getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
// std::shared_ptr<pappso::MsRunRetentionTime<QString>>
// retention_time_reference_sp = nullptr;
m_uiMonitor.appendText("Starting retention time alignment");
alignRetentionTimeBetweenMsRuns(cbor_output, m_uiMonitor);
m_uiMonitor.appendText("retention time alignment done");
cbor_output.getCborStreamWriter().append(QLatin1String("timestamp2"));
cbor_output.getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
cbor_output.getCborStreamWriter().endMap();
}
pappso::UiMonitorInterface::appendText
virtual void appendText(const QString &text)=0
append a text to a long report
pappso::masschroq::MsRunGroup::getId
const QString & getId() const
Definition msrungroup.cpp:340
pappso::masschroq::MsRunGroup::alignRetentionTimeBetweenMsRuns
void alignRetentionTimeBetweenMsRuns(CborOutputStream &cbor_output, pappso::UiMonitorInterface &m_uiMonitor) const
Definition msrungroup.cpp:54

References alignRetentionTimeBetweenMsRuns(), pappso::UiMonitorInterface::appendText(), pappso::masschroq::CborOutputStream::getCborStreamWriter(), and getId().

## alignRetentionTimeBetweenMsRuns()

void pappso::masschroq::MsRunGroup::alignRetentionTimeBetweenMsRuns | ( | CborOutputStream & | cbor_output,
|  | pappso::UiMonitorInterface & | m_uiMonitor ) const

private

Definition at line 54 of file msrungroup.cpp.

{
if(msp_msRunPeptideListAlignmentReference.get() == nullptr)
{
throw pappso::PappsoException(QObject::tr("match between run requires an MSrun reference"));
}
cbor_output.getCborStreamWriter().append(QLatin1String("alignment"));
cbor_output.getCborStreamWriter().startMap();
cbor_output.getCborStreamWriter().append(QLatin1String("msrun_ref"));
cbor_output.getCborStreamWriter().append(msp_msRunPeptideListAlignmentReference.get()
->getMsRunSp()
.get()
->getMsRunReaderSPtr()
.get()
->getMsRunId()
.get()
->getXmlId());
// "alignment": {
// "msrun_ref": "msruna2",
for(const pappso::masschroq::MsRunPeptideListSp &msrun_peptide_list : m_msRunPeptideListSpList)
{
msrun_peptide_list.get()->buildMsRunRetentionTimeSpOnPeptideObservations(msp_alignmentMethod);
}
const pappso::MsRunRetentionTime<QString> *reference_msrun_retetiontime_p =
msp_msRunPeptideListAlignmentReference.get()->getMsRunRetentionTimeConstPtr();
cbor_output.getCborStreamWriter().append(QLatin1String("corrections"));
cbor_output.getCborStreamWriter().startMap();
// "corrections": {
for(const pappso::masschroq::MsRunPeptideListSp &msrun_peptide_list : m_msRunPeptideListSpList)
{
if(msrun_peptide_list.get() == msp_msRunPeptideListAlignmentReference.get())
continue;
/*
"msruna1": {
"original": [1,2,3,4.5],
"aligned":[1,2,3,4.5]
},
"msruna2": {
"original": [1,2,3,4.5],
"aligned":[1,2,3,4.5]
}*/
msrun_peptide_list.get()->getMsRunRetentionTimePtr()->align(*reference_msrun_retetiontime_p);
pappso::Trace report_common_MS2_delta_rt =
msrun_peptide_list.get()->getMsRunRetentionTimePtr()->getCommonDeltaRt(
reference_msrun_retetiontime_p->getSeamarks());
cbor_output.getCborStreamWriter().append(msrun_peptide_list.get()
->getMsRunSp()
.get()
->getMsRunReaderSPtr()
.get()
->getMsRunId()
.get()
->getXmlId());
cbor_output.writeMsRunRetentionTime(report_common_MS2_delta_rt,
*msrun_peptide_list.get()->getMsRunRetentionTimePtr());
}
cbor_output.getCborStreamWriter().endMap();
cbor_output.getCborStreamWriter().endMap();
}
pappso::MsRunRetentionTime::getSeamarks
const std::vector< MsRunRetentionTimeSeamarkPoint< T > > & getSeamarks() const
Definition msrunretentiontime.cpp:115
pappso::masschroq::MsRunGroup::msp_msRunPeptideListAlignmentReference
MsRunPeptideListSp msp_msRunPeptideListAlignmentReference
Definition msrungroup.h:101
pappso::masschroq::MsRunGroup::msp_alignmentMethod
AlignmentMethodSp msp_alignmentMethod
Definition msrungroup.h:100
pappso::masschroq::MsRunPeptideListSp
std::shared_ptr< MsRunPeptideList > MsRunPeptideListSp
Definition msrunpeptidelist.h:47

References pappso::masschroq::CborOutputStream::getCborStreamWriter(), pappso::MsRunRetentionTime< T >::getSeamarks(), m_msRunPeptideListSpList, msp_alignmentMethod, msp_msRunPeptideListAlignmentReference, and pappso::masschroq::CborOutputStream::writeMsRunRetentionTime().

Referenced by align().

## contains()

bool pappso::masschroq::MsRunGroup::contains | ( | const MsRun * | msrun_p | ) | const

Definition at line 310 of file msrungroup.cpp.

{
auto it = find_if(m_msRunPeptideListSpList.begin(),
m_msRunPeptideListSpList.end(),
[msrun_p](const pappso::masschroq::MsRunPeptideListSp &msrun) {
return (msrun.get()->getMsRunSp().get() == msrun_p);
});
return (it != m_msRunPeptideListSpList.end());
}

References m_msRunPeptideListSpList.

Referenced by pappso::masschroq::Peptide::getBestIonMobilityXicCoordToExtractOverallMsRunGroup(), and pappso::masschroq::Peptide::getBestXicCoordSPtrForChargeInMsRunGroup().

## getId()

const QString & pappso::masschroq::MsRunGroup::getId | ( |  | ) | const

Definition at line 340 of file msrungroup.cpp.

{
return m_id;
}

References m_id.

Referenced by align(), and quantify().

## getIonMobilityGridSp()

const std::shared_ptr< pappso::IonMobilityGrid > & pappso::masschroq::MsRunGroup::getIonMobilityGridSp | ( |  | ) | const

Definition at line 334 of file msrungroup.cpp.

{
return msp_ionMobilityGrid;
}
pappso::masschroq::MsRunGroup::msp_ionMobilityGrid
std::shared_ptr< pappso::IonMobilityGrid > msp_ionMobilityGrid
Definition msrungroup.h:103

References msp_ionMobilityGrid.

Referenced by pappso::masschroq::Peptide::getBestIonMobilityXicCoordToExtractOverallMsRunGroup(), pappso::masschroq::MbrPeptideMeasurements::prepareMeasurements(), and pappso::masschroq::PeptideMeasurements::prepareMeasurements().

## hasTimsTofMobilityIndex()

bool pappso::masschroq::MsRunGroup::hasTimsTofMobilityIndex | ( |  | ) | const

Definition at line 328 of file msrungroup.cpp.

{
return m_hasTimsTofMobilityIndex;
}

References m_hasTimsTofMobilityIndex.

## quantify()

void pappso::masschroq::MsRunGroup::quantify | ( | CborOutputStream & | cbor_output,
|  | const QString & | quantify_id,
|  | const QString & | tmp_dir,
|  | pappso::UiMonitorInterface & | m_uiMonitor,
|  | const QuantificationMethodSp & | quantification_method,
|  | const std::vector< PeptideSp > & | peptide_sp_list ) const

Definition at line 155 of file msrungroup.cpp.

{
bool match_between_run = quantification_method.get()->getMatchBetweenRun();
cbor_output.getCborStreamWriter().startMap();
cbor_output.getCborStreamWriter().append("quantify_id");
cbor_output.getCborStreamWriter().append(quantify_id);
cbor_output.getCborStreamWriter().append("group_id");
cbor_output.getCborStreamWriter().append(getId());
cbor_output.getCborStreamWriter().append(QLatin1String("timestamp1"));
cbor_output.getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
cbor_output.getCborStreamWriter().append("first_pass");
cbor_output.getCborStreamWriter().startMap(m_msRunPeptideListSpList.size());
const pappso::MsRunRetentionTime<QString> *msrun_rt_reference_p = nullptr;
if(match_between_run)
{
if(msp_msRunPeptideListAlignmentReference.get() == nullptr)
{
throw pappso::PappsoException(
QObject::tr("group %1 is not aligned, match between run is not possible").arg(getId()));
}
msrun_rt_reference_p =
msp_msRunPeptideListAlignmentReference.get()->getMsRunRetentionTimeConstPtr();
}
for(const pappso::masschroq::MsRunPeptideListSp &msrun_peptide_list : m_msRunPeptideListSpList)
{
msrun_peptide_list.get()->quantify(this, tmp_dir, m_uiMonitor, quantification_method);
if(match_between_run)
{
const pappso::MsRunRetentionTime<QString> *msrun_rt_p =
msrun_peptide_list.get()->getMsRunRetentionTimeConstPtr();
if((msrun_rt_reference_p == nullptr) || (msrun_rt_p == nullptr) ||
((!msrun_rt_p->isAligned()) && (msrun_rt_reference_p != msrun_rt_p)))
{
throw pappso::PappsoException(
QObject::tr("msrun %1 is not aligned, match between run is not possible")
.arg(msrun_peptide_list.get()
->getMsRunSp()
.get()
->getMsRunReaderSPtr()
.get()
->getMsRunId()
.get()
->getXmlId()));
}
m_uiMonitor.appendText("Collecting peak apex");
msrun_peptide_list.get()->collectPeptidePeakRetentionTime(msrun_rt_reference_p);
msrun_peptide_list.get()->collectPeptideMs2RetentionTime(msrun_rt_reference_p);
}
cbor_output.writeQrDataBlock(m_uiMonitor, *msrun_peptide_list.get(), false);
msrun_peptide_list.get()->clearMeasurements();
}
cbor_output.getCborStreamWriter().endMap();
cbor_output.getCborStreamWriter().append(QLatin1String("timestamp2"));
cbor_output.getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
if(match_between_run)
{
if(msrun_rt_reference_p != nullptr)
{ // second pass
m_uiMonitor.appendText(
QObject::tr("Computing consensus retention time (%1)").arg(peptide_sp_list.size()));
for(const pappso::masschroq::PeptideSp &peptide_sp : peptide_sp_list)
{
peptide_sp.get()->computeConsensusRetentionTime();
}
cbor_output.getCborStreamWriter().append("second_pass");
cbor_output.getCborStreamWriter().startMap(m_msRunPeptideListSpList.size());
for(const pappso::masschroq::MsRunPeptideListSp &msrun_peptide_list :
m_msRunPeptideListSpList)
{
const pappso::masschroq::MsRun *msrun_p =
msrun_peptide_list.get()->getMsRunSp().get();
std::vector<pappso::masschroq::PeptideSp> peptide_mbr_list;
for(const pappso::masschroq::PeptideSp &peptide_sp : peptide_sp_list)
{
if(!peptide_sp.get()->isObservedInMsRunSp(msrun_p))
{
peptide_mbr_list.push_back(peptide_sp);
}
}
msrun_peptide_list.get()->quantifyMatchBetweenRun(
this, peptide_mbr_list, tmp_dir, m_uiMonitor, quantification_method);
cbor_output.writeQrDataBlock(m_uiMonitor, *msrun_peptide_list.get(), true);
msrun_peptide_list.get()->clearMeasurements();
}
cbor_output.getCborStreamWriter().endMap();
}
}
cbor_output.getCborStreamWriter().append(QLatin1String("timestamp3"));
cbor_output.getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
cbor_output.getCborStreamWriter().endMap();
}
pappso::MsRunRetentionTime::isAligned
bool isAligned() const
Definition msrunretentiontime.cpp:395
pappso::masschroq::PeptideSp
std::shared_ptr< Peptide > PeptideSp
Definition peptide.h:46

References pappso::UiMonitorInterface::appendText(), pappso::masschroq::CborOutputStream::getCborStreamWriter(), getId(), pappso::masschroq::QuantificationMethod::getMatchBetweenRun(), pappso::MsRunRetentionTime< T >::isAligned(), m_msRunPeptideListSpList, msp_msRunPeptideListAlignmentReference, and pappso::masschroq::CborOutputStream::writeQrDataBlock().

## setAlignmentMethodSp()

void pappso::masschroq::MsRunGroup::setAlignmentMethodSp | ( | const AlignmentMethodSp & | alignment_method_sp,
|  | const QString & | msrun_ref_id )

Definition at line 280 of file msrungroup.cpp.

{
auto it = find_if(m_msRunPeptideListSpList.begin(),
m_msRunPeptideListSpList.end(),
[msrun_ref_id](const pappso::masschroq::MsRunPeptideListSp &msrun) {
if(msrun.get()
->getMsRunSp()
.get()
->getMsRunReaderSPtr()
.get()
->getMsRunId()
.get()
->getXmlId() == msrun_ref_id)
return true;
return false;
});
if(it != m_msRunPeptideListSpList.end())
{
msp_alignmentMethod = alignment_method_sp;
msp_msRunPeptideListAlignmentReference = *it;
}
else
{
throw pappso::ExceptionNotFound(
QObject::tr("msrun_id %1 not found in group %2").arg(msrun_ref_id).arg(m_id));
}
}

References m_id, m_msRunPeptideListSpList, msp_alignmentMethod, and msp_msRunPeptideListAlignmentReference.

## setIonMobilityGridSp()

void pappso::masschroq::MsRunGroup::setIonMobilityGridSp | ( | const std::shared_ptr< pappso::IonMobilityGrid > & | ion_mobility_grid_sp | ) |

Definition at line 321 of file msrungroup.cpp.

{
msp_ionMobilityGrid = ion_mobility_grid_sp;
}

References msp_ionMobilityGrid.

## Member Data Documentation

## m_hasTimsTofMobilityIndex

bool pappso::masschroq::MsRunGroup::m_hasTimsTofMobilityIndex = false

private

Definition at line 102 of file msrungroup.h.

Referenced by MsRunGroup(), and hasTimsTofMobilityIndex().

## m_id

const QString pappso::masschroq::MsRunGroup::m_id

private

Definition at line 98 of file msrungroup.h.

Referenced by MsRunGroup(), MsRunGroup(), getId(), and setAlignmentMethodSp().

## m_msRunPeptideListSpList

const std::vector<MsRunPeptideListSp> pappso::masschroq::MsRunGroup::m_msRunPeptideListSpList

private

Definition at line 99 of file msrungroup.h.

Referenced by MsRunGroup(), MsRunGroup(), alignRetentionTimeBetweenMsRuns(), contains(), quantify(), and setAlignmentMethodSp().

## msp_alignmentMethod

AlignmentMethodSp pappso::masschroq::MsRunGroup::msp_alignmentMethod

private

Definition at line 100 of file msrungroup.h.

Referenced by alignRetentionTimeBetweenMsRuns(), and setAlignmentMethodSp().

## msp_ionMobilityGrid

std::shared_ptr<pappso::IonMobilityGrid> pappso::masschroq::MsRunGroup::msp_ionMobilityGrid

private

Definition at line 103 of file msrungroup.h.

Referenced by getIonMobilityGridSp(), and setIonMobilityGridSp().

## msp_msRunPeptideListAlignmentReference

MsRunPeptideListSp pappso::masschroq::MsRunGroup::msp_msRunPeptideListAlignmentReference

private

Definition at line 101 of file msrungroup.h.

Referenced by alignRetentionTimeBetweenMsRuns(), quantify(), and setAlignmentMethodSp().

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

- pappsomspp/core/masschroq/msrungroup.h
- pappsomspp/core/masschroq/msrungroup.cpp