30#include "../exception/exceptionnotfound.h"
33 const std::vector<MsRunPeptideListSp> &msrun_list)
34 : m_id(id), m_msRunPeptideListSpList(msrun_list)
44 : m_id(other.m_id), m_msRunPeptideListSpList(other.m_msRunPeptideListSpList)
57 if(msp_msRunPeptideListAlignmentReference.get() ==
nullptr)
67 ->getMsRunReaderSPtr()
77 msrun_peptide_list.get()->buildMsRunRetentionTimeSpOnPeptideObservations(msp_alignmentMethod);
80 msp_msRunPeptideListAlignmentReference.get()->getMsRunRetentionTimeConstPtr();
89 if(msrun_peptide_list.get() == msp_msRunPeptideListAlignmentReference.get())
102 msrun_peptide_list.get()->getMsRunRetentionTimePtr()->align(*reference_msrun_retetiontime_p);
105 msrun_peptide_list.get()->getMsRunRetentionTimePtr()->getCommonDeltaRt(
111 ->getMsRunReaderSPtr()
116 cbor_output.
writeMsRunRetentionTime(report_common_MS2_delta_rt, *msrun_peptide_list.get()->getMsRunRetentionTimePtr());
127 const QString &align_id,
137 cbor_output.
getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
141 m_uiMonitor.
appendText(
"Starting retention time alignment");
142 alignRetentionTimeBetweenMsRuns(cbor_output, m_uiMonitor);
143 m_uiMonitor.
appendText(
"retention time alignment done");
147 cbor_output.
getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
155 const QString &quantify_id,
156 const QString &tmp_dir,
159 const std::vector<pappso::masschroq::PeptideSp> &peptide_sp_list)
const
162 bool match_between_run = quantification_method.get()->getMatchBetweenRun();
170 cbor_output.
getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
177 if(match_between_run)
180 if(msp_msRunPeptideListAlignmentReference.get() ==
nullptr)
183 QObject::tr(
"group %1 is not aligned, match between run is not possible").arg(getId()));
185 msrun_rt_reference_p =
186 msp_msRunPeptideListAlignmentReference.get()->getMsRunRetentionTimeConstPtr();
192 msrun_peptide_list.get()->quantify(
this, tmp_dir, m_uiMonitor, quantification_method);
195 if(match_between_run)
200 msrun_peptide_list.get()->getMsRunRetentionTimeConstPtr();
203 if((msrun_rt_reference_p ==
nullptr) || (msrun_rt_p ==
nullptr) ||
204 ((!msrun_rt_p->
isAligned()) && (msrun_rt_reference_p != msrun_rt_p)))
207 QObject::tr(
"msrun %1 is not aligned, match between run is not possible")
208 .arg(msrun_peptide_list.get()
211 ->getMsRunReaderSPtr()
217 m_uiMonitor.
appendText(
"Collecting peak apex");
218 msrun_peptide_list.get()->collectPeptidePeakRetentionTime(msrun_rt_reference_p);
219 msrun_peptide_list.get()->collectPeptideMs2RetentionTime(msrun_rt_reference_p);
222 cbor_output.
writeQrDataBlock(m_uiMonitor, *msrun_peptide_list.get(),
false);
225 msrun_peptide_list.get()->clearMeasurements();
231 cbor_output.
getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
232 if(match_between_run)
234 if(msrun_rt_reference_p !=
nullptr)
238 QObject::tr(
"Computing consensus retention time (%1)").arg(peptide_sp_list.size()));
241 peptide_sp.get()->computeConsensusRetentionTime();
247 m_msRunPeptideListSpList)
250 msrun_peptide_list.get()->getMsRunSp().get();
251 std::vector<pappso::masschroq::PeptideSp> peptide_mbr_list;
254 if(!peptide_sp.get()->isObservedInMsRunSp(msrun_p))
256 peptide_mbr_list.push_back(peptide_sp);
259 msrun_peptide_list.get()->quantifyMatchBetweenRun(
260 this, peptide_mbr_list, tmp_dir, m_uiMonitor, quantification_method);
265 msrun_peptide_list.get()->clearMeasurements();
273 cbor_output.
getCborStreamWriter().append(QDateTime::currentDateTime().toString(Qt::ISODate));
281 auto it = find_if(m_msRunPeptideListSpList.begin(),
282 m_msRunPeptideListSpList.end(),
287 ->getMsRunReaderSPtr()
291 ->getXmlId() == msrun_ref_id)
295 if(it != m_msRunPeptideListSpList.end())
297 msp_alignmentMethod = alignment_method_sp;
298 msp_msRunPeptideListAlignmentReference = *it;
303 QObject::tr(
"msrun_id %1 not found in group %2").arg(msrun_ref_id).arg(m_id));
310 auto it = find_if(m_msRunPeptideListSpList.begin(),
311 m_msRunPeptideListSpList.end(),
313 return (msrun.get()->getMsRunSp().get() == msrun_p);
315 return (it != m_msRunPeptideListSpList.end());
320 const std::shared_ptr<pappso::IonMobilityGrid> &ion_mobility_grid_sp)
322 msp_ionMobilityGrid = ion_mobility_grid_sp;
328 return m_hasTimsTofMobilityIndex;
331const std::shared_ptr<pappso::IonMobilityGrid> &
334 return msp_ionMobilityGrid;
const std::vector< MsRunRetentionTimeSeamarkPoint< T > > & getSeamarks() const
A simple container of DataPoint instances.
virtual void appendText(const QString &text)=0
append a text to a long report
QCborStreamWriter & getCborStreamWriter()
void writeMsRunRetentionTime(const pappso::Trace &report_common_ms2, const pappso::MsRunRetentionTime< QString > &msrun_retention_time)
void writeQrDataBlock(pappso::UiMonitorInterface &m_uiMonitor, const MsRunPeptideList &msrun_peptide_list, bool is_mbr)
MsRunGroup(const QString &id, const std::vector< MsRunPeptideListSp > &msrun_list)
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 setIonMobilityGridSp(const std::shared_ptr< pappso::IonMobilityGrid > &ion_mobility_grid_sp)
bool hasTimsTofMobilityIndex() const
bool contains(const MsRun *msrun_p) const
const QString & getId() const
void align(CborOutputStream &cbor_output, const QString &align_id, pappso::UiMonitorInterface &m_uiMonitor) const
bool m_hasTimsTofMobilityIndex
void setAlignmentMethodSp(const AlignmentMethodSp &alignment_method_sp, const QString &msrun_ref_id)
const std::vector< MsRunPeptideListSp > m_msRunPeptideListSpList
const std::shared_ptr< pappso::IonMobilityGrid > & getIonMobilityGridSp() const
void alignRetentionTimeBetweenMsRuns(CborOutputStream &cbor_output, pappso::UiMonitorInterface &m_uiMonitor) const
group msrun together in masschroqlite
std::shared_ptr< QuantificationMethod > QuantificationMethodSp
std::shared_ptr< MsRunPeptideList > MsRunPeptideListSp
std::shared_ptr< AlignmentMethod > AlignmentMethodSp
std::shared_ptr< Peptide > PeptideSp