From 8428480c56ab93cc828bfd6e454075251c0d0c09 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Fri, 16 Oct 2020 15:22:18 +0200 Subject: [PATCH 01/18] Export Xic To csv added --- src/CMakeLists.txt | 1 + src/gui/project_view/projectwindow.cpp | 17 +++++++++- src/gui/project_view/projectwindow.h | 4 +++ src/gui/workerthread.cpp | 25 ++++++++++++++ src/gui/workerthread.h | 4 ++- src/gui/xic_view/xic_box/xic_box.ui | 17 ++++++---- src/gui/xic_view/xic_box/xicbox.cpp | 8 +++-- src/gui/xic_view/xic_box/xicbox.h | 4 +-- src/gui/xic_view/xic_window.ui | 47 ++++++++++++++++++++++++-- src/gui/xic_view/xicwindow.cpp | 28 +++++++++++++++ src/gui/xic_view/xicwindow.h | 2 ++ src/main.cpp | 1 + 12 files changed, 142 insertions(+), 16 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 31306669..946b28a0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -105,6 +105,7 @@ set(CPP_FILES output/ods/simplesheet.cpp output/ods/spectrasheet.cpp output/ods/spectrasheetall.cpp + output/ods/xicareasheet.cpp output/exportfastafile.cpp output/masschroqml.cpp output/masschroqprm.cpp diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 33b2d0ad..5d46f14f 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -111,6 +111,7 @@ ProjectWindow::ProjectWindow(MainWindow *parent) &ProjectWindow::operateMassChroqExportDialog, main_window, &MainWindow::doActionMassChroQ); + // // grouping /* @@ -1140,6 +1141,20 @@ ProjectWindow::doCleanMsRunReaders() void ProjectWindow::doOpenMassChroQDialog() { - qDebug() << "AAAAAAAA"; emit operateMassChroqExportDialog(); } + +void +ProjectWindow::doExportXicAreaToCsv(QString filename, + std::vector<XicBox *> xic_boxs) +{ + qDebug() << "Export Xic to csv"; + showWaitingMessage("Export All XIC area to CSV"); + emit operateWriteXicAreaInCsv(filename, xic_boxs); +} +void +ProjectWindow::doExportXicAreaToCsvFinished() +{ + hideWaitingMessage(); + qDebug() << "Export Finished"; +} diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index 0fd7272d..b2c2fa27 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -94,6 +94,8 @@ class ProjectWindow : public QMainWindow void doBestMsRunForAlignmentFinished(MsRunSp msrun_sp); void doCleanMsRunReaders(); void doOpenMassChroQDialog(); + void doExportXicAreaToCsv(QString filename, std::vector<XicBox *> xic_boxs); + void doExportXicAreaToCsvFinished(); // void setColor(const QColor &color); // void setShape(Shape shape); @@ -115,6 +117,8 @@ class ProjectWindow : public QMainWindow void projectStatusChanged(); void bestMsRunFound(MsRunSp msrun_sp); void operateMassChroqExportDialog(); + void operateWriteXicAreaInCsv(QString filename, + std::vector<XicBox *> xic_boxs); protected: void doViewPeptideList(IdentificationGroup *p_ident_group, diff --git a/src/gui/workerthread.cpp b/src/gui/workerthread.cpp index 3c932485..58eaa0d7 100644 --- a/src/gui/workerthread.cpp +++ b/src/gui/workerthread.cpp @@ -46,6 +46,7 @@ #include "project_view/projectwindow.h" #include "../core/tandem_run/tandembatchprocess.h" #include "../core/tandem_run/tandemcondorprocess.h" +#include "../output/ods/xicareasheet.h" #include <QSettings> WorkerThread::WorkerThread(MainWindow *p_main_window) @@ -225,6 +226,15 @@ WorkerThread::connectProjectWindow(ProjectWindow *p_project_window) &WorkerThread::operationFinished, p_project_window, &ProjectWindow::doOperationFinished); + + connect(p_project_window, + &ProjectWindow::operateWriteXicAreaInCsv, + this, + &WorkerThread::doWriteXicAreaInCsv); + connect(this, + &WorkerThread::exportXicToCsvFinished, + p_project_window, + &ProjectWindow::doExportXicAreaToCsvFinished); qDebug(); } @@ -861,3 +871,18 @@ WorkerThread::doCheckMsrunFilePath(ProjectSp msp_project) emit checkingMsrunFilePathFinished(msrun_sp); } + +void +WorkerThread::doWriteXicAreaInCsv(QString filename, + std::vector<XicBox *> xic_boxs) +{ + CalcWriterInterface *p_writer = nullptr; + + emit loadingMessage(tr("writing TSV files, please wait")); + p_writer = new TsvDirectoryWriter(filename); + XicAreaSheet(p_writer, xic_boxs); + bool all_data = true; + XicAreaSheet(p_writer, xic_boxs, all_data); + p_writer->close(); + emit exportXicToCsvFinished(); +} diff --git a/src/gui/workerthread.h b/src/gui/workerthread.h index ba3f9322..0b38f33b 100644 --- a/src/gui/workerthread.h +++ b/src/gui/workerthread.h @@ -37,6 +37,7 @@ #include "../utils/workmonitor.h" #include "../core/tandem_run/tandemrunbatch.h" #include "../gui/export/export_masschroq_dialog/masschroqfileparameters.h" +#include "../gui/xic_view/xic_box/xicbox.h" class MainWindow; class ProjectWindow; @@ -87,7 +88,7 @@ class WorkerThread : public QObject void doFindBestMsrunForAlignment(ProjectSp project_sp, MsRunAlignmentGroupSp alignment_group); void doCheckMsrunFilePath(ProjectSp project_sp); - + void doWriteXicAreaInCsv(QString filename, std::vector<XicBox *> xic_boxs); signals: void loadingMessage(QString message); @@ -108,6 +109,7 @@ class WorkerThread : public QObject * that was not found if so */ void checkingMsrunFilePathFinished(MsRunSp msrun_sp); + void exportXicToCsvFinished(); private: WorkMonitor *_p_work_monitor; diff --git a/src/gui/xic_view/xic_box/xic_box.ui b/src/gui/xic_view/xic_box/xic_box.ui index 4b2afe9b..df7e1572 100644 --- a/src/gui/xic_view/xic_box/xic_box.ui +++ b/src/gui/xic_view/xic_box/xic_box.ui @@ -87,6 +87,9 @@ <property name="text"> <string>new XIC</string> </property> + <property name="icon"> + <iconset theme="tab-new"/> + </property> </widget> </item> <item> @@ -152,15 +155,15 @@ <item> <widget class="QToolButton" name="close_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="maximumSize"> <size> - <width>24</width> - <height>24</height> + <width>16000</width> + <height>1600</height> </size> </property> <property name="acceptDrops"> @@ -173,8 +176,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../../xtpcpp.qrc"> - <normaloff>:/icons/resources/icons/mit/jamicons/icon_close.svg</normaloff>:/icons/resources/icons/mit/jamicons/icon_close.svg</iconset> + <iconset theme="window-close"/> </property> <property name="iconSize"> <size> @@ -383,8 +385,8 @@ <slot>onIsotopicDistributionClick()</slot> <hints> <hint type="sourcelabel"> - <x>1004</x> - <y>32</y> + <x>980</x> + <y>39</y> </hint> <hint type="destinationlabel"> <x>1163</x> @@ -400,5 +402,6 @@ <slot>onXicWidgetClick(double,double)</slot> <slot>setXicPeakList(pappso::XicXicPeakPairList)</slot> <slot>onIsotopicDistributionClick()</slot> + <slot>onExportToCsvClick()</slot> </slots> </ui> diff --git a/src/gui/xic_view/xic_box/xicbox.cpp b/src/gui/xic_view/xic_box/xicbox.cpp index 7bd6ba88..1ed5dec4 100644 --- a/src/gui/xic_view/xic_box/xicbox.cpp +++ b/src/gui/xic_view/xic_box/xicbox.cpp @@ -563,13 +563,11 @@ XicBox::setIsotopeMassList( // histogram if(m_theoreticalRatioBars == nullptr) { - qDebug() << "ZZZZZZZZZZZZZ"; m_theoreticalRatioBars = new QCPBars(ui->histo_widget->xAxis, ui->histo_widget->yAxis); } else { - qDebug() << "EEEEEEEEEEE"; m_theoreticalRatioBars->data()->clear(); } m_theoreticalRatioBars->setName("th. ratio"); @@ -778,3 +776,9 @@ XicBox::addCommonRt(std::vector<std::size_t> &common_peak_rt_measure_list, */ } } + +std::vector<XicBoxNaturalIsotope> +XicBox::getNaturalIsotopList() const +{ + return _natural_isotope_list; +} diff --git a/src/gui/xic_view/xic_box/xicbox.h b/src/gui/xic_view/xic_box/xicbox.h index c424f9cc..2eff49b8 100644 --- a/src/gui/xic_view/xic_box/xicbox.h +++ b/src/gui/xic_view/xic_box/xicbox.h @@ -68,6 +68,7 @@ class XicBox : public QWidget void setPeptideEvidence(const PeptideEvidence *p_peptide_evidence); void setPeptideEvidenceInMsRun(const PeptideEvidence *p_peptide_evidence, MsRunSp msrun_sp); + std::vector<XicBoxNaturalIsotope> getNaturalIsotopList() const; signals: void loadXic(MsRunSp p_msrun, @@ -118,8 +119,7 @@ class XicBox : public QWidget std::vector<pappso::XicWidget *> _xic_widget_list; QCPBars *m_observedAreaBars = nullptr; - - bool _scaled = false; + bool _scaled = false; // QFrame * _popup_peak_info = nullptr; }; diff --git a/src/gui/xic_view/xic_window.ui b/src/gui/xic_view/xic_window.ui index 1047423e..10b6f003 100644 --- a/src/gui/xic_view/xic_window.ui +++ b/src/gui/xic_view/xic_window.ui @@ -82,11 +82,35 @@ </property> </spacer> </item> + <item> + <widget class="QToolButton" name="export_toolButton"> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset theme="spreadsheet"> + <normaloff>.</normaloff>.</iconset> + </property> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> <item> <widget class="QPushButton" name="edit_zivy_params_pushbutton"> <property name="text"> <string>Edit</string> </property> + <property name="icon"> + <iconset theme="edit"> + <normaloff>.</normaloff>.</iconset> + </property> </widget> </item> </layout> @@ -103,7 +127,7 @@ <x>0</x> <y>0</y> <width>1172</width> - <height>499</height> + <height>495</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"/> @@ -187,8 +211,8 @@ <slot>doEditZivyParams()</slot> <hints> <hint type="sourcelabel"> - <x>710</x> - <y>59</y> + <x>1182</x> + <y>61</y> </hint> <hint type="destinationlabel"> <x>918</x> @@ -212,12 +236,29 @@ </hint> </hints> </connection> + <connection> + <sender>export_toolButton</sender> + <signal>clicked()</signal> + <receiver>XicWindow</receiver> + <slot>doExportXicToCsv()</slot> + <hints> + <hint type="sourcelabel"> + <x>1084</x> + <y>42</y> + </hint> + <hint type="destinationlabel"> + <x>1496</x> + <y>107</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>xicPrecisionChanged(pappso::PrecisionPtr)</slot> <slot>rtUnitChanged(QAbstractButton*)</slot> <slot>doEditZivyParams()</slot> <slot>doXicExtractionMethodChanged(pappso::XicExtractMethod)</slot> + <slot>doExportXicToCsv()</slot> </slots> <buttongroups> <buttongroup name="rt_unit_buttongroup"/> diff --git a/src/gui/xic_view/xicwindow.cpp b/src/gui/xic_view/xicwindow.cpp index 06373f04..f8abdb6c 100644 --- a/src/gui/xic_view/xicwindow.cpp +++ b/src/gui/xic_view/xicwindow.cpp @@ -60,6 +60,10 @@ XicWindow::XicWindow(ProjectWindow *parent) &ZivyDialog::accepted, this, &XicWindow::doAcceptedZivyDialog); + connect(this, + &XicWindow::operateXicAreaToCsv, + _project_window, + &ProjectWindow::doExportXicAreaToCsv); #if QT_VERSION >= 0x050000 // Qt5 code @@ -185,3 +189,27 @@ XicWindow::doXicExtractionMethodChanged(pappso::XicExtractMethod xic_method { emit reExtractXicNeeded(); } + +void +XicWindow::doExportXicToCsv() +{ + QSettings settings; + QString default_location = settings.value("path/export_ods", "").toString(); + + QString filename = + QFileDialog::getSaveFileName(this, + tr("Save CSV directory"), + QString("%1/new_dir").arg(default_location)); + + settings.setValue("path/export_ods", QFileInfo(filename).absolutePath()); + + + std::vector<XicBox *> xic_boxs; + + for(int i = 0; i < ui->verticalLayout->layout()->count(); i++) + { + xic_boxs.push_back( + dynamic_cast<XicBox *>(ui->verticalLayout->itemAt(i)->widget())); + } + emit operateXicAreaToCsv(filename, xic_boxs); +} diff --git a/src/gui/xic_view/xicwindow.h b/src/gui/xic_view/xicwindow.h index d20888a3..5435a009 100644 --- a/src/gui/xic_view/xicwindow.h +++ b/src/gui/xic_view/xicwindow.h @@ -74,10 +74,12 @@ class XicWindow : public QMainWindow void doEditZivyParams(); void doAcceptedZivyDialog(); void doXicExtractionMethodChanged(pappso::XicExtractMethod xic_method); + void doExportXicToCsv(); signals: void reExtractXicNeeded(); void rtUnitChangeNeeded(); + void operateXicAreaToCsv(QString filename, std::vector<XicBox *> xic_boxs); protected: diff --git a/src/main.cpp b/src/main.cpp index 3ff915de..d98d2172 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,6 +57,7 @@ main(int argc, char *argv[]) qRegisterMetaType<IdentificationDataSourceSp>("IdentificationDataSourceSp"); qRegisterMetaType<ContaminantRemovalMode>("ContaminantRemovalMode"); qRegisterMetaType<PtmMode>("PtmMode"); + qRegisterMetaType<std::vector<XicBox *>>("<std::vector<XicBox *>>"); // qRegisterMetaType<pappso::PeakIonIsotopeMatch>("pappso::PeakIonIsotopeMatch"); -- GitLab From a674ed2ae29a13c437c92f2e285f3a76db779ee5 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Fri, 16 Oct 2020 15:46:37 +0200 Subject: [PATCH 02/18] Correct no group selected for best reference --- .../exportmasschroqdialog.cpp | 34 ++++++++++++------- .../exportmasschroqdialog.h | 13 ++++--- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp index 8d2f1071..177f8f25 100644 --- a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp +++ b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp @@ -256,11 +256,19 @@ ExportMasschroqDialog::doBrowseMsrunDirectory() void ExportMasschroqDialog::doFindBestMsrunForAlignment() { - mp_main->showWaitingMessage(tr("Looking for MSrun reference")); - MsRunAlignmentGroupSp group = - msp_alignmentGroups.at(ui->group_listView->currentIndex().row()); + if(msp_selected_group != nullptr) + { + mp_main->showWaitingMessage(tr("Looking for MSrun reference")); - emit operateFindBestMsrunForAlignment(msp_project, group); + emit operateFindBestMsrunForAlignment(msp_project, msp_selected_group); + } + else + { + QMessageBox::warning( + this, + "Select a group", + "The reference is linked to a group.\n You have to select one."); + } } void @@ -328,22 +336,22 @@ ExportMasschroqDialog::doShowMsRunsInAlignmentGroup(QModelIndex index) { ui->listWidget->clear(); ui->msrun_list_combo_box->clear(); - MsRunAlignmentGroupSp selected_group = msp_alignmentGroups.at(index.row()); + msp_selected_group = msp_alignmentGroups.at(index.row()); ui->groupBox_5->setTitle("Ms runs in " + - selected_group->getMsRunAlignmentGroupName()); - for(MsRunSp ms_run : selected_group->getMsRunsInAlignmentGroup()) + msp_selected_group->getMsRunAlignmentGroupName()); + for(MsRunSp ms_run : msp_selected_group->getMsRunsInAlignmentGroup()) { ui->listWidget->addItem(ms_run->getSampleName()); ui->msrun_list_combo_box->addItem(ms_run->getSampleName()); } - if(selected_group->getMsRunReference() != nullptr) + if(msp_selected_group->getMsRunReference() != nullptr) { std::list<MsRunSp>::iterator it; - it = std::find(selected_group->getMsRunsInAlignmentGroup().begin(), - selected_group->getMsRunsInAlignmentGroup().end(), - selected_group->getMsRunReference()); - int idx = - std::distance(selected_group->getMsRunsInAlignmentGroup().begin(), it); + it = std::find(msp_selected_group->getMsRunsInAlignmentGroup().begin(), + msp_selected_group->getMsRunsInAlignmentGroup().end(), + msp_selected_group->getMsRunReference()); + int idx = std::distance( + msp_selected_group->getMsRunsInAlignmentGroup().begin(), it); ui->msrun_list_combo_box->setCurrentIndex(idx); } else diff --git a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.h b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.h index 2d4c1353..94f10f30 100644 --- a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.h +++ b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.h @@ -71,13 +71,6 @@ class ExportMasschroqDialog : public QDialog void setBestMsrunForAlignment(MsRunSp msrun_sp); void setCheckMsrunFilePathOk(MsRunSp msrun_sp); - private: - Ui::ExportMasschroqDialog *ui; - ProjectSp msp_project; - MainWindow *mp_main; - std::vector<MsRunAlignmentGroupSp> msp_alignmentGroups; - QStandardItemModel *mp_poModel; - protected slots: void doCheckMsrunFilepath(); void doBrowseMsrunDirectory(); @@ -85,4 +78,10 @@ class ExportMasschroqDialog : public QDialog void doShowMsRunsInAlignmentGroup(QModelIndex index); private: + Ui::ExportMasschroqDialog *ui; + ProjectSp msp_project; + MainWindow *mp_main; + std::vector<MsRunAlignmentGroupSp> msp_alignmentGroups; + QStandardItemModel *mp_poModel; + MsRunAlignmentGroupSp msp_selected_group; }; -- GitLab From 5fafd9e3aa9133db67a188bbaba2385413f84e50 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Mon, 26 Oct 2020 16:40:56 +0100 Subject: [PATCH 03/18] Add group name instead of fractiona1 https://forgemia.inra.fr/pappso/xtpcpp/-/issues/35 --- src/CMakeLists.txt | 2 +- src/gui/workerthread.cpp | 20 ++++++++++---------- src/output/masschroqml.cpp | 6 +++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 946b28a0..f139c7c1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -105,7 +105,7 @@ set(CPP_FILES output/ods/simplesheet.cpp output/ods/spectrasheet.cpp output/ods/spectrasheetall.cpp - output/ods/xicareasheet.cpp + #output/ods/xicareasheet.cpp output/exportfastafile.cpp output/masschroqml.cpp output/masschroqprm.cpp diff --git a/src/gui/workerthread.cpp b/src/gui/workerthread.cpp index 58eaa0d7..3d65526f 100644 --- a/src/gui/workerthread.cpp +++ b/src/gui/workerthread.cpp @@ -46,7 +46,7 @@ #include "project_view/projectwindow.h" #include "../core/tandem_run/tandembatchprocess.h" #include "../core/tandem_run/tandemcondorprocess.h" -#include "../output/ods/xicareasheet.h" +//#include "../output/ods/xicareasheet.h" #include <QSettings> WorkerThread::WorkerThread(MainWindow *p_main_window) @@ -876,13 +876,13 @@ void WorkerThread::doWriteXicAreaInCsv(QString filename, std::vector<XicBox *> xic_boxs) { - CalcWriterInterface *p_writer = nullptr; - - emit loadingMessage(tr("writing TSV files, please wait")); - p_writer = new TsvDirectoryWriter(filename); - XicAreaSheet(p_writer, xic_boxs); - bool all_data = true; - XicAreaSheet(p_writer, xic_boxs, all_data); - p_writer->close(); - emit exportXicToCsvFinished(); +// CalcWriterInterface *p_writer = nullptr; +// +// emit loadingMessage(tr("writing TSV files, please wait")); +// p_writer = new TsvDirectoryWriter(filename); +// XicAreaSheet(p_writer, xic_boxs); +// bool all_data = true; +// XicAreaSheet(p_writer, xic_boxs, all_data); +// p_writer->close(); +// emit exportXicToCsvFinished(); } diff --git a/src/output/masschroqml.cpp b/src/output/masschroqml.cpp index b07344f4..3b6fcb9d 100644 --- a/src/output/masschroqml.cpp +++ b/src/output/masschroqml.cpp @@ -263,10 +263,13 @@ MassChroQml::writeQuantificationTraces() void MassChroQml::writeQuantify() { + for(MsRunAlignmentGroupSp group_sp : m_params.alignment_groups) + { //<quantify id="q1" withingroup="G1" quantification_method_id="my_qzivy"> _output_stream->writeStartElement("quantify"); _output_stream->writeAttribute("id", "q1"); - _output_stream->writeAttribute("withingroup", "fractiona1"); + + _output_stream->writeAttribute("withingroup", group_sp->getMsRunAlignmentGroupName()); _output_stream->writeAttribute("quantification_method_id", "quant1"); //<peptides_in_peptide_list mode="real_or_mean" /> //</quantify> @@ -301,6 +304,7 @@ MassChroQml::writeQuantify() //</quantify> _output_stream->writeEndElement(); + } } void -- GitLab From 24408577d56f22fb2ccce0d68fa94c861f29394b Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Tue, 27 Oct 2020 09:57:28 +0100 Subject: [PATCH 04/18] change deprecated dirOnly option --- src/gui/tandem_run_dialog/tandemrundialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/tandem_run_dialog/tandemrundialog.cpp b/src/gui/tandem_run_dialog/tandemrundialog.cpp index 11a5e05a..c4c2e32f 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.cpp +++ b/src/gui/tandem_run_dialog/tandemrundialog.cpp @@ -407,7 +407,7 @@ TandemRunDialog::selectTdfFolder() QString default_tdf_location = settings.value("path/tandemrun_tdf_directory", "").toString(); QFileDialog directories_dialog; - directories_dialog.setFileMode(QFileDialog::DirectoryOnly); + directories_dialog.setOption(QFileDialog::ShowDirsOnly, true); directories_dialog.setOption(QFileDialog::DontUseNativeDialog, true); directories_dialog.setWindowTitle("Select the timsTOF folders"); QListView *lView = directories_dialog.findChild<QListView *>("listView"); -- GitLab From a2e0ce65fc7fe01a327d7c8aa14b0b6b4dce678f Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Tue, 27 Oct 2020 11:08:11 +0100 Subject: [PATCH 05/18] Add protein detail link to the ptmIsland window https://forgemia.inra.fr/pappso/xtpcpp/-/issues/29 --- src/gui/project_view/projectwindow.h | 1 + src/gui/ptm_island_list_view/ptmislandlistwindow.cpp | 9 +++++++++ src/gui/ptm_island_list_view/ptmislandlistwindow.h | 1 + src/gui/ptm_island_list_view/ptmislandproxymodel.cpp | 8 ++++---- src/gui/ptm_island_list_view/ptmislandtablemodel.cpp | 6 ++++++ src/gui/ptm_island_list_view/ptmislandtablemodel.h | 2 ++ 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index b2c2fa27..e8f06cab 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -54,6 +54,7 @@ class ProjectWindow : public QMainWindow friend class ProteinListWindow; friend class PeptideListWindow; friend class MsRunIdListWindow; + friend class PtmIslandListWindow; public: explicit ProjectWindow(MainWindow *parent = 0); diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp index b9a80f64..f5fe74ba 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp @@ -215,6 +215,15 @@ PtmIslandListWindow::askViewPtmPeptideList(PtmIsland *ptm_island) _p_current_ptm_peptide_list_window->show(); } +void PtmIslandListWindow::askProteinDetailView(ProteinMatch* p_protein_match) +{ + qDebug() << "begin"; + _project_window->doViewProteinDetail(p_protein_match); + qDebug() << "end"; + // updateStatusBar(); +} + + const IdentificationGroup * PtmIslandListWindow::getIdentificationGroup() const { diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.h b/src/gui/ptm_island_list_view/ptmislandlistwindow.h index e5f49d37..68af6eda 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.h +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.h @@ -76,6 +76,7 @@ class PtmIslandListWindow : public QMainWindow protected: void askViewPtmPeptideList(PtmIsland *ptm_island); + void askProteinDetailView(ProteinMatch *p_protein_match); private: void connectNewPtmPeptideListWindow(); diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp index 2cb3ca31..3b97bd39 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp @@ -169,18 +169,18 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) qDebug() << "PtmIslandProxyModel::onTableClicked begin " << this->mapToSource(index).row(); - //_protein_table_model_p->onTableClicked(this->mapToSource(index)); +// _protein_table_model_p->onTableClicked(this->mapToSource(index)); QModelIndex source_index(this->mapToSource(index)); int row = source_index.row(); int col = source_index.column(); - // ProteinMatch* p_protein_match = - // _p_ptm_island_table_model->getIdentificationGroup()->getProteinMatchList().at(row); + ProteinMatch* p_protein_match = + _p_ptm_island_table_model->getIdentificationGroup()->getProteinMatchList().at(row); if((col == (std::int8_t)PtmIslandListColumn::accession) || (col == (std::int8_t)PtmIslandListColumn::description)) { - //_p_ptm_island_table_model->askPtmProteinDetailView(p_protein_match); + _p_ptm_island_list_window->askProteinDetailView(p_protein_match); } else { diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp index 660556ec..bf560909 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp @@ -150,6 +150,12 @@ PtmIslandTableModel::setIdentificationGroup( this->_p_ptm_island_list_window->resizeColumnsToContents(); } + +IdentificationGroup * PtmIslandTableModel::getIdentificationGroup() +{ + return _p_identification_group; +} + const PtmGroupingExperiment * PtmIslandTableModel::getPtmGroupingExperiment() const { diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.h b/src/gui/ptm_island_list_view/ptmislandtablemodel.h index 38581f36..4a3711a9 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.h +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.h @@ -68,6 +68,8 @@ class PtmIslandTableModel : public QAbstractTableModel ~PtmIslandTableModel(); void setIdentificationGroup(IdentificationGroup *p_identification_group); + IdentificationGroup * getIdentificationGroup(); + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; virtual int -- GitLab From 18b829b6e2a0fa56644a4f0edb2887be4d645b14 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Tue, 27 Oct 2020 16:16:27 +0100 Subject: [PATCH 06/18] Add column management to PTM island list window --- .../ptm_island_list_view.ui | 29 +++++++++- .../ptmislandlistwindow.cpp | 56 +++++++++++++++++-- .../ptmislandlistwindow.h | 27 ++++++++- .../ptmislandproxymodel.cpp | 37 ++++++++++++ .../ptmislandproxymodel.h | 10 +++- .../ptmislandtablemodel.cpp | 5 ++ .../ptmislandtablemodel.h | 4 +- 7 files changed, 158 insertions(+), 10 deletions(-) diff --git a/src/gui/ptm_island_list_view/ptm_island_list_view.ui b/src/gui/ptm_island_list_view/ptm_island_list_view.ui index 10d234c1..631e1ade 100644 --- a/src/gui/ptm_island_list_view/ptm_island_list_view.ui +++ b/src/gui/ptm_island_list_view/ptm_island_list_view.ui @@ -79,11 +79,38 @@ <x>0</x> <y>0</y> <width>826</width> - <height>25</height> + <height>22</height> </rect> </property> + <widget class="QMenu" name="menu_Columns"> + <property name="title"> + <string>&Columns</string> + </property> + </widget> + <widget class="QMenu" name="menu_Show_Only"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>&Show Only</string> + </property> + <addaction name="actionChecked_PTM"/> + </widget> + <addaction name="menu_Columns"/> + <addaction name="menu_Show_Only"/> </widget> <widget class="QStatusBar" name="statusbar"/> + <action name="actionChecked_PTM"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Checked PTM</string> + </property> + </action> </widget> <resources/> <connections> diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp index f5fe74ba..619d0bf1 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp @@ -36,6 +36,33 @@ #include <QSettings> #include "../ptm_peptide_list_view/ptmpeptidelistwindow.h" +PtmIslandListQActionColumn::PtmIslandListQActionColumn ( PtmIslandListWindow* parent, PtmIslandListColumn column ) +: QAction(parent) +{ + this->setText(PtmIslandTableModel::getTitle(column)); + + this->setCheckable(true); + this->setChecked(parent->getPtmIslandListColumnDisplay(column)); + + m_column = column; + mp_ptmIslandWindow = parent; + + connect(this, + &PtmIslandListQActionColumn::toggled, + this, + &PtmIslandListQActionColumn::doToggled); +} + +PtmIslandListQActionColumn::~PtmIslandListQActionColumn() +{ +} + +void PtmIslandListQActionColumn::doToggled ( bool toggled ) +{ + setChecked(toggled); + mp_ptmIslandWindow->setPtmIslandListColumnDisplay(m_column, toggled); +} + PtmIslandListWindow::PtmIslandListWindow(ProjectWindow *parent) : QMainWindow(parent), ui(new Ui::PtmIslandListWindow) @@ -60,7 +87,7 @@ PtmIslandListWindow::PtmIslandListWindow(ProjectWindow *parent) _statusbar_displayed_label = new QLabel(""); ui->statusbar->addWidget(_statusbar_displayed_label); - + #if QT_VERSION >= 0x050000 // Qt5 code connect(this, @@ -140,6 +167,28 @@ PtmIslandListWindow::setIdentificationGroup( qDebug() << "PtmIslandListWindow::setIdentificationGroup end"; } +void PtmIslandListWindow::setPtmIslandListColumnDisplay ( PtmIslandListColumn column, bool toggled ) +{ + _ptm_proxy_model_p->setPtmIslandListColumnDisplay(column, toggled); +} + +bool PtmIslandListWindow::getPtmIslandListColumnDisplay ( PtmIslandListColumn column ) const +{ + return _ptm_proxy_model_p->getPtmIslandListColumnDisplay(column); +} + +void PtmIslandListWindow::setColumnMenuList() +{ + PtmIslandListQActionColumn *p_action; + qInfo() << _ptm_table_model_p->columnCount(); + for(int i = 0; i < _ptm_table_model_p->columnCount(); i++) + { + p_action = new PtmIslandListQActionColumn( + this, PtmIslandTableModel::getPtmIslandListColumn(i)); + ui->menu_Columns->addAction(p_action); + } +} + void PtmIslandListWindow::doIdentificationGroupGrouped( IdentificationGroup *p_identification_group) @@ -177,7 +226,7 @@ PtmIslandListWindow::doIdentificationPtmGroupGrouped( .arg(p_ptm_grouping_experiment->getPtmIslandList().size())); // ui->ptm_island_tableview->resizeRowToContents(_ptm_table_model_p->rowCount()); } - + setColumnMenuList(); qDebug() << "PtmIslandListWindow::doIdentificationPtmGroupGrouped end"; } @@ -223,14 +272,12 @@ void PtmIslandListWindow::askProteinDetailView(ProteinMatch* p_protein_match) // updateStatusBar(); } - const IdentificationGroup * PtmIslandListWindow::getIdentificationGroup() const { return _p_identification_group; } - void PtmIslandListWindow::updateStatusBar() { @@ -244,7 +291,6 @@ PtmIslandListWindow::updateStatusBar() } } - void PtmIslandListWindow::doPtmSearchEdit(QString ptm_search_string) { diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.h b/src/gui/ptm_island_list_view/ptmislandlistwindow.h index 68af6eda..1787da1d 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.h +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.h @@ -32,6 +32,7 @@ #define PTMISLANDLISTWINDOW_H #include <QMainWindow> #include <QLabel> +#include <QAction> #include "ptmislandtablemodel.h" #include "ptmislandproxymodel.h" #include "../../core/identificationgroup.h" @@ -45,6 +46,24 @@ namespace Ui class PtmIslandListWindow; } +class PtmIslandListWindow; +class PtmIslandListQActionColumn : public QAction +{ + Q_OBJECT + public: + explicit PtmIslandListQActionColumn(PtmIslandListWindow *parent, + PtmIslandListColumn column); + ~PtmIslandListQActionColumn(); + + + public slots: + void doToggled(bool toggled); + + private: + PtmIslandListWindow *mp_ptmIslandWindow; + PtmIslandListColumn m_column; +}; + class PtmIslandListWindow : public QMainWindow { Q_OBJECT @@ -57,8 +76,12 @@ class PtmIslandListWindow : public QMainWindow void resizeColumnsToContents(); const IdentificationGroup *getIdentificationGroup() const; ProjectWindow *getProjectWindowP(); - - + void setPtmIslandListColumnDisplay(PtmIslandListColumn column, + bool toggled); + bool + getPtmIslandListColumnDisplay(PtmIslandListColumn column) const; + void setColumnMenuList(); + public slots: void doIdentificationPtmGroupGrouped(IdentificationGroup *p_identification_group); diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp index 3b97bd39..77c49a1f 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp @@ -28,6 +28,7 @@ *implementation ******************************************************************************/ +#include <QSettings> #include "ptmislandproxymodel.h" #include "ptmislandtablemodel.h" #include "ptmislandlistwindow.h" @@ -43,12 +44,30 @@ PtmIslandProxyModel::PtmIslandProxyModel( _p_ptm_island_table_model = ptm_table_model_p; _ptm_search_string = ""; _search_on = "accession"; + m_column_display.resize(30); + qDebug() << "Test creation data"; + QSettings settings; + for(std::size_t i = 0; i < m_column_display.size(); i++) + { + m_column_display[i] = + settings + .value(QString("ptm_island_columns/%1") + .arg(_p_ptm_island_table_model->getTitle( + (PtmIslandListColumn)i)), + "true") + .toBool(); + } } PtmIslandProxyModel::~PtmIslandProxyModel() { } +bool PtmIslandProxyModel::filterAcceptsColumn ( int source_column, const QModelIndex& source_parent ) const +{ + return m_column_display[source_column]; +} + bool PtmIslandProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent @@ -194,6 +213,24 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) qDebug() << "PtmIslandProxyModel::onTableClicked end " << index.row(); } +bool PtmIslandProxyModel::getPtmIslandListColumnDisplay (PtmIslandListColumn column ) const +{ + return m_column_display[(std::int8_t)column]; +} + +void PtmIslandProxyModel::setPtmIslandListColumnDisplay (PtmIslandListColumn column, bool toggled ) +{ + qDebug() << "begin " << toggled; + beginResetModel(); + QSettings settings; + settings.setValue(QString("ptm_island_columns/%1") + .arg(_p_ptm_island_table_model->getTitle(column)), + toggled); + + m_column_display[(std::int8_t)column] = toggled; + endResetModel(); +} + void PtmIslandProxyModel::setSearchOn(QString search_on) diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.h b/src/gui/ptm_island_list_view/ptmislandproxymodel.h index b65464b8..b0f6a996 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.h +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.h @@ -33,6 +33,7 @@ #include <QAbstractTableModel> #include <QSortFilterProxyModel> +#include "ptmislandtablemodel.h" class PtmIslandListWindow; @@ -45,19 +46,26 @@ class PtmIslandProxyModel : public QSortFilterProxyModel PtmIslandProxyModel(PtmIslandListWindow *p_ptm_island_list_window, PtmIslandTableModel *ptm_table_model_p); ~PtmIslandProxyModel(); + bool filterAcceptsColumn(int source_column, + const QModelIndex &source_parent) const override; bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; void setSearchOn(QString search_on); void setPtmSearchString(QString ptm_search_string); - + void setPtmIslandListColumnDisplay(PtmIslandListColumn column, + bool toggled); + bool + getPtmIslandListColumnDisplay(PtmIslandListColumn column) const; + public slots: void onTableClicked(const QModelIndex &index); private: PtmIslandListWindow *_p_ptm_island_list_window; PtmIslandTableModel *_p_ptm_island_table_model; + std::vector<bool> m_column_display; QString _search_on; QString _ptm_search_string; }; diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp index bf560909..bb26f5bb 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp @@ -57,6 +57,11 @@ PtmIslandTableModel::getDescription(PtmIslandListColumn column) // qDebug() << "ProteinTableModel::columnCount end "; } +PtmIslandListColumn PtmIslandTableModel::getPtmIslandListColumn ( std::int8_t column ) +{ + return static_cast<PtmIslandListColumn>(column); +} + const QString PtmIslandTableModel::getTitle(std::int8_t column) { diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.h b/src/gui/ptm_island_list_view/ptmislandtablemodel.h index 4a3711a9..96274847 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.h +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.h @@ -81,7 +81,9 @@ class PtmIslandTableModel : public QAbstractTableModel static const QString getTitle(PtmIslandListColumn column); static const QString getDescription(PtmIslandListColumn column); - + static PtmIslandListColumn + getPtmIslandListColumn(std::int8_t column); + const PtmGroupingExperiment *getPtmGroupingExperiment() const; public slots: -- GitLab From 7444e2a7176677223617f23aa379b11ea44855d1 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Tue, 27 Oct 2020 17:04:57 +0100 Subject: [PATCH 07/18] Add checked column to manage ptm island --- .../ptm_island_list_view.ui | 18 +++++++++- .../ptmislandlistwindow.cpp | 8 ++++- .../ptmislandlistwindow.h | 7 ++-- .../ptmislandproxymodel.cpp | 33 +++++++++++++++++-- .../ptmislandproxymodel.h | 3 +- .../ptmislandtablemodel.cpp | 29 ++++++++++++++-- .../ptmislandtablemodel.h | 28 ++++++++-------- 7 files changed, 98 insertions(+), 28 deletions(-) diff --git a/src/gui/ptm_island_list_view/ptm_island_list_view.ui b/src/gui/ptm_island_list_view/ptm_island_list_view.ui index 631e1ade..84599b85 100644 --- a/src/gui/ptm_island_list_view/ptm_island_list_view.ui +++ b/src/gui/ptm_island_list_view/ptm_island_list_view.ui @@ -89,7 +89,7 @@ </widget> <widget class="QMenu" name="menu_Show_Only"> <property name="enabled"> - <bool>false</bool> + <bool>true</bool> </property> <property name="title"> <string>&Show Only</string> @@ -146,6 +146,22 @@ </hint> </hints> </connection> + <connection> + <sender>actionChecked_PTM</sender> + <signal>toggled(bool)</signal> + <receiver>PtmIslandListWindow</receiver> + <slot>doNotCheckedHide(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel"> + <x>412</x> + <y>201</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>doNotValidHide(bool)</slot> diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp index 619d0bf1..010c2173 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp @@ -180,7 +180,6 @@ bool PtmIslandListWindow::getPtmIslandListColumnDisplay ( PtmIslandListColumn co void PtmIslandListWindow::setColumnMenuList() { PtmIslandListQActionColumn *p_action; - qInfo() << _ptm_table_model_p->columnCount(); for(int i = 0; i < _ptm_table_model_p->columnCount(); i++) { p_action = new PtmIslandListQActionColumn( @@ -189,6 +188,13 @@ void PtmIslandListWindow::setColumnMenuList() } } +void PtmIslandListWindow::doNotCheckedHide ( bool hide ) +{ + _ptm_proxy_model_p->hideNotChecked(hide); + emit ptmIslandDataChanged(); +} + + void PtmIslandListWindow::doIdentificationGroupGrouped( IdentificationGroup *p_identification_group) diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.h b/src/gui/ptm_island_list_view/ptmislandlistwindow.h index 1787da1d..1fa23da7 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.h +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.h @@ -28,8 +28,8 @@ *implementation ******************************************************************************/ -#ifndef PTMISLANDLISTWINDOW_H -#define PTMISLANDLISTWINDOW_H +#pragma once + #include <QMainWindow> #include <QLabel> #include <QAction> @@ -92,6 +92,7 @@ class PtmIslandListWindow : public QMainWindow void updateStatusBar(); void doPtmSearchEdit(QString ptm_search_string); void doSearchOn(QString search_on); + void doNotCheckedHide(bool hide); signals: @@ -117,5 +118,3 @@ class PtmIslandListWindow : public QMainWindow QLabel *_statusbar_displayed_label; QLabel *_statusbar_ptm_islands_label; }; - -#endif // PTMISLANDLISTWINDOW_H diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp index 77c49a1f..7a4501d8 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp @@ -81,9 +81,20 @@ PtmIslandProxyModel::filterAcceptsRow(int source_row, _p_ptm_island_table_model->getPtmGroupingExperiment() ->getPtmIslandList() .at(source_row); + ProteinMatch *protein_match = + _p_ptm_island_table_model->getIdentificationGroup() + ->getProteinMatchList() + .at(source_row); + // qDebug() << "Prote // qDebug() << "ProteinTableProxyModel::filterAcceptsRow protein_match " // << source_row; - + if(m_hideNotChecked) + { + if(!protein_match->isChecked()) + { + return false; + } + } if(!_ptm_search_string.isEmpty()) { if(_search_on == "accession") @@ -195,8 +206,19 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) ProteinMatch* p_protein_match = _p_ptm_island_table_model->getIdentificationGroup()->getProteinMatchList().at(row); - - if((col == (std::int8_t)PtmIslandListColumn::accession) || + + if(col == (std::int8_t)PtmIslandListColumn::checked) + { + if(p_protein_match->isChecked()) + { + p_protein_match->setChecked(false); + } + else + { + p_protein_match->setChecked(true); + } + } + else if((col == (std::int8_t)PtmIslandListColumn::accession) || (col == (std::int8_t)PtmIslandListColumn::description)) { _p_ptm_island_list_window->askProteinDetailView(p_protein_match); @@ -231,6 +253,11 @@ void PtmIslandProxyModel::setPtmIslandListColumnDisplay (PtmIslandListColumn col endResetModel(); } +void PtmIslandProxyModel::hideNotChecked ( bool hide ) +{ + m_hideNotChecked = hide; +} + void PtmIslandProxyModel::setSearchOn(QString search_on) diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.h b/src/gui/ptm_island_list_view/ptmislandproxymodel.h index b0f6a996..2bcccaf5 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.h +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.h @@ -52,7 +52,7 @@ class PtmIslandProxyModel : public QSortFilterProxyModel const QModelIndex &source_parent) const override; void setSearchOn(QString search_on); - + void hideNotChecked(bool hide); void setPtmSearchString(QString ptm_search_string); void setPtmIslandListColumnDisplay(PtmIslandListColumn column, bool toggled); @@ -66,6 +66,7 @@ class PtmIslandProxyModel : public QSortFilterProxyModel PtmIslandListWindow *_p_ptm_island_list_window; PtmIslandTableModel *_p_ptm_island_table_model; std::vector<bool> m_column_display; + bool m_hideNotChecked = true; QString _search_on; QString _ptm_search_string; }; diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp index bb26f5bb..498d11d9 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp @@ -67,7 +67,9 @@ PtmIslandTableModel::getTitle(std::int8_t column) { switch(column) { - + case(std::int8_t)PtmIslandListColumn::checked: + return "Checked"; + break; case(std::int8_t)PtmIslandListColumn::spectrum: return "spectrum"; break; @@ -106,7 +108,9 @@ PtmIslandTableModel::getDescription(std::int8_t column) { switch(column) { - + case(std::int8_t)PtmIslandListColumn::checked: + return "Checked PTM"; + break; case(std::int8_t)PtmIslandListColumn::spectrum: return "number of distinct spectrum assigned to this PTM island"; break; @@ -224,6 +228,21 @@ PtmIslandTableModel::data(const QModelIndex &index, int role) const int col = index.column(); switch(role) { + case Qt::CheckStateRole: + if(col == (std::int8_t)PtmIslandListColumn::checked) // add a checkbox to cell(1,0) + { + if(_p_identification_group->getProteinMatchList() + .at(row) + ->isChecked()) + { + return Qt::Checked; + } + else + { + return Qt::Unchecked; + } + } + break; case Qt::SizeHintRole: // qDebug() << "ProteinTableModel::headerData " << // ProteinTableModel::getColumnWidth(section); @@ -236,7 +255,9 @@ PtmIslandTableModel::data(const QModelIndex &index, int role) const } switch(col) { - + case(std::int8_t)PtmIslandListColumn::checked: + return QVariant(); + break; case(std::int8_t)PtmIslandListColumn::spectrum: return QVariant((quint64)getPtmGroupingExperiment() ->getPtmIslandList() @@ -342,6 +363,8 @@ PtmIslandTableModel::getColumnWidth(int column) qDebug() << "PtmIslandTableModel::getColumnWidth " << column; switch(column) { + case(int)PtmIslandListColumn::checked: + break; case(int)PtmIslandListColumn::accession: qDebug() << "PtmIslandTableModel::getColumnWidth accession " << column; return 250; diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.h b/src/gui/ptm_island_list_view/ptmislandtablemodel.h index 96274847..dd38a98a 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.h +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.h @@ -28,8 +28,7 @@ *implementation ******************************************************************************/ -#ifndef PTMISLANDTABLEMODEL_H -#define PTMISLANDTABLEMODEL_H +#pragma once #include <QAbstractTableModel> #include "../../core/identificationgroup.h" @@ -43,17 +42,18 @@ enum class PtmIslandListColumn : std::int8_t { - ptm_island_id = 0, ///< ptm_island_id - accession = 1, ///< protein accession - description = 2, ///< protein description - ptm_position_list = 3, ///< ptm position list - spectrum = 4, ///< count sample scans - ptm_spectrum = 5, ///< count scan with ptm - sequence = 6, ///< unique sequence count - multiptm = 7, ///< count multi ptm peptide match - ptm_island_start = 8, ///< start position of the ptm island on the protein - ptm_island_length = 9, ///< length of the ptm island - last = 10, + checked = 0, ///< checked ptm + ptm_island_id = 1, ///< ptm_island_id + accession = 2, ///< protein accession + description = 3, ///< protein description + ptm_position_list = 4, ///< ptm position list + spectrum = 5, ///< count sample scans + ptm_spectrum = 6, ///< count scan with ptm + sequence = 7, ///< unique sequence count + multiptm = 8, ///< count multi ptm peptide match + ptm_island_start = 9, ///< start position of the ptm island on the protein + ptm_island_length = 10, ///< length of the ptm island + last = 11, }; @@ -98,5 +98,3 @@ class PtmIslandTableModel : public QAbstractTableModel IdentificationGroup *_p_identification_group = nullptr; PtmIslandListWindow *_p_ptm_island_list_window = nullptr; }; - -#endif // PTMISLANDTABLEMODEL_H -- GitLab From 145079c1011d01d91343169af15b907e71226a6a Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 09:21:33 +0100 Subject: [PATCH 08/18] add xicareasheet --- src/output/ods/xicareasheet.cpp | 132 ++++++++++++++++++++++++++++++++ src/output/ods/xicareasheet.h | 52 +++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 src/output/ods/xicareasheet.cpp create mode 100644 src/output/ods/xicareasheet.h diff --git a/src/output/ods/xicareasheet.cpp b/src/output/ods/xicareasheet.cpp new file mode 100644 index 00000000..1e790aad --- /dev/null +++ b/src/output/ods/xicareasheet.cpp @@ -0,0 +1,132 @@ +/** + * \file /output/xicareasheet.cpp + * \date 16/10/2020 + * \author Olivier Langella + * \brief ODS grouping sheet + */ + +/******************************************************************************* + * Copyright (c) 2020 Thomas Renne <thomas.renne@u-psud.fr>. + * + * This file is part of XTPcpp. + * + * XTPcpp 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. + * + * XTPcpp 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 XTPcpp. If not, see <http://www.gnu.org/licenses/>. + * + * Contributors: + * Thomas Renne <thomas.renne@u-psud.fr> - initial API and + *implementation + ******************************************************************************/ + +#include "xicareasheet.h" + +XicAreaSheet::XicAreaSheet(CalcWriterInterface *p_writer, + const std::vector<XicBox *> xic_boxs, + bool all_data) +{ + mp_writer = p_writer; + + mp_xicBoxList = xic_boxs; + + OdsTableSettings table_settings; + table_settings.setVerticalSplit(1); + mp_writer->setCurrentOdsTableSettings(table_settings); + if(all_data) + { + mp_writer->writeSheet("xic_all_data"); + writeHeadersAllData(); + for(XicBox *xic : mp_xicBoxList) + { + writeXicAllData(xic); + } + } + else + { + mp_writer->writeSheet("xic_area"); + writeHeaders(); + for(XicBox *xic : mp_xicBoxList) + { + writeAreaPeackdata(xic); + } + } +} + +void +XicAreaSheet::writeHeaders() +{ + mp_writer->writeLine(); + mp_writer->setCellAnnotation("ms run name"); + mp_writer->writeCell("msrun"); + mp_writer->setCellAnnotation("area of the peak"); + mp_writer->writeCell("area"); + mp_writer->setCellAnnotation("left boundary of the peak"); + mp_writer->writeCell("rt_begin"); + mp_writer->setCellAnnotation( + "retention time of the max intensity in the peak"); + mp_writer->writeCell("rt_max"); + mp_writer->setCellAnnotation("right boundary of the peak"); + mp_writer->writeCell("rt_end"); + mp_writer->setCellAnnotation("Isotope"); + mp_writer->writeCell("isotope"); +} + +void +XicAreaSheet::writeHeadersAllData() +{ + mp_writer->writeLine(); + mp_writer->setCellAnnotation("ms run name"); + mp_writer->writeCell("msrun"); + mp_writer->setCellAnnotation("Isotope"); + mp_writer->writeCell("isotope"); + mp_writer->setCellAnnotation("retention time of point"); + mp_writer->writeCell("rt"); + mp_writer->setCellAnnotation("intensity of point"); + mp_writer->writeCell("intensity"); +} + + +void +XicAreaSheet::writeAreaPeackdata(XicBox *xic_box) +{ + for(XicBoxNaturalIsotope isotope : xic_box->getNaturalIsotopList()) + { + for(pappso::TracePeakCstSPtr trace : isotope.detected_peak_list) + { + mp_writer->writeLine(); + mp_writer->writeCell(""); + mp_writer->writeCell(trace->getArea()); + mp_writer->writeCell(trace->getLeftBoundary().x); + mp_writer->writeCell(trace->getMaxXicElement().x); + mp_writer->writeCell(trace->getRightBoundary().x); + mp_writer->writeCell( + int(isotope.peptide_natural_isotope_sp->getIsotopeNumber())); + } + } +} + +void +XicAreaSheet::writeXicAllData(XicBox *xic_box) +{ + for(XicBoxNaturalIsotope isotope : xic_box->getNaturalIsotopList()) + { + for(std::size_t i = 0; i < isotope.xic_sp->xValues().size(); i++) + { + mp_writer->writeLine(); + mp_writer->writeCell(""); + mp_writer->writeCell( + int(isotope.peptide_natural_isotope_sp->getIsotopeNumber())); + mp_writer->writeCell(isotope.xic_sp->xValues().at(i)); + mp_writer->writeCell(isotope.xic_sp->yValues().at(i)); + } + } +} diff --git a/src/output/ods/xicareasheet.h b/src/output/ods/xicareasheet.h new file mode 100644 index 00000000..c6a9a143 --- /dev/null +++ b/src/output/ods/xicareasheet.h @@ -0,0 +1,52 @@ +/** + * \file /output/xicareasheet.h + * \date 16/10/2020 + * \author Thomas Renne + * \brief ODS grouping sheet + */ + +/******************************************************************************* + * Copyright (c) 2020 Thomas Renne <thomas.renne@u-psud.fr>. + * + * This file is part of XTPcpp. + * + * XTPcpp 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. + * + * XTPcpp 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 XTPcpp. If not, see <http://www.gnu.org/licenses/>. + * + * Contributors: + * Thomas Renne <thomas.renne@u-psud.fr> - initial API and + *implementation + ******************************************************************************/ +#pragma once + +#include <odsstream/calcwriterinterface.h> +#include "../../core/project.h" +#include "../../gui/xic_view/xic_box/xicbox.h" + +class XicAreaSheet +{ + public: + XicAreaSheet(CalcWriterInterface *p_writer, + const std::vector<XicBox *> xic_boxs, + bool all_data = false); + + private: + void writeAreaPeackdata(XicBox *xic_box); + void writeXicAllData(XicBox *xic_box); + void writeHeaders(); + void writeHeadersAllData(); + + private: + std::vector<XicBox *> mp_xicBoxList; + CalcWriterInterface *mp_writer; +}; -- GitLab From e9b60531ecf6ffbd8eceaa63fb8e3d7b284af3c4 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 09:23:25 +0100 Subject: [PATCH 09/18] Add xicarea in other objects --- src/CMakeLists.txt | 2 +- src/gui/workerthread.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f139c7c1..946b28a0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -105,7 +105,7 @@ set(CPP_FILES output/ods/simplesheet.cpp output/ods/spectrasheet.cpp output/ods/spectrasheetall.cpp - #output/ods/xicareasheet.cpp + output/ods/xicareasheet.cpp output/exportfastafile.cpp output/masschroqml.cpp output/masschroqprm.cpp diff --git a/src/gui/workerthread.cpp b/src/gui/workerthread.cpp index 3d65526f..58eaa0d7 100644 --- a/src/gui/workerthread.cpp +++ b/src/gui/workerthread.cpp @@ -46,7 +46,7 @@ #include "project_view/projectwindow.h" #include "../core/tandem_run/tandembatchprocess.h" #include "../core/tandem_run/tandemcondorprocess.h" -//#include "../output/ods/xicareasheet.h" +#include "../output/ods/xicareasheet.h" #include <QSettings> WorkerThread::WorkerThread(MainWindow *p_main_window) @@ -876,13 +876,13 @@ void WorkerThread::doWriteXicAreaInCsv(QString filename, std::vector<XicBox *> xic_boxs) { -// CalcWriterInterface *p_writer = nullptr; -// -// emit loadingMessage(tr("writing TSV files, please wait")); -// p_writer = new TsvDirectoryWriter(filename); -// XicAreaSheet(p_writer, xic_boxs); -// bool all_data = true; -// XicAreaSheet(p_writer, xic_boxs, all_data); -// p_writer->close(); -// emit exportXicToCsvFinished(); + CalcWriterInterface *p_writer = nullptr; + + emit loadingMessage(tr("writing TSV files, please wait")); + p_writer = new TsvDirectoryWriter(filename); + XicAreaSheet(p_writer, xic_boxs); + bool all_data = true; + XicAreaSheet(p_writer, xic_boxs, all_data); + p_writer->close(); + emit exportXicToCsvFinished(); } -- GitLab From d354844472b5717a90ab38eb7895439e4c1c107e Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 09:24:53 +0100 Subject: [PATCH 10/18] Correct format indentation --- .../ptmislandlistwindow.cpp | 39 +++++++++------ .../ptmislandlistwindow.h | 10 ++-- .../ptmislandproxymodel.cpp | 47 +++++++++++-------- .../ptmislandproxymodel.h | 13 ++--- .../ptmislandtablemodel.cpp | 11 +++-- .../ptmislandtablemodel.h | 29 ++++++------ 6 files changed, 81 insertions(+), 68 deletions(-) diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp index 010c2173..8d1b86fa 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp @@ -36,8 +36,9 @@ #include <QSettings> #include "../ptm_peptide_list_view/ptmpeptidelistwindow.h" -PtmIslandListQActionColumn::PtmIslandListQActionColumn ( PtmIslandListWindow* parent, PtmIslandListColumn column ) -: QAction(parent) +PtmIslandListQActionColumn::PtmIslandListQActionColumn( + PtmIslandListWindow *parent, PtmIslandListColumn column) + : QAction(parent) { this->setText(PtmIslandTableModel::getTitle(column)); @@ -57,7 +58,8 @@ PtmIslandListQActionColumn::~PtmIslandListQActionColumn() { } -void PtmIslandListQActionColumn::doToggled ( bool toggled ) +void +PtmIslandListQActionColumn::doToggled(bool toggled) { setChecked(toggled); mp_ptmIslandWindow->setPtmIslandListColumnDisplay(m_column, toggled); @@ -87,7 +89,7 @@ PtmIslandListWindow::PtmIslandListWindow(ProjectWindow *parent) _statusbar_displayed_label = new QLabel(""); ui->statusbar->addWidget(_statusbar_displayed_label); - + #if QT_VERSION >= 0x050000 // Qt5 code connect(this, @@ -167,19 +169,24 @@ PtmIslandListWindow::setIdentificationGroup( qDebug() << "PtmIslandListWindow::setIdentificationGroup end"; } -void PtmIslandListWindow::setPtmIslandListColumnDisplay ( PtmIslandListColumn column, bool toggled ) +void +PtmIslandListWindow::setPtmIslandListColumnDisplay(PtmIslandListColumn column, + bool toggled) { - _ptm_proxy_model_p->setPtmIslandListColumnDisplay(column, toggled); + _ptm_proxy_model_p->setPtmIslandListColumnDisplay(column, toggled); } -bool PtmIslandListWindow::getPtmIslandListColumnDisplay ( PtmIslandListColumn column ) const +bool +PtmIslandListWindow::getPtmIslandListColumnDisplay( + PtmIslandListColumn column) const { - return _ptm_proxy_model_p->getPtmIslandListColumnDisplay(column); + return _ptm_proxy_model_p->getPtmIslandListColumnDisplay(column); } -void PtmIslandListWindow::setColumnMenuList() +void +PtmIslandListWindow::setColumnMenuList() { - PtmIslandListQActionColumn *p_action; + PtmIslandListQActionColumn *p_action; for(int i = 0; i < _ptm_table_model_p->columnCount(); i++) { p_action = new PtmIslandListQActionColumn( @@ -188,10 +195,11 @@ void PtmIslandListWindow::setColumnMenuList() } } -void PtmIslandListWindow::doNotCheckedHide ( bool hide ) +void +PtmIslandListWindow::doNotCheckedHide(bool hide) { - _ptm_proxy_model_p->hideNotChecked(hide); - emit ptmIslandDataChanged(); + _ptm_proxy_model_p->hideNotChecked(hide); + emit ptmIslandDataChanged(); } @@ -232,7 +240,7 @@ PtmIslandListWindow::doIdentificationPtmGroupGrouped( .arg(p_ptm_grouping_experiment->getPtmIslandList().size())); // ui->ptm_island_tableview->resizeRowToContents(_ptm_table_model_p->rowCount()); } - setColumnMenuList(); + setColumnMenuList(); qDebug() << "PtmIslandListWindow::doIdentificationPtmGroupGrouped end"; } @@ -270,7 +278,8 @@ PtmIslandListWindow::askViewPtmPeptideList(PtmIsland *ptm_island) _p_current_ptm_peptide_list_window->show(); } -void PtmIslandListWindow::askProteinDetailView(ProteinMatch* p_protein_match) +void +PtmIslandListWindow::askProteinDetailView(ProteinMatch *p_protein_match) { qDebug() << "begin"; _project_window->doViewProteinDetail(p_protein_match); diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.h b/src/gui/ptm_island_list_view/ptmislandlistwindow.h index 1fa23da7..a4cfea46 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.h +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.h @@ -52,7 +52,7 @@ class PtmIslandListQActionColumn : public QAction Q_OBJECT public: explicit PtmIslandListQActionColumn(PtmIslandListWindow *parent, - PtmIslandListColumn column); + PtmIslandListColumn column); ~PtmIslandListQActionColumn(); @@ -76,12 +76,10 @@ class PtmIslandListWindow : public QMainWindow void resizeColumnsToContents(); const IdentificationGroup *getIdentificationGroup() const; ProjectWindow *getProjectWindowP(); - void setPtmIslandListColumnDisplay(PtmIslandListColumn column, - bool toggled); - bool - getPtmIslandListColumnDisplay(PtmIslandListColumn column) const; + void setPtmIslandListColumnDisplay(PtmIslandListColumn column, bool toggled); + bool getPtmIslandListColumnDisplay(PtmIslandListColumn column) const; void setColumnMenuList(); - + public slots: void doIdentificationPtmGroupGrouped(IdentificationGroup *p_identification_group); diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp index 7a4501d8..024cb563 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp @@ -51,10 +51,10 @@ PtmIslandProxyModel::PtmIslandProxyModel( { m_column_display[i] = settings - .value(QString("ptm_island_columns/%1") - .arg(_p_ptm_island_table_model->getTitle( - (PtmIslandListColumn)i)), - "true") + .value( + QString("ptm_island_columns/%1") + .arg(_p_ptm_island_table_model->getTitle((PtmIslandListColumn)i)), + "true") .toBool(); } } @@ -63,9 +63,11 @@ PtmIslandProxyModel::~PtmIslandProxyModel() { } -bool PtmIslandProxyModel::filterAcceptsColumn ( int source_column, const QModelIndex& source_parent ) const +bool +PtmIslandProxyModel::filterAcceptsColumn(int source_column, + const QModelIndex &source_parent) const { - return m_column_display[source_column]; + return m_column_display[source_column]; } bool @@ -81,7 +83,7 @@ PtmIslandProxyModel::filterAcceptsRow(int source_row, _p_ptm_island_table_model->getPtmGroupingExperiment() ->getPtmIslandList() .at(source_row); - ProteinMatch *protein_match = + ProteinMatch *protein_match = _p_ptm_island_table_model->getIdentificationGroup() ->getProteinMatchList() .at(source_row); @@ -199,17 +201,19 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) qDebug() << "PtmIslandProxyModel::onTableClicked begin " << this->mapToSource(index).row(); -// _protein_table_model_p->onTableClicked(this->mapToSource(index)); + // _protein_table_model_p->onTableClicked(this->mapToSource(index)); QModelIndex source_index(this->mapToSource(index)); int row = source_index.row(); int col = source_index.column(); - ProteinMatch* p_protein_match = - _p_ptm_island_table_model->getIdentificationGroup()->getProteinMatchList().at(row); - + ProteinMatch *p_protein_match = + _p_ptm_island_table_model->getIdentificationGroup() + ->getProteinMatchList() + .at(row); + if(col == (std::int8_t)PtmIslandListColumn::checked) - { - if(p_protein_match->isChecked()) + { + if(p_protein_match->isChecked()) { p_protein_match->setChecked(false); } @@ -217,9 +221,9 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) { p_protein_match->setChecked(true); } - } + } else if((col == (std::int8_t)PtmIslandListColumn::accession) || - (col == (std::int8_t)PtmIslandListColumn::description)) + (col == (std::int8_t)PtmIslandListColumn::description)) { _p_ptm_island_list_window->askProteinDetailView(p_protein_match); } @@ -235,12 +239,16 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) qDebug() << "PtmIslandProxyModel::onTableClicked end " << index.row(); } -bool PtmIslandProxyModel::getPtmIslandListColumnDisplay (PtmIslandListColumn column ) const +bool +PtmIslandProxyModel::getPtmIslandListColumnDisplay( + PtmIslandListColumn column) const { return m_column_display[(std::int8_t)column]; } -void PtmIslandProxyModel::setPtmIslandListColumnDisplay (PtmIslandListColumn column, bool toggled ) +void +PtmIslandProxyModel::setPtmIslandListColumnDisplay(PtmIslandListColumn column, + bool toggled) { qDebug() << "begin " << toggled; beginResetModel(); @@ -253,9 +261,10 @@ void PtmIslandProxyModel::setPtmIslandListColumnDisplay (PtmIslandListColumn col endResetModel(); } -void PtmIslandProxyModel::hideNotChecked ( bool hide ) +void +PtmIslandProxyModel::hideNotChecked(bool hide) { - m_hideNotChecked = hide; + m_hideNotChecked = hide; } diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.h b/src/gui/ptm_island_list_view/ptmislandproxymodel.h index 2bcccaf5..1d8acdce 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.h +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.h @@ -28,8 +28,7 @@ *implementation ******************************************************************************/ -#ifndef PTMISLANDPROXYMODEL_H -#define PTMISLANDPROXYMODEL_H +#pragma once #include <QAbstractTableModel> #include <QSortFilterProxyModel> @@ -54,11 +53,9 @@ class PtmIslandProxyModel : public QSortFilterProxyModel void setSearchOn(QString search_on); void hideNotChecked(bool hide); void setPtmSearchString(QString ptm_search_string); - void setPtmIslandListColumnDisplay(PtmIslandListColumn column, - bool toggled); - bool - getPtmIslandListColumnDisplay(PtmIslandListColumn column) const; - + void setPtmIslandListColumnDisplay(PtmIslandListColumn column, bool toggled); + bool getPtmIslandListColumnDisplay(PtmIslandListColumn column) const; + public slots: void onTableClicked(const QModelIndex &index); @@ -70,5 +67,3 @@ class PtmIslandProxyModel : public QSortFilterProxyModel QString _search_on; QString _ptm_search_string; }; - -#endif // PTMISLANDPROXYMODEL_H diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp index 498d11d9..ef47c324 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp @@ -57,9 +57,10 @@ PtmIslandTableModel::getDescription(PtmIslandListColumn column) // qDebug() << "ProteinTableModel::columnCount end "; } -PtmIslandListColumn PtmIslandTableModel::getPtmIslandListColumn ( std::int8_t column ) +PtmIslandListColumn +PtmIslandTableModel::getPtmIslandListColumn(std::int8_t column) { - return static_cast<PtmIslandListColumn>(column); + return static_cast<PtmIslandListColumn>(column); } const QString @@ -160,7 +161,8 @@ PtmIslandTableModel::setIdentificationGroup( this->_p_ptm_island_list_window->resizeColumnsToContents(); } -IdentificationGroup * PtmIslandTableModel::getIdentificationGroup() +IdentificationGroup * +PtmIslandTableModel::getIdentificationGroup() { return _p_identification_group; } @@ -229,7 +231,8 @@ PtmIslandTableModel::data(const QModelIndex &index, int role) const switch(role) { case Qt::CheckStateRole: - if(col == (std::int8_t)PtmIslandListColumn::checked) // add a checkbox to cell(1,0) + if(col == (std::int8_t) + PtmIslandListColumn::checked) // add a checkbox to cell(1,0) { if(_p_identification_group->getProteinMatchList() .at(row) diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.h b/src/gui/ptm_island_list_view/ptmislandtablemodel.h index dd38a98a..fe9648fc 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.h +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.h @@ -42,16 +42,16 @@ enum class PtmIslandListColumn : std::int8_t { - checked = 0, ///< checked ptm - ptm_island_id = 1, ///< ptm_island_id - accession = 2, ///< protein accession - description = 3, ///< protein description - ptm_position_list = 4, ///< ptm position list - spectrum = 5, ///< count sample scans - ptm_spectrum = 6, ///< count scan with ptm - sequence = 7, ///< unique sequence count - multiptm = 8, ///< count multi ptm peptide match - ptm_island_start = 9, ///< start position of the ptm island on the protein + checked = 0, ///< checked ptm + ptm_island_id = 1, ///< ptm_island_id + accession = 2, ///< protein accession + description = 3, ///< protein description + ptm_position_list = 4, ///< ptm position list + spectrum = 5, ///< count sample scans + ptm_spectrum = 6, ///< count scan with ptm + sequence = 7, ///< unique sequence count + multiptm = 8, ///< count multi ptm peptide match + ptm_island_start = 9, ///< start position of the ptm island on the protein ptm_island_length = 10, ///< length of the ptm island last = 11, @@ -68,8 +68,8 @@ class PtmIslandTableModel : public QAbstractTableModel ~PtmIslandTableModel(); void setIdentificationGroup(IdentificationGroup *p_identification_group); - IdentificationGroup * getIdentificationGroup(); - + IdentificationGroup *getIdentificationGroup(); + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; virtual int @@ -81,9 +81,8 @@ class PtmIslandTableModel : public QAbstractTableModel static const QString getTitle(PtmIslandListColumn column); static const QString getDescription(PtmIslandListColumn column); - static PtmIslandListColumn - getPtmIslandListColumn(std::int8_t column); - + static PtmIslandListColumn getPtmIslandListColumn(std::int8_t column); + const PtmGroupingExperiment *getPtmGroupingExperiment() const; public slots: -- GitLab From dec86f8acdbedf3a5d8e5aa9ad19f37acdf2f1d7 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 10:39:57 +0100 Subject: [PATCH 11/18] add msrun to xic export --- src/gui/xic_view/xic_box/xicbox.cpp | 6 ++++++ src/gui/xic_view/xic_box/xicbox.h | 1 + src/output/ods/xicareasheet.cpp | 4 ++-- src/resources/icons/apache/firefox/check_icon.svg | 9 +++++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gui/xic_view/xic_box/xicbox.cpp b/src/gui/xic_view/xic_box/xicbox.cpp index 1ed5dec4..5533d0e0 100644 --- a/src/gui/xic_view/xic_box/xicbox.cpp +++ b/src/gui/xic_view/xic_box/xicbox.cpp @@ -337,6 +337,12 @@ XicBox::setPeptideEvidenceInMsRun(const PeptideEvidence *p_peptide_evidence, ui->isotopic_distribution_spinbox->value()); } +MsRunSp +XicBox::getMsRunSp() +{ + return _msrun_sp; +} + void XicBox::setXic(std::vector<pappso::XicCstSPtr> xic_sp_list) { diff --git a/src/gui/xic_view/xic_box/xicbox.h b/src/gui/xic_view/xic_box/xicbox.h index 2eff49b8..56fe9318 100644 --- a/src/gui/xic_view/xic_box/xicbox.h +++ b/src/gui/xic_view/xic_box/xicbox.h @@ -69,6 +69,7 @@ class XicBox : public QWidget void setPeptideEvidenceInMsRun(const PeptideEvidence *p_peptide_evidence, MsRunSp msrun_sp); std::vector<XicBoxNaturalIsotope> getNaturalIsotopList() const; + MsRunSp getMsRunSp(); signals: void loadXic(MsRunSp p_msrun, diff --git a/src/output/ods/xicareasheet.cpp b/src/output/ods/xicareasheet.cpp index 1e790aad..fdf87642 100644 --- a/src/output/ods/xicareasheet.cpp +++ b/src/output/ods/xicareasheet.cpp @@ -103,7 +103,7 @@ XicAreaSheet::writeAreaPeackdata(XicBox *xic_box) for(pappso::TracePeakCstSPtr trace : isotope.detected_peak_list) { mp_writer->writeLine(); - mp_writer->writeCell(""); + mp_writer->writeCell(xic_box->getMsRunSp()->getFileName()); mp_writer->writeCell(trace->getArea()); mp_writer->writeCell(trace->getLeftBoundary().x); mp_writer->writeCell(trace->getMaxXicElement().x); @@ -122,7 +122,7 @@ XicAreaSheet::writeXicAllData(XicBox *xic_box) for(std::size_t i = 0; i < isotope.xic_sp->xValues().size(); i++) { mp_writer->writeLine(); - mp_writer->writeCell(""); + mp_writer->writeCell(xic_box->getMsRunSp()->getFileName()); mp_writer->writeCell( int(isotope.peptide_natural_isotope_sp->getIsotopeNumber())); mp_writer->writeCell(isotope.xic_sp->xValues().at(i)); diff --git a/src/resources/icons/apache/firefox/check_icon.svg b/src/resources/icons/apache/firefox/check_icon.svg index 29832431..4ab81080 100644 --- a/src/resources/icons/apache/firefox/check_icon.svg +++ b/src/resources/icons/apache/firefox/check_icon.svg @@ -1,2 +1,7 @@ - -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path fill="#60bc03" d="M484.065 66.324l-71.534-41.759c-8.811-5.143-20.123-2.17-25.266 6.641L211.883 331.642L96.414 264.236c-7.143-4.17-16.314-1.76-20.484 5.384l-45.284 77.573c-4.17 7.143-1.76 16.314 5.384 20.484l205.968 120.235c7.143 4.17 16.314 1.76 20.484-5.384l1.669-2.86c.034-.056.074-.106.107-.163L490.706 91.59c5.143-8.811 2.17-20.123-6.641-25.266z"/><rect x="0" y="0" width="512" height="512" fill="rgba(0, 0, 0, 0)" /></svg> +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"> + <path fill="#60bc03" d="M484.065 66.324l-71.534-41.759c-8.811-5.143-20.123-2.17-25.266 6.641L211.883 331.642L96.414 264.236c-7.143-4.17-16.314-1.76-20.484 5.384l-45.284 77.573c-4.17 7.143-1.76 16.314 5.384 20.484l205.968 120.235c7.143 4.17 16.314 1.76 20.484-5.384l1.669-2.86c.034-.056.074-.106.107-.163L490.706 91.59c5.143-8.811 2.17-20.123-6.641-25.266z"/> + <rect x="0" y="0" width="512" height="512" fill="rgba(0, 0, 0, 0)" /> +</svg> -- GitLab From f8582d20222acbde5762325f29172332cf8effc5 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 11:58:18 +0100 Subject: [PATCH 12/18] Correct wrong index protein details from PTM island --- src/grouping/ptm/ptmgroupingexperiment.cpp | 2 +- src/grouping/ptm/ptmgroupingexperiment.h | 2 +- src/grouping/ptm/ptmisland.cpp | 6 +++--- src/grouping/ptm/ptmisland.h | 6 +++--- .../ptm_island_list_view/ptmislandlistwindow.cpp | 14 +++++++++----- .../ptm_island_list_view/ptmislandproxymodel.cpp | 7 ++++--- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/grouping/ptm/ptmgroupingexperiment.cpp b/src/grouping/ptm/ptmgroupingexperiment.cpp index 827a8d57..2e25dcf0 100644 --- a/src/grouping/ptm/ptmgroupingexperiment.cpp +++ b/src/grouping/ptm/ptmgroupingexperiment.cpp @@ -152,7 +152,7 @@ PtmGroupingExperiment::setValidationState(ValidationState validation_state) _peptide_validation_state = validation_state; } void -PtmGroupingExperiment::addProteinMatch(const ProteinMatch *p_protein_match) +PtmGroupingExperiment::addProteinMatch(ProteinMatch *p_protein_match) { if(p_protein_match->getValidationState() >= _peptide_validation_state) { diff --git a/src/grouping/ptm/ptmgroupingexperiment.h b/src/grouping/ptm/ptmgroupingexperiment.h index bf1cdfae..7ceaeb83 100644 --- a/src/grouping/ptm/ptmgroupingexperiment.h +++ b/src/grouping/ptm/ptmgroupingexperiment.h @@ -50,7 +50,7 @@ class PtmGroupingExperiment * experiment */ void setValidationState(ValidationState validation_state); - void addProteinMatch(const ProteinMatch *p_protein_match); + void addProteinMatch(ProteinMatch *p_protein_match); void startGrouping(); /** @brief get the ptm island subgroup list diff --git a/src/grouping/ptm/ptmisland.cpp b/src/grouping/ptm/ptmisland.cpp index 25568a90..6f7bfc41 100644 --- a/src/grouping/ptm/ptmisland.cpp +++ b/src/grouping/ptm/ptmisland.cpp @@ -36,7 +36,7 @@ #include <pappsomspp/utils.h> #include <set> -PtmIsland::PtmIsland(const ProteinMatch *p_protein_match, unsigned int position) +PtmIsland::PtmIsland(ProteinMatch *p_protein_match, unsigned int position) : _protein_match_p(p_protein_match) { _position_list.push_back(position); @@ -142,8 +142,8 @@ PtmIsland::setProteinNumber(unsigned int prot_number) { _prot_number = prot_number; } -const ProteinMatch * -PtmIsland::getProteinMatch() const +ProteinMatch * +PtmIsland::getProteinMatch() { return _protein_match_p; } diff --git a/src/grouping/ptm/ptmisland.h b/src/grouping/ptm/ptmisland.h index e02d24fa..02700617 100644 --- a/src/grouping/ptm/ptmisland.h +++ b/src/grouping/ptm/ptmisland.h @@ -48,7 +48,7 @@ typedef std::shared_ptr<PtmIsland> PtmIslandSp; class PtmIsland { public: - PtmIsland(const ProteinMatch *p_protein_match, unsigned int position); + PtmIsland(ProteinMatch *p_protein_match, unsigned int position); PtmIsland(const PtmIsland &other); ~PtmIsland(); void addPeptideMatch(const PeptideMatch &peptide_match); @@ -60,7 +60,7 @@ class PtmIsland bool containsPeptideMatch(const PeptideMatch &element) const; std::vector<std::size_t> getSampleScanSet() const; - const ProteinMatch *getProteinMatch() const; + ProteinMatch *getProteinMatch(); unsigned int getProteinStartPosition() const; void setPtmIslandSubgroup(PtmIslandSubgroup *p_ptm_island_subgroup); void setProteinNumber(unsigned int prot_number); @@ -82,7 +82,7 @@ class PtmIsland const std::vector<PeptideMatch> &getPeptideMatchList() const; private: - const ProteinMatch *_protein_match_p; + ProteinMatch *_protein_match_p; std::vector<PeptideMatch> _peptide_match_list; // std::vector<std::size_t> _sample_scan_set; std::vector<unsigned int> _position_list; diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp index 8d1b86fa..2514d5cf 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp @@ -186,15 +186,19 @@ PtmIslandListWindow::getPtmIslandListColumnDisplay( void PtmIslandListWindow::setColumnMenuList() { - PtmIslandListQActionColumn *p_action; - for(int i = 0; i < _ptm_table_model_p->columnCount(); i++) + if(ui->menu_Columns->isEmpty()) { - p_action = new PtmIslandListQActionColumn( - this, PtmIslandTableModel::getPtmIslandListColumn(i)); - ui->menu_Columns->addAction(p_action); + PtmIslandListQActionColumn *p_action; + for(int i = 0; i < _ptm_table_model_p->columnCount(); i++) + { + p_action = new PtmIslandListQActionColumn( + this, PtmIslandTableModel::getPtmIslandListColumn(i)); + ui->menu_Columns->addAction(p_action); + } } } + void PtmIslandListWindow::doNotCheckedHide(bool hide) { diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp index 024cb563..bd90592f 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp @@ -207,9 +207,10 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) int col = source_index.column(); ProteinMatch *p_protein_match = - _p_ptm_island_table_model->getIdentificationGroup() - ->getProteinMatchList() - .at(row); + _p_ptm_island_table_model->getPtmGroupingExperiment() + ->getPtmIslandList() + .at(row) + ->getProteinMatch(); if(col == (std::int8_t)PtmIslandListColumn::checked) { -- GitLab From 99c148fd1302cee451bc86128e6d45a21bb57ac2 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 14:16:35 +0100 Subject: [PATCH 13/18] Use same object for Protein checked in PTM and Protein windows --- .../ptmislandlistwindow.cpp | 4 ++ .../ptmislandlistwindow.h | 3 +- .../ptmislandproxymodel.cpp | 6 +- .../ptmislandtablemodel.cpp | 4 +- src/output/masschroqml.cpp | 72 ++++++++++--------- 5 files changed, 46 insertions(+), 43 deletions(-) diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp index 2514d5cf..63f1c128 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp @@ -198,6 +198,10 @@ PtmIslandListWindow::setColumnMenuList() } } +void PtmIslandListWindow::edited() +{ + _project_window->doIdentificationGroupEdited(_p_identification_group); +} void PtmIslandListWindow::doNotCheckedHide(bool hide) diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.h b/src/gui/ptm_island_list_view/ptmislandlistwindow.h index a4cfea46..6130ba50 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.h +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.h @@ -79,7 +79,8 @@ class PtmIslandListWindow : public QMainWindow void setPtmIslandListColumnDisplay(PtmIslandListColumn column, bool toggled); bool getPtmIslandListColumnDisplay(PtmIslandListColumn column) const; void setColumnMenuList(); - + void edited(); + public slots: void doIdentificationPtmGroupGrouped(IdentificationGroup *p_identification_group); diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp index bd90592f..a67a3d0c 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp @@ -83,10 +83,7 @@ PtmIslandProxyModel::filterAcceptsRow(int source_row, _p_ptm_island_table_model->getPtmGroupingExperiment() ->getPtmIslandList() .at(source_row); - ProteinMatch *protein_match = - _p_ptm_island_table_model->getIdentificationGroup() - ->getProteinMatchList() - .at(source_row); + ProteinMatch *protein_match = sp_ptm_island->getProteinMatch(); // qDebug() << "Prote // qDebug() << "ProteinTableProxyModel::filterAcceptsRow protein_match " // << source_row; @@ -222,6 +219,7 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) { p_protein_match->setChecked(true); } + _p_ptm_island_list_window->edited(); } else if((col == (std::int8_t)PtmIslandListColumn::accession) || (col == (std::int8_t)PtmIslandListColumn::description)) diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp index ef47c324..1af9875f 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp @@ -234,9 +234,7 @@ PtmIslandTableModel::data(const QModelIndex &index, int role) const if(col == (std::int8_t) PtmIslandListColumn::checked) // add a checkbox to cell(1,0) { - if(_p_identification_group->getProteinMatchList() - .at(row) - ->isChecked()) + if(getPtmGroupingExperiment()->getPtmIslandList().at(row)->getProteinMatch()->isChecked()) { return Qt::Checked; } diff --git a/src/output/masschroqml.cpp b/src/output/masschroqml.cpp index 3b6fcb9d..10dd89fe 100644 --- a/src/output/masschroqml.cpp +++ b/src/output/masschroqml.cpp @@ -263,47 +263,49 @@ MassChroQml::writeQuantificationTraces() void MassChroQml::writeQuantify() { - for(MsRunAlignmentGroupSp group_sp : m_params.alignment_groups) + for(MsRunAlignmentGroupSp group_sp : m_params.alignment_groups) { - //<quantify id="q1" withingroup="G1" quantification_method_id="my_qzivy"> - _output_stream->writeStartElement("quantify"); - _output_stream->writeAttribute("id", "q1"); - - _output_stream->writeAttribute("withingroup", group_sp->getMsRunAlignmentGroupName()); - _output_stream->writeAttribute("quantification_method_id", "quant1"); - //<peptides_in_peptide_list mode="real_or_mean" /> - //</quantify> - //<quantify id="q2" withingroup="G2" quantification_method_id="my_moulon"> - //<peptides_in_peptide_list mode="post_matching" - // isotope_label_refs="iso1 iso2" /> - - _output_stream->writeStartElement("peptides_in_peptide_list"); - _output_stream->writeAttribute("mode", "post_matching"); - _output_stream->writeAttribute("ni_min_abundance", "0.8"); + //<quantify id="q1" withingroup="G1" quantification_method_id="my_qzivy"> + _output_stream->writeStartElement("quantify"); + _output_stream->writeAttribute("id", "q1"); - LabelingMethod *p_labeling_method = - _sp_project.get()->getLabelingMethodSp().get(); - if(p_labeling_method != nullptr) - { - QStringList isotope_label_ref; - for(const Label *p_label : p_labeling_method->getLabelList()) + _output_stream->writeAttribute("withingroup", + group_sp->getMsRunAlignmentGroupName()); + _output_stream->writeAttribute("quantification_method_id", "quant1"); + //<peptides_in_peptide_list mode="real_or_mean" /> + //</quantify> + //<quantify id="q2" withingroup="G2" quantification_method_id="my_moulon"> + //<peptides_in_peptide_list mode="post_matching" + // isotope_label_refs="iso1 iso2" /> + + _output_stream->writeStartElement("peptides_in_peptide_list"); + _output_stream->writeAttribute("mode", "post_matching"); + _output_stream->writeAttribute("ni_min_abundance", "0.8"); + + LabelingMethod *p_labeling_method = + _sp_project.get()->getLabelingMethodSp().get(); + if(p_labeling_method != nullptr) { - isotope_label_ref << p_label->getXmlId(); + QStringList isotope_label_ref; + for(const Label *p_label : p_labeling_method->getLabelList()) + { + isotope_label_ref << p_label->getXmlId(); + } + _output_stream->writeAttribute("isotope_label_refs", + isotope_label_ref.join(" ")); } - _output_stream->writeAttribute("isotope_label_refs", - isotope_label_ref.join(" ")); - } - _output_stream->writeEndElement(); + _output_stream->writeEndElement(); - _output_stream->writeComment( - "<mz_list>732.317 449.754 552.234 464.251 " - "381.577 569.771 575.256</mz_list>"); - _output_stream->writeComment( - "<mzrt_list>\n <mzrt mz=\"732.317\" rt=\"230.712\" />\n <mzrt " - "mz=\"575.256\" rt=\"254.788\" />\n </mzrt_list>"); + _output_stream->writeComment( + "<mz_list>732.317 449.754 552.234 464.251 " + "381.577 569.771 575.256</mz_list>"); + _output_stream->writeComment( + "<mzrt_list>\n <mzrt mz=\"732.317\" rt=\"230.712\" />\n " + "<mzrt " + "mz=\"575.256\" rt=\"254.788\" />\n </mzrt_list>"); - //</quantify> - _output_stream->writeEndElement(); + //</quantify> + _output_stream->writeEndElement(); } } -- GitLab From d043d22b72d6dbb3aa48d966a01ffc8e51b46bd4 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 14:39:00 +0100 Subject: [PATCH 14/18] Add Xic export settings --- src/gui/edit/edit_settings/edit_settings.ui | 34 +++++++++++++++++++-- src/gui/edit/edit_settings/editsettings.cpp | 22 +++++++++++++ src/gui/workerthread.cpp | 21 +++++++++++-- src/output/ods/xicareasheet.cpp | 6 ++-- 4 files changed, 76 insertions(+), 7 deletions(-) diff --git a/src/gui/edit/edit_settings/edit_settings.ui b/src/gui/edit/edit_settings/edit_settings.ui index d28c7a50..397e318a 100644 --- a/src/gui/edit/edit_settings/edit_settings.ui +++ b/src/gui/edit/edit_settings/edit_settings.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>366</width> - <height>348</height> + <width>422</width> + <height>395</height> </rect> </property> <property name="windowTitle"> @@ -61,6 +61,36 @@ </item> </layout> </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>XIC export</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QRadioButton" name="radioButton_3"> + <property name="text"> + <string>Area onl&y</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="all_point_radioButton"> + <property name="text"> + <string>All points only</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="area_radioButton"> + <property name="text"> + <string>Area + All points</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> <item> <widget class="QGroupBox" name="timstof_setting_group"> <property name="title"> diff --git a/src/gui/edit/edit_settings/editsettings.cpp b/src/gui/edit/edit_settings/editsettings.cpp index b1e42c80..7b013f9f 100644 --- a/src/gui/edit/edit_settings/editsettings.cpp +++ b/src/gui/edit/edit_settings/editsettings.cpp @@ -53,6 +53,17 @@ EditSettings::EditSettings(MainWindow *parent) { ui->xic_reader_buffered_button->setChecked(false); } + QString xic_export_type = + settings.value("export/xic_files", "area").toString(); + ui->area_radioButton->setChecked(true); + if(xic_export_type == "all") + { + ui->all_point_radioButton->setChecked(true); + } + else if(xic_export_type == "both") + { + ui->radioButton_3->setChecked(true); + } QString tandemwrapper_path = settings.value("timstof/tandemwrapper_path", "").toString(); @@ -96,6 +107,17 @@ EditSettings::done(int r) } settings.setValue("global/xic_extractor", xic_extraction_method); + QString xic_export_type = "area"; + if(ui->all_point_radioButton->isChecked()) + { + xic_export_type = "all"; + } + else if(ui->radioButton_3->isChecked()) + { + xic_export_type = "both"; + } + settings.setValue("export/xic_files", xic_export_type); + QString tandemwrapper_path = ui->tandemwrapper_path_line->text(); QFileInfo tandemwrapper_file = QFileInfo(tandemwrapper_path); if(tandemwrapper_file.exists() && tandemwrapper_file.isExecutable()) diff --git a/src/gui/workerthread.cpp b/src/gui/workerthread.cpp index 58eaa0d7..2892484a 100644 --- a/src/gui/workerthread.cpp +++ b/src/gui/workerthread.cpp @@ -879,10 +879,25 @@ WorkerThread::doWriteXicAreaInCsv(QString filename, CalcWriterInterface *p_writer = nullptr; emit loadingMessage(tr("writing TSV files, please wait")); + QSettings settings; + QString xic_export_file = + settings.value("export/xic_files", "area").toString(); p_writer = new TsvDirectoryWriter(filename); - XicAreaSheet(p_writer, xic_boxs); - bool all_data = true; - XicAreaSheet(p_writer, xic_boxs, all_data); + if(xic_export_file == "both") + { + XicAreaSheet(p_writer, xic_boxs); + bool all_data = true; + XicAreaSheet(p_writer, xic_boxs, all_data); + } + else if(xic_export_file == "all") + { + bool all_data = true; + XicAreaSheet(p_writer, xic_boxs, all_data); + } + else // xic_export_file == "area" + { + XicAreaSheet(p_writer, xic_boxs); + } p_writer->close(); emit exportXicToCsvFinished(); } diff --git a/src/output/ods/xicareasheet.cpp b/src/output/ods/xicareasheet.cpp index fdf87642..c61699b7 100644 --- a/src/output/ods/xicareasheet.cpp +++ b/src/output/ods/xicareasheet.cpp @@ -103,7 +103,8 @@ XicAreaSheet::writeAreaPeackdata(XicBox *xic_box) for(pappso::TracePeakCstSPtr trace : isotope.detected_peak_list) { mp_writer->writeLine(); - mp_writer->writeCell(xic_box->getMsRunSp()->getFileName()); + mp_writer->writeCell( + QFileInfo(xic_box->getMsRunSp()->getFileName()).fileName()); mp_writer->writeCell(trace->getArea()); mp_writer->writeCell(trace->getLeftBoundary().x); mp_writer->writeCell(trace->getMaxXicElement().x); @@ -122,7 +123,8 @@ XicAreaSheet::writeXicAllData(XicBox *xic_box) for(std::size_t i = 0; i < isotope.xic_sp->xValues().size(); i++) { mp_writer->writeLine(); - mp_writer->writeCell(xic_box->getMsRunSp()->getFileName()); + mp_writer->writeCell( + QFileInfo(xic_box->getMsRunSp()->getFileName()).fileName()); mp_writer->writeCell( int(isotope.peptide_natural_isotope_sp->getIsotopeNumber())); mp_writer->writeCell(isotope.xic_sp->xValues().at(i)); -- GitLab From eed8eb06bcab91d8e6f69ce200c19291b6cb1308 Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 16:35:11 +0100 Subject: [PATCH 15/18] Export only cheched ptm island --- src/grouping/ptm/ptmisland.cpp | 10 ++++++++++ src/grouping/ptm/ptmisland.h | 3 +++ .../ptm_island_list_view/ptmislandlistwindow.cpp | 2 +- .../ptm_island_list_view/ptmislandproxymodel.cpp | 16 +++++++--------- .../ptm_island_list_view/ptmislandproxymodel.h | 2 +- .../ptm_island_list_view/ptmislandtablemodel.cpp | 2 +- src/output/ods/ptm/ptmislandsheet.cpp | 5 ++++- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/grouping/ptm/ptmisland.cpp b/src/grouping/ptm/ptmisland.cpp index 6f7bfc41..cfd53b1b 100644 --- a/src/grouping/ptm/ptmisland.cpp +++ b/src/grouping/ptm/ptmisland.cpp @@ -62,6 +62,16 @@ PtmIsland::size() const return _protein_stop - _protein_start; } +bool PtmIsland::isChecked() +{ + return m_checked; +} + +void PtmIsland::setChecked(bool check_status) +{ + m_checked = check_status; +} + unsigned int PtmIsland::countSampleScanMultiPtm( const PtmGroupingExperiment *p_ptm_grouping_experiment) const diff --git a/src/grouping/ptm/ptmisland.h b/src/grouping/ptm/ptmisland.h index 02700617..a865d840 100644 --- a/src/grouping/ptm/ptmisland.h +++ b/src/grouping/ptm/ptmisland.h @@ -76,6 +76,8 @@ class PtmIsland const PtmGroupingExperiment *p_ptm_grouping_experiment) const; unsigned int getStart() const; unsigned int size() const; + void setChecked(bool check_status); + bool isChecked(); std::vector<PtmSampleScanSp> getPtmSampleScanSpList() const; @@ -91,6 +93,7 @@ class PtmIsland /** @brief protein rank number in the PTM subgroup * */ unsigned int _prot_number = 0; + bool m_checked = true; PtmIslandSubgroup *_ptm_island_subgroup_p = nullptr; }; diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp index 63f1c128..caf4eb99 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp @@ -200,7 +200,7 @@ PtmIslandListWindow::setColumnMenuList() void PtmIslandListWindow::edited() { - _project_window->doIdentificationGroupEdited(_p_identification_group); + _project_window->doPtmIslandGrouping(_p_identification_group); } void diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp index a67a3d0c..252fad46 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp @@ -83,13 +83,12 @@ PtmIslandProxyModel::filterAcceptsRow(int source_row, _p_ptm_island_table_model->getPtmGroupingExperiment() ->getPtmIslandList() .at(source_row); - ProteinMatch *protein_match = sp_ptm_island->getProteinMatch(); // qDebug() << "Prote // qDebug() << "ProteinTableProxyModel::filterAcceptsRow protein_match " // << source_row; if(m_hideNotChecked) { - if(!protein_match->isChecked()) + if(!sp_ptm_island->isChecked()) { return false; } @@ -203,27 +202,26 @@ PtmIslandProxyModel::onTableClicked(const QModelIndex &index) int row = source_index.row(); int col = source_index.column(); - ProteinMatch *p_protein_match = - _p_ptm_island_table_model->getPtmGroupingExperiment() + PtmIslandSp ptm_island_sp = _p_ptm_island_table_model->getPtmGroupingExperiment() ->getPtmIslandList() - .at(row) - ->getProteinMatch(); + .at(row); if(col == (std::int8_t)PtmIslandListColumn::checked) { - if(p_protein_match->isChecked()) + if(ptm_island_sp->isChecked()) { - p_protein_match->setChecked(false); + ptm_island_sp->setChecked(false); } else { - p_protein_match->setChecked(true); + ptm_island_sp->setChecked(true); } _p_ptm_island_list_window->edited(); } else if((col == (std::int8_t)PtmIslandListColumn::accession) || (col == (std::int8_t)PtmIslandListColumn::description)) { + ProteinMatch *p_protein_match = ptm_island_sp->getProteinMatch(); _p_ptm_island_list_window->askProteinDetailView(p_protein_match); } else diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.h b/src/gui/ptm_island_list_view/ptmislandproxymodel.h index 1d8acdce..0f6b02d1 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.h +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.h @@ -63,7 +63,7 @@ class PtmIslandProxyModel : public QSortFilterProxyModel PtmIslandListWindow *_p_ptm_island_list_window; PtmIslandTableModel *_p_ptm_island_table_model; std::vector<bool> m_column_display; - bool m_hideNotChecked = true; + bool m_hideNotChecked = false; QString _search_on; QString _ptm_search_string; }; diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp index 1af9875f..45dc6ce3 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp @@ -234,7 +234,7 @@ PtmIslandTableModel::data(const QModelIndex &index, int role) const if(col == (std::int8_t) PtmIslandListColumn::checked) // add a checkbox to cell(1,0) { - if(getPtmGroupingExperiment()->getPtmIslandList().at(row)->getProteinMatch()->isChecked()) + if(getPtmGroupingExperiment()->getPtmIslandList().at(row)->isChecked()) { return Qt::Checked; } diff --git a/src/output/ods/ptm/ptmislandsheet.cpp b/src/output/ods/ptm/ptmislandsheet.cpp index 15c6f86b..97d18c85 100644 --- a/src/output/ods/ptm/ptmislandsheet.cpp +++ b/src/output/ods/ptm/ptmislandsheet.cpp @@ -142,7 +142,10 @@ PtmIslandSheet::writeIdentificationGroup(IdentificationGroup *p_ident) for(auto ptm_island_sp : _p_ptm_grouping_experiment->getPtmIslandList()) { qDebug(); - ptm_island_list.push_back(ptm_island_sp); + if(ptm_island_sp->isChecked()) + { + ptm_island_list.push_back(ptm_island_sp); + } } qDebug(); std::sort(ptm_island_list.begin(), -- GitLab From 05e670eea19dac2cb72100767942d3e43c1dc40a Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Wed, 28 Oct 2020 16:39:10 +0100 Subject: [PATCH 16/18] Export PTm spectra of checked ptm island --- src/grouping/ptm/ptmisland.cpp | 2 +- src/grouping/ptm/ptmisland.h | 2 +- src/output/ods/ptm/ptmspectrasheet.cpp | 72 +++++++++++++++----------- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/grouping/ptm/ptmisland.cpp b/src/grouping/ptm/ptmisland.cpp index cfd53b1b..10b5c86a 100644 --- a/src/grouping/ptm/ptmisland.cpp +++ b/src/grouping/ptm/ptmisland.cpp @@ -62,7 +62,7 @@ PtmIsland::size() const return _protein_stop - _protein_start; } -bool PtmIsland::isChecked() +bool PtmIsland::isChecked() const { return m_checked; } diff --git a/src/grouping/ptm/ptmisland.h b/src/grouping/ptm/ptmisland.h index a865d840..9dc609af 100644 --- a/src/grouping/ptm/ptmisland.h +++ b/src/grouping/ptm/ptmisland.h @@ -77,7 +77,7 @@ class PtmIsland unsigned int getStart() const; unsigned int size() const; void setChecked(bool check_status); - bool isChecked(); + bool isChecked() const; std::vector<PtmSampleScanSp> getPtmSampleScanSpList() const; diff --git a/src/output/ods/ptm/ptmspectrasheet.cpp b/src/output/ods/ptm/ptmspectrasheet.cpp index 21e2523a..b79114dd 100644 --- a/src/output/ods/ptm/ptmspectrasheet.cpp +++ b/src/output/ods/ptm/ptmspectrasheet.cpp @@ -237,7 +237,10 @@ PtmSpectraSheet::writeBestPeptideEvidence( // return _ptm_sample_scan_list.at(row).get()->getObservedPtmPositionList(); for(const PtmIsland *ptm_island : ptmisland_occurence_list) { - position_list << ptm_island->getGroupingId(); + if(ptm_island->isChecked()) + { + position_list << ptm_island->getGroupingId(); + } } _p_writer->writeCell(position_list.join(" ")); @@ -286,41 +289,48 @@ PtmSpectraSheet::writePtmIslandSubgroupSp( for(PtmIslandSp ptm_island_sp : ptm_island_subgroup_sp.get()->getPtmIslandList()) { - - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; - for(PeptideMatch peptide_match : - ptm_island_sp.get()->getPeptideMatchList()) + if(ptm_island_sp->isChecked()) { - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; - std::vector<PtmSampleScanOccurence>::iterator it_ptm = - ptm_sample_scan_occurence_list.begin(); - std::vector<PtmSampleScanOccurence>::iterator it_ptm_end = - ptm_sample_scan_occurence_list.end(); - while((it_ptm != it_ptm_end) && - (it_ptm->ptm_sample_scan.add(peptide_match) == false)) - { - // peptide added - it_ptm++; - } - if(it_ptm == it_ptm_end) + for(PeptideMatch peptide_match : + ptm_island_sp.get()->getPeptideMatchList()) { - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; - // peptide NOT added - PtmSampleScanOccurence new_occurence = { - PtmSampleScan(peptide_match), std::set<const PtmIsland *>()}; - new_occurence.ptmisland_occurence_list.insert( - ptm_island_sp.get()); - ptm_sample_scan_occurence_list.push_back(new_occurence); - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; - } - else - { - // peptide added - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; - it_ptm->ptmisland_occurence_list.insert(ptm_island_sp.get()); qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; + std::vector<PtmSampleScanOccurence>::iterator it_ptm = + ptm_sample_scan_occurence_list.begin(); + std::vector<PtmSampleScanOccurence>::iterator it_ptm_end = + ptm_sample_scan_occurence_list.end(); + while((it_ptm != it_ptm_end) && + (it_ptm->ptm_sample_scan.add(peptide_match) == false)) + { + // peptide added + it_ptm++; + } + if(it_ptm == it_ptm_end) + { + qDebug() << __FILE__ << " " << __FUNCTION__ << " " + << __LINE__; + // peptide NOT added + PtmSampleScanOccurence new_occurence = { + PtmSampleScan(peptide_match), + std::set<const PtmIsland *>()}; + new_occurence.ptmisland_occurence_list.insert( + ptm_island_sp.get()); + ptm_sample_scan_occurence_list.push_back(new_occurence); + qDebug() << __FILE__ << " " << __FUNCTION__ << " " + << __LINE__; + } + else + { + // peptide added + qDebug() << __FILE__ << " " << __FUNCTION__ << " " + << __LINE__; + it_ptm->ptmisland_occurence_list.insert(ptm_island_sp.get()); + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " + << __LINE__; + } } } } -- GitLab From f5c97f08061830c1d1426ff9305efc21e673795c Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Thu, 29 Oct 2020 12:02:56 +0100 Subject: [PATCH 17/18] Correct best msRun issues (clicked didn't work, reference didn't used in mcqml file) --- .../export_masschroq_dialog.ui | 23 ++++++-- .../exportmasschroqdialog.cpp | 53 +++++++++++-------- .../exportmasschroqdialog.h | 1 + .../masschroqfileparameters.h | 1 - 4 files changed, 51 insertions(+), 27 deletions(-) diff --git a/src/gui/export/export_masschroq_dialog/export_masschroq_dialog.ui b/src/gui/export/export_masschroq_dialog/export_masschroq_dialog.ui index 086b5333..b648eba5 100644 --- a/src/gui/export/export_masschroq_dialog/export_masschroq_dialog.ui +++ b/src/gui/export/export_masschroq_dialog/export_masschroq_dialog.ui @@ -120,7 +120,7 @@ <item> <widget class="QPushButton" name="pushButton"> <property name="text"> - <string>Best</string> + <string>Find Best</string> </property> </widget> </item> @@ -464,8 +464,8 @@ <slot>doBrowseMsrunDirectory()</slot> <hints> <hint type="sourcelabel"> - <x>195</x> - <y>381</y> + <x>214</x> + <y>421</y> </hint> <hint type="destinationlabel"> <x>736</x> @@ -473,6 +473,22 @@ </hint> </hints> </connection> + <connection> + <sender>msrun_list_combo_box</sender> + <signal>activated(int)</signal> + <receiver>ExportMasschroqDialog</receiver> + <slot>doUpdateReferenceInSelectedGroup(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>417</x> + <y>432</y> + </hint> + <hint type="destinationlabel"> + <x>817</x> + <y>444</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>reject()</slot> @@ -481,5 +497,6 @@ <slot>doBrowseMsrunDirectory()</slot> <slot>doFindBestMsrunForAlignment()</slot> <slot>doShowMsRunsInAlignmentGroup(QModelIndex)</slot> + <slot>doUpdateReferenceInSelectedGroup(int)</slot> </slots> </ui> diff --git a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp index 177f8f25..9458e97b 100644 --- a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp +++ b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp @@ -157,16 +157,6 @@ ExportMasschroqDialog::getMasschroqFileParameters() const params.xic_extraction_method = ui->xic_extraction_method_widget->getXicExtractionMethod(); - - int index = ui->msrun_list_combo_box->currentIndex(); - if(index != -1) - { - MsRunSp msrun_sp = - qvariant_cast<MsRunSp>(ui->msrun_list_combo_box->itemData(index)); - params.msrun_alignment_reference = msrun_sp; - } - - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " " << (int)params.xic_extraction_method; return params; @@ -278,17 +268,17 @@ ExportMasschroqDialog::setBestMsrunForAlignment(MsRunSp best_msrun_sp) mp_main->hideWaitingMessage(); if(best_msrun_sp != nullptr) { - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " " - << best_msrun_sp.get()->getXmlId(); + qDebug() << best_msrun_sp.get(); - for(int index = 0; index < ui->msrun_list_combo_box->count(); index++) + int index = 0; + for(MsRunSp ms_run : msp_selected_group->getMsRunsInAlignmentGroup()) { - MsRunSp msrun_sp = - qvariant_cast<MsRunSp>(ui->msrun_list_combo_box->itemData(index)); - if(msrun_sp.get() == best_msrun_sp.get()) + if(ms_run == best_msrun_sp) { ui->msrun_list_combo_box->setCurrentIndex(index); + msp_selected_group->setMsRunReference(best_msrun_sp); } + index++; } } } @@ -346,16 +336,33 @@ ExportMasschroqDialog::doShowMsRunsInAlignmentGroup(QModelIndex index) } if(msp_selected_group->getMsRunReference() != nullptr) { - std::list<MsRunSp>::iterator it; - it = std::find(msp_selected_group->getMsRunsInAlignmentGroup().begin(), - msp_selected_group->getMsRunsInAlignmentGroup().end(), - msp_selected_group->getMsRunReference()); - int idx = std::distance( - msp_selected_group->getMsRunsInAlignmentGroup().begin(), it); - ui->msrun_list_combo_box->setCurrentIndex(idx); + int index = 0; + for(MsRunSp ms_run : msp_selected_group->getMsRunsInAlignmentGroup()) + { + if(ms_run == msp_selected_group->getMsRunReference()) + { + ui->msrun_list_combo_box->setCurrentIndex(index); + } + index++; + } } else { ui->msrun_list_combo_box->setCurrentIndex(-1); } } + +void +ExportMasschroqDialog::doUpdateReferenceInSelectedGroup(int index) +{ + int temp_index = 0; + for(MsRunSp ms_run : msp_selected_group->getMsRunsInAlignmentGroup()) + { + if(temp_index == index) + { + msp_selected_group->setMsRunReference(ms_run); + } + temp_index++; + } + qDebug() << index; +} diff --git a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.h b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.h index 94f10f30..1c76f2a8 100644 --- a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.h +++ b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.h @@ -76,6 +76,7 @@ class ExportMasschroqDialog : public QDialog void doBrowseMsrunDirectory(); void doFindBestMsrunForAlignment(); void doShowMsRunsInAlignmentGroup(QModelIndex index); + void doUpdateReferenceInSelectedGroup(int index); private: Ui::ExportMasschroqDialog *ui; diff --git a/src/gui/export/export_masschroq_dialog/masschroqfileparameters.h b/src/gui/export/export_masschroq_dialog/masschroqfileparameters.h index 55b61563..9015506e 100644 --- a/src/gui/export/export_masschroq_dialog/masschroqfileparameters.h +++ b/src/gui/export/export_masschroq_dialog/masschroqfileparameters.h @@ -61,6 +61,5 @@ struct MasschroqFileParameters pappso::XicExtractMethod xic_extraction_method; // sum or max - MsRunSp msrun_alignment_reference; std::vector<MsRunAlignmentGroupSp> alignment_groups; }; -- GitLab From 490c6adaba7a2324b1ed6e57d63807b987dc7aab Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Mon, 2 Nov 2020 09:37:22 +0100 Subject: [PATCH 18/18] Correct TDF folder loading issue : Identification didn't work with the folder --- src/core/tandem_run/tandembatchprocess.cpp | 21 ++++++++++++++++--- src/gui/tandem_run_dialog/tandemrundialog.cpp | 10 +++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/core/tandem_run/tandembatchprocess.cpp b/src/core/tandem_run/tandembatchprocess.cpp index 7497799a..74abc820 100644 --- a/src/core/tandem_run/tandembatchprocess.cpp +++ b/src/core/tandem_run/tandembatchprocess.cpp @@ -263,7 +263,14 @@ TandemBatchProcess::writeXmlInputFile(QXmlStreamWriter *p_out, p_out->writeStartElement("note"); p_out->writeAttribute("type", "input"); p_out->writeAttribute("label", "spectrum, path"); - p_out->writeCharacters(mz_file); + if(mz_file_info.isDir()) + { + p_out->writeCharacters(mz_file + "/analysis.tdf"); + } + else + { + p_out->writeCharacters(mz_file); + } p_out->writeEndElement(); //<note type="heading">Protein general</note> @@ -292,8 +299,18 @@ TandemBatchProcess::writeXmlInputFile(QXmlStreamWriter *p_out, p_out->writeAttribute("label", "output, path"); if(mz_file_info.completeSuffix() == "tdf") { + QString output_name = QFileInfo(mz_file_info.absoluteDir().dirName()).baseName(); + qDebug() << output_name; + p_out->writeCharacters(QString("%1/%2.xml") + .arg(_tandem_run_batch._output_directory) + .arg(output_name)); + } + else if(mz_file_info.isDir()) + { + QString output_name = QFileInfo(mz_file_info).baseName(); + qDebug() << output_name; p_out->writeCharacters(QString("%1/%2.xml") .arg(_tandem_run_batch._output_directory) .arg(output_name)); @@ -316,8 +333,6 @@ TandemBatchProcess::writeXmlInputFile(QXmlStreamWriter *p_out, void TandemBatchProcess::runOne(const QString &mz_file) { - - QTemporaryFile xml_input_file; xml_input_file.setAutoRemove(true); if(xml_input_file.open()) diff --git a/src/gui/tandem_run_dialog/tandemrundialog.cpp b/src/gui/tandem_run_dialog/tandemrundialog.cpp index c4c2e32f..ee4d5c24 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.cpp +++ b/src/gui/tandem_run_dialog/tandemrundialog.cpp @@ -405,9 +405,10 @@ TandemRunDialog::selectTdfFolder() { QSettings settings; QString default_tdf_location = - settings.value("path/tandemrun_tdf_directory", "").toString(); + settings.value("path/tandemrun_tdf_directory", "/").toString(); QFileDialog directories_dialog; - directories_dialog.setOption(QFileDialog::ShowDirsOnly, true); + directories_dialog.setDirectory(default_tdf_location); + directories_dialog.setFileMode(QFileDialog::DirectoryOnly); directories_dialog.setOption(QFileDialog::DontUseNativeDialog, true); directories_dialog.setWindowTitle("Select the timsTOF folders"); QListView *lView = directories_dialog.findChild<QListView *>("listView"); @@ -424,13 +425,15 @@ TandemRunDialog::selectTdfFolder() directories_names = directories_dialog.selectedFiles(); } - if(directories_names.size() > 0) + if(directories_names.size() > 1) { settings.setValue("path/tandemrun_tdf_directory", QFileInfo(directories_names[0]).absolutePath()); + directories_names.pop_front(); } for(QString directory_name : directories_names) { + // qDebug() << directory_name+"/analysis.tdf"; if(!QFileInfo(directory_name + "/analysis.tdf").exists()) { throw pappso::PappsoException( @@ -444,7 +447,6 @@ TandemRunDialog::selectTdfFolder() QStringList file_list = _p_mz_file_list->stringList(); file_list.append(directories_names); _p_mz_file_list->setStringList(file_list); - } catch(pappso::PappsoException &error) { -- GitLab