Skip to content
Snippets Groups Projects
Commit ca5e27e1 authored by Olivier Langella's avatar Olivier Langella
Browse files

new dialog to choose psimod

parent 75033be9
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,7 @@ SET(CPP_FILES
utils/peptidestore.cpp
utils/proteinstore.cpp
utils/readspectrum.cpp
utils/utils.cpp
)
set(QTLIBS ${Qt5Xml_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES})
......@@ -86,6 +87,7 @@ set(QTLIBS ${Qt5Xml_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES})
# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
SET(XTPCPP_SRCS
./gui/choose_modification_dialog/choosemodificationdialog.cpp
./gui/edit_modifications/editmodifications.cpp
./gui/export_spreadsheet_dialog/exportspreadsheetdialog.cpp
./gui/load_results_dialog/loadresultsdialog.cpp
......@@ -106,6 +108,7 @@ SET(XTPCPP_SRCS
)
SET (GUI_UIS
./gui/choose_modification_dialog/choose_modification_dialog.ui
./gui/edit_modifications/edit_modifications.ui
./gui/export_spreadsheet_dialog/export_spreadsheet_dialog.ui
./gui/load_results_dialog/load_results_dialog.ui
......@@ -120,6 +123,7 @@ SET (GUI_UIS
)
SET(XTPCPP_MOC_HDRS
./gui/choose_modification_dialog/choosemodificationdialog.h
./gui/edit_modifications/editmodifications.h
./gui/export_spreadsheet_dialog/exportspreadsheetdialog.h
./gui/load_results_dialog/loadresultsdialog.h
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChooseModificationDialog</class>
<widget class="QWidget" name="ChooseModificationDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>573</width>
<height>559</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Available modifications</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QListView" name="modification_listview"/>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>ChooseModificationDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>522</x>
<y>415</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>279</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>ChooseModificationDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>436</x>
<y>415</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>279</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>reject()</slot>
<slot>accept()</slot>
<slot>doSimpleProteinPeptideList(bool)</slot>
</slots>
</ui>
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@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:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include "choosemodificationdialog.h"
#include "ui_choose_modification_dialog.h"
#include <QDebug>
#include <QDesktopServices>
#include "../../utils/utils.h"
ChooseModificationDialog::ChooseModificationDialog(QWidget * parent):
QDialog(parent),
ui(new Ui::ChooseModificationDialog)
{
qDebug() << "ChooseModificationDialog::ChooseModificationDialog begin";
ui->setupUi(this);
this->setModal(true);
_p_modification_str_li = new QStandardItemModel();
ui->modification_listview->setModel(_p_modification_str_li);
//param.setFilterCrossSamplePeptideNumber(settings.value("automatic_filter/cross_sample", "true").toBool());
#if QT_VERSION >= 0x050000
// Qt5 code
/*
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
connect(this, &PtSpectrumViewer::operateMsDataFile, worker, &PwizLoaderThread::doMsDataFileLoad);
connect(worker, &PwizLoaderThread::msDataReady, this, &PtSpectrumViewer::handleMsDataFile);
*/
#else
// Qt4 code
#endif
}
ChooseModificationDialog::~ChooseModificationDialog()
{
delete ui;
}
void ChooseModificationDialog::setMassRange(const pappso::MassRange & massrange) {
}
void ChooseModificationDialog::ItemDoubleClicked (QModelIndex index )
{
qDebug() << "ChooseModificationDialog::ItemClicked data=" << index.data().toString();
qDebug() << "ChooseModificationDialog::ItemClicked acc=" << _p_modification_str_li->data(index,Qt::UserRole).toString();
QDesktopServices::openUrl (Utils::getOlsUrl(_p_modification_str_li->data(index,Qt::UserRole).toString())) ;
}
void ChooseModificationDialog::ItemClicked (QModelIndex index )
{
qDebug() << "ChooseModificationDialog::ItemClicked data=" << index.data().toString();
qDebug() << "ChooseModificationDialog::ItemClicked acc=" << _p_modification_str_li->data(index,Qt::UserRole).toString();
qDebug() << "ChooseModificationDialog::ItemClicked str=" << _p_modification_str_li->data(index,Qt::DisplayRole).toString();
pappso::AaModificationP modification = pappso::AaModification::getInstance(index.data(Qt::UserRole).toString());
_selected_modification = modification;
}
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@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:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef CHOOSEMODIFICATIONDIALOG_H
#define CHOOSEMODIFICATIONDIALOG_H
#include <QDialog>
#include <QStandardItemModel>
#include <pappsomspp/mass_range.h>
#include <pappsomspp/amino_acid/aamodification.h>
namespace Ui {
class ChooseModificationDialog;
}
class ChooseModificationDialog : public QDialog
{
Q_OBJECT
public:
explicit ChooseModificationDialog(QWidget * parent);
~ChooseModificationDialog();
void setMassRange(const pappso::MassRange & massrange);
public slots:
void ItemClicked (QModelIndex index );
void ItemDoubleClicked (QModelIndex index );
private:
Ui::ChooseModificationDialog *ui;
QStandardItemModel * _p_modification_str_li=nullptr;
pappso::AaModificationP _selected_modification;
};
#endif // CHOOSEMODIFICATIONDIALOG_H
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>826</width>
<height>559</height>
<height>574</height>
</rect>
</property>
<property name="contextMenuPolicy">
......@@ -175,17 +175,35 @@
<x>0</x>
<y>0</y>
<width>826</width>
<height>25</height>
<height>46</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
<connections>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>EditModificationView</receiver>
<slot>doActionBrowse()</slot>
<hints>
<hint type="sourcelabel">
<x>763</x>
<y>388</y>
</hint>
<hint type="destinationlabel">
<x>875</x>
<y>448</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>doNotValidHide(bool)</slot>
<slot>doNotCheckedHide(bool)</slot>
<slot>doNotGroupedHide(bool)</slot>
<slot>doActionBrowse()</slot>
</slots>
</ui>
......@@ -23,6 +23,7 @@
#include "editmodifications.h"
#include "../project_view/projectwindow.h"
#include "../../utils/utils.h"
#include <QDesktopServices>
#include "ui_edit_modifications.h"
......@@ -35,6 +36,8 @@ EditModifications::EditModifications(ProjectWindow *parent):
_project_window = parent;
_p_modification_str_li = new QStandardItemModel();
ui->modification_list_view->setModel(_p_modification_str_li);
_p_browse_modification_dialog = new ChooseModificationDialog(this);
connect(ui->modification_list_view,SIGNAL(clicked(const QModelIndex)),this,SLOT(ItemClicked(QModelIndex)));
......@@ -72,9 +75,7 @@ void EditModifications::ItemDoubleClicked (QModelIndex index )
{
qDebug() << "EditModifications::ItemClicked data=" << index.data().toString();
qDebug() << "EditModifications::ItemClicked acc=" << _p_modification_str_li->data(index,Qt::UserRole).toString();
QString iri(QString("http://purl.obolibrary.org/obo/%1").arg(_p_modification_str_li->data(index,Qt::UserRole).toString().replace(":","_")));
QUrl url(QString("http://www.ebi.ac.uk/ols/ontologies/mod/terms?iri=%1").arg(iri));
QDesktopServices::openUrl (url) ;
QDesktopServices::openUrl (Utils::getOlsUrl(_p_modification_str_li->data(index,Qt::UserRole).toString())) ;
}
void EditModifications::ItemClicked (QModelIndex index )
......@@ -111,3 +112,16 @@ void EditModifications::setSelectedModification (pappso::AaModificationP modific
ui->delta_label->setText(QString::number(modification->getMass(), 'f', 10));
}
void EditModifications::doActionBrowse() {
qDebug() << "EditModifications::doActionBrowse begin";
if (_selected_modification != nullptr) {
pappso::MassRange massrange(_selected_modification->getMass(), pappso::Precision::getDaltonInstance(0.1));
_p_browse_modification_dialog->setMassRange(massrange);
_p_browse_modification_dialog->show();
_p_browse_modification_dialog->raise();
_p_browse_modification_dialog->activateWindow();
}
qDebug() << "EditModifications::doActionBrowse end";
}
......@@ -27,6 +27,7 @@
#include <QMainWindow>
#include <QStandardItemModel>
#include "../choose_modification_dialog/choosemodificationdialog.h"
#include "../../core/project.h"
class ProjectWindow;
......@@ -48,6 +49,7 @@ public:
public slots:
void ItemClicked (QModelIndex index );
void ItemDoubleClicked (QModelIndex index );
void doActionBrowse();
private :
void setSelectedModification (pappso::AaModificationP modification);
void setReplaceModification (pappso::AaModificationP modification);
......@@ -55,6 +57,7 @@ private :
private:
Ui::EditModificationView *ui;
ProjectWindow * _project_window;
ChooseModificationDialog * _p_browse_modification_dialog;
QStandardItemModel * _p_modification_str_li=nullptr;
pappso::AaModificationP _selected_modification;
pappso::AaModificationP _replace_modification;
......
......@@ -26,6 +26,7 @@
#include <QFileDialog>
#include <QMessageBox>
#include <QDebug>
#include "../config.h"
#include "mainwindow.h"
#include "ui_main.h"
......@@ -87,6 +88,7 @@ MainWindow::MainWindow(QWidget *parent):
ui(new Ui::Main)
{
ui->setupUi(this);
setWindowTitle(QString("%1 %2").arg(SOFTWARE_NAME).arg(XTPCPP_VERSION));
XtpLoaderThread *worker = new XtpLoaderThread;
worker->moveToThread(&workerThread);
......
#include "utils.h"
const QUrl Utils::getOlsUrl(QString psimod_accession) {
QString iri(QString("http://purl.obolibrary.org/obo/%1").arg(psimod_accession.replace(":","_")));
QUrl url(QString("http://www.ebi.ac.uk/ols/ontologies/mod/terms?iri=%1").arg(iri));
return url;
}
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@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:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include<QUrl>
#include <QString>
#ifndef UTILS_H
#define UTILS_H
class Utils
{
public:
static const QUrl getOlsUrl(QString modification);
};
#endif // UTILS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment