From 6bc6d58cbf98af080732af1ce73526b8730a167c Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Fri, 26 Jan 2018 23:02:17 +0100 Subject: [PATCH] extract XIC in other MsRun --- src/gui/xic_view/xic_box/xic_box.ui | 21 +++++++++++-- src/gui/xic_view/xic_box/xicbox.cpp | 47 +++++++++++++++++++++++++++-- src/gui/xic_view/xic_box/xicbox.h | 2 ++ src/gui/xic_view/xicwindow.cpp | 5 +++ src/gui/xic_view/xicwindow.h | 1 + 5 files changed, 72 insertions(+), 4 deletions(-) diff --git a/src/gui/xic_view/xic_box/xic_box.ui b/src/gui/xic_view/xic_box/xic_box.ui index e438ff7c1..f35f69a28 100644 --- a/src/gui/xic_view/xic_box/xic_box.ui +++ b/src/gui/xic_view/xic_box/xic_box.ui @@ -180,8 +180,8 @@ <slot>remove()</slot> <hints> <hint type="sourcelabel"> - <x>378</x> - <y>25</y> + <x>592</x> + <y>39</y> </hint> <hint type="destinationlabel"> <x>585</x> @@ -189,8 +189,25 @@ </hint> </hints> </connection> + <connection> + <sender>pushButton_2</sender> + <signal>clicked()</signal> + <receiver>XicBox</receiver> + <slot>extractXicInOtherMsRun()</slot> + <hints> + <hint type="sourcelabel"> + <x>414</x> + <y>38</y> + </hint> + <hint type="destinationlabel"> + <x>891</x> + <y>69</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>remove()</slot> + <slot>extractXicInOtherMsRun()</slot> </slots> </ui> diff --git a/src/gui/xic_view/xic_box/xicbox.cpp b/src/gui/xic_view/xic_box/xicbox.cpp index 41ff464e3..6abf1eaae 100644 --- a/src/gui/xic_view/xic_box/xicbox.cpp +++ b/src/gui/xic_view/xic_box/xicbox.cpp @@ -29,7 +29,7 @@ #include "xicbox.h" #include "ui_xic_box.h" #include <QMessageBox> -#include <pappsomspp/pappsoexception.h> +#include <pappsomspp/exception/exceptionnotfound.h> #include "../xicworkerthread.h" #include "../../project_view/projectwindow.h" #include <pappsomspp/xic/detection/xicdetectionzivy.h> @@ -110,6 +110,19 @@ XicBox::XicBox(XicWindow *parent): #endif + QStringList msrun_list; + for (MsRunSp msrun_sp : _p_xic_window->getProjectWindow()->getProjectP()->getMsRunStore().getMsRunList()) { + msrun_list << msrun_sp.get()->getFilename(); + qDebug() << "ProteinListWindow::setIdentificationGroup " << msrun_sp.get()->getFilename(); + } + QCompleter *completer = new QCompleter(msrun_list, this); + completer->setCaseSensitivity(Qt::CaseInsensitive); + + completer->setCompletionMode(QCompleter::PopupCompletion); + completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); + completer->setFilterMode(Qt::MatchContains); + ui->msrun_autocompletion->setCompleter(completer); + } XicBox::~XicBox() @@ -128,10 +141,23 @@ void XicBox::error(QString error_message) { tr("Error trying to save spectrum to SVG file :"), error_message); } + +void XicBox::extractXicInOtherMsRun() { + qDebug() << "XicBox::extractXicInOtherMsRun begin"; + try { + MsRunSp msrun_sp = _p_xic_window->getProjectWindow()->getProjectP()->getMsRunStore().getInstance(ui->msrun_autocompletion->text()); + _p_xic_window->addXicInMsRun(_p_peptide_evidence, msrun_sp); + } + catch (pappso::ExceptionNotFound & error) { + qDebug() << "XicBox::extractXicInOtherMsRun not found " << ui->msrun_autocompletion->text(); + } +} + void XicBox::setPeptideEvidence(const PeptideEvidence * p_peptide_evidence) { + _p_peptide_evidence = p_peptide_evidence; - _msrun_sp = _p_xic_window->getProjectWindow()->getProjectP()->getMsRunStore().getInstance(_p_peptide_evidence->getMsRunP()); + _msrun_sp = p_peptide_evidence->getIdentificationDataSource()->getMsRunSp(); ui->peptide_label->setText(_p_peptide_evidence->getPeptideXtpSp().get()->toString()); ui->msrun_label->setText(_p_peptide_evidence->getMsRunP()->getFilename()); @@ -147,6 +173,23 @@ void XicBox::setPeptideEvidence(const PeptideEvidence * p_peptide_evidence) { } +void XicBox::setPeptideEvidenceInMsRun(const PeptideEvidence * p_peptide_evidence, MsRunSp msrun_sp) { + _p_peptide_evidence = p_peptide_evidence; + _msrun_sp = msrun_sp; + + ui->peptide_label->setText(_p_peptide_evidence->getPeptideXtpSp().get()->toString()); + ui->msrun_label->setText(msrun_sp->getFilename()); + ui->charge_label->setText(QString("%1").arg(_p_peptide_evidence->getCharge())); + ui->mz_label->setText(QString::number(_p_peptide_evidence->getTheoreticalMz(), 'f', 4)); + + //get same xic peptide evidence (msrun, peptide, charge) + //p_projet + _peptide_evidence_list.clear(); + //_p_xic_window->getProjectWindow()->getProjectP()->getSameXicPeptideEvidenceList(p_peptide_evidence, _peptide_evidence_list); + + emit computeIsotopeMassList(_p_peptide_evidence->getPeptideXtpSp(), _p_peptide_evidence->getCharge(), _p_xic_window->getXicExtractPrecision(), 0.8); + +} void XicBox::setXic(std::vector< pappso::XicSp> xic_sp_list) { qDebug() << "XicBox::setXic begin " << xic_sp_list.size(); diff --git a/src/gui/xic_view/xic_box/xicbox.h b/src/gui/xic_view/xic_box/xicbox.h index 33ae45e20..c06e56d53 100644 --- a/src/gui/xic_view/xic_box/xicbox.h +++ b/src/gui/xic_view/xic_box/xicbox.h @@ -51,6 +51,7 @@ public: explicit XicBox(XicWindow * parent = 0); ~XicBox(); void setPeptideEvidence(const PeptideEvidence * p_peptide_evidence) ; + void setPeptideEvidenceInMsRun(const PeptideEvidence * p_peptide_evidence, MsRunSp msrun_sp); signals : void loadXic(MsRunSp p_msrun, std::vector<pappso::mz> mz_list, pappso::PrecisionP precision, XicExtractMethod method); @@ -61,6 +62,7 @@ private slots: void setXic(std::vector< pappso::XicSp> xic_sp_list); void setIsotopeMassList(std::vector<pappso::PeptideNaturalIsotopeAverageSp> isotope_mass_list); void error(QString error_message); + void extractXicInOtherMsRun(); private: Ui::XicBox *ui; QThread _xic_thread; diff --git a/src/gui/xic_view/xicwindow.cpp b/src/gui/xic_view/xicwindow.cpp index 703195a7e..f4fbaf6a5 100644 --- a/src/gui/xic_view/xicwindow.cpp +++ b/src/gui/xic_view/xicwindow.cpp @@ -78,6 +78,11 @@ void XicWindow::addXic(const PeptideEvidence * p_peptide_evidence) { ui->xic_vertical_layout->layout()->addWidget(p_box); } +void XicWindow::addXicInMsRun(const PeptideEvidence * p_peptide_evidence, MsRunSp msrun_sp) { + XicBox * p_box = new XicBox(this); + p_box->setPeptideEvidenceInMsRun(p_peptide_evidence, msrun_sp); + ui->xic_vertical_layout->layout()->addWidget(p_box); +} void XicWindow::removeXicBox(XicBox * xic_box) { xic_box->setVisible(false); diff --git a/src/gui/xic_view/xicwindow.h b/src/gui/xic_view/xicwindow.h index e04745b6b..30bef1125 100644 --- a/src/gui/xic_view/xicwindow.h +++ b/src/gui/xic_view/xicwindow.h @@ -52,6 +52,7 @@ public: ~XicWindow(); void addXic(const PeptideEvidence * p_peptide_evidence); + void addXicInMsRun(const PeptideEvidence * p_peptide_evidence, MsRunSp msrun_sp); pappso::PrecisionP getXicExtractPrecision() const; -- GitLab