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

WIP: building ptm peptide table model

parent cecf8093
No related branches found
No related tags found
No related merge requests found
......@@ -128,6 +128,9 @@ SET(XTPCPP_SRCS
./gui/ptm_island_list_view/ptmislandlistwindow.cpp
./gui/ptm_island_list_view/ptmislandtablemodel.cpp
./gui/ptm_island_list_view/ptmislandproxymodel.cpp
./gui/ptm_peptide_list_view/ptmpeptidelistwindow.cpp
./gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp
./gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.cpp
./gui/waiting_message_dialog/waitingmessagedialog.cpp
./gui/workerthread.cpp
./utils/workmonitor.cpp
......@@ -148,6 +151,7 @@ SET (GUI_UIS
./gui/protein_list_view/protein_view.ui
./gui/protein_view/protein_detail_view.ui
./gui/ptm_island_list_view/ptm_island_list_view.ui
./gui/ptm_peptide_list_view/ptm_peptide_list_view.ui
./gui/waiting_message_dialog/waiting_message_dialog.ui
)
......@@ -174,6 +178,9 @@ SET(XTPCPP_MOC_HDRS
./gui/ptm_island_list_view/ptmislandlistwindow.h
./gui/ptm_island_list_view/ptmislandtablemodel.h
./gui/ptm_island_list_view/ptmislandproxymodel.h
./gui/ptm_peptide_list_view/ptmpeptidelistwindow.h
./gui/ptm_peptide_list_view/ptmpeptidetablemodel.h
./gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.h
./gui/waiting_message_dialog/waitingmessagedialog.h
./gui/workerthread.h
./utils/workmonitor.h
......
......@@ -30,6 +30,7 @@
#include "ptmsamplescan.h"
PtmSampleScan::PtmSampleScan(const PeptideMatch * p_peptide_match) {
_peptide_match_list.push_back(p_peptide_match);
}
PtmSampleScan::PtmSampleScan(const PtmSampleScan& other){
......@@ -37,6 +38,19 @@ PtmSampleScan::PtmSampleScan(const PtmSampleScan& other){
PtmSampleScan::~PtmSampleScan() {
}
const PeptideMatch * PtmSampleScan::getRepresentativePeptideMatch() const {
return _peptide_match_list[0];
}
bool PtmSampleScan::add(const PeptideMatch * p_peptide_match) {
return false;
if(getRepresentativePeptideMatch()->getHashSampleScan() != p_peptide_match->getHashSampleScan()) {
return false;
}
if(getRepresentativePeptideMatch()->getPeptideXtpSp().get()->getSequence() != p_peptide_match->getPeptideXtpSp().get()->getSequence()) {
return false;
}
if(getRepresentativePeptideMatch()->getPeptideXtpSp().get()->getMass() != p_peptide_match->getPeptideXtpSp().get()->getMass()) {
return false;
}
_peptide_match_list.push_back(p_peptide_match);
return true;
}
......@@ -47,6 +47,7 @@ public:
PtmSampleScan(const PtmSampleScan& other);
~PtmSampleScan();
const PeptideMatch * getRepresentativePeptideMatch() const;
bool add(const PeptideMatch * p_peptide_match);
private:
std::vector<const PeptideMatch *> _peptide_match_list;
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PtmIslandListWindow</class>
<widget class="QMainWindow" name="PtmIslandListWindow">
<class>PtmPeptideListWindow</class>
<widget class="QMainWindow" name="PtmPeptideListWindow">
<property name="geometry">
<rect>
<x>0</x>
......@@ -14,7 +14,7 @@
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="windowTitle">
<string>PTM island list</string>
<string>PTM peptide list</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="contextMenuPolicy">
......@@ -22,7 +22,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableView" name="ptm_island_tableview">
<widget class="QTableView" name="ptm_peptide_tableview">
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
......@@ -79,7 +79,7 @@
<x>0</x>
<y>0</y>
<width>826</width>
<height>23</height>
<height>25</height>
</rect>
</property>
</widget>
......@@ -95,4 +95,3 @@
<slot>doSearchOn(QString)</slot>
</slots>
</ui>
......@@ -28,3 +28,48 @@
******************************************************************************/
#include "ptmpeptidelistwindow.h"
#include "../ptm_island_list_view/ptmislandlistwindow.h"
#include "ui_ptm_peptide_list_view.h"
PtmPeptideListWindow::PtmPeptideListWindow(PtmIslandListWindow * parent):QMainWindow(parent),
ui(new Ui::PtmPeptideListWindow) {
_p_ptm_island_list_window = parent;
ui->setupUi(this);
/*
*/
_ptm_table_model_p = new PtmPeptideTableModel(this);
_ptm_proxy_model_p = new PtmPeptideTableProxyModel(this, _ptm_table_model_p);
_ptm_proxy_model_p->setSourceModel(_ptm_table_model_p);
_ptm_proxy_model_p->setDynamicSortFilter(true);
ui->ptm_peptide_tableview->setModel( _ptm_proxy_model_p );
ui->ptm_peptide_tableview->setSortingEnabled(true);
ui->ptm_peptide_tableview->setAlternatingRowColors(true);
#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
//connect (this, SIGNAL(ptmIslandDataChanged()), _ptm_table_model_p, SLOT(onPtmIslandDataChanged()));
//connect (_project_window, SIGNAL(identificationPtmGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationPtmGroupGrouped(IdentificationGroup *)));
//connect (_project_window, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
connect(ui->ptm_peptide_tableview, SIGNAL(clicked(const QModelIndex &)), _ptm_table_model_p, SLOT(onTableClicked(const QModelIndex &)));
#endif
}
PtmPeptideListWindow::~PtmPeptideListWindow() {
}
void PtmPeptideListWindow::setPtmIsland(PtmIsland * p_ptm_island) {
_p_ptm_island = _p_ptm_island;
}
......@@ -30,8 +30,32 @@
#ifndef PTMPEPTIDELISTWINDOW_H
#define PTMPEPTIDELISTWINDOW_H
class PtmPeptideListWindow
{
#include <QMainWindow>
#include "../../grouping/ptm/ptmisland.h"
#include "ptmpeptidetablemodel.h"
#include "ptmpeptidetableproxymodel.h"
class PtmIslandListWindow;
namespace Ui {
class PtmPeptideListWindow;
}
class PtmPeptideListWindow: public QMainWindow {
Q_OBJECT
public:
explicit PtmPeptideListWindow(PtmIslandListWindow * parent = 0);
~PtmPeptideListWindow();
void setPtmIsland(PtmIsland * p_ptm_island);
private:
PtmIsland * _p_ptm_island=nullptr;
Ui::PtmPeptideListWindow *ui;
PtmPeptideTableModel * _ptm_table_model_p = nullptr;
PtmPeptideTableProxyModel * _ptm_proxy_model_p = nullptr;
PtmIslandListWindow * _p_ptm_island_list_window;
};
#endif // PTMPEPTIDELISTWINDOW_H
......@@ -27,3 +27,193 @@
******************************************************************************/
#include "ptmpeptidetablemodel.h"
#include "ptmpeptidelistwindow.h"
#include <QDebug>
PtmPeptideTableModel::PtmPeptideTableModel(PtmPeptideListWindow * p_ptm_peptide_list_window) {
}
PtmPeptideTableModel::~PtmPeptideTableModel() {
}
const QString PtmPeptideTableModel::getTitle(PtmPeptideListColumn column) {
qDebug() << "PtmPeptideTableModel::getTitle begin ";
return PtmPeptideTableModel::getTitle((std::int8_t) column);
//qDebug() << "ProteinTableModel::getTitle end ";
}
const QString PtmPeptideTableModel::getDescription(PtmPeptideListColumn column) {
qDebug() << "PtmPeptideTableModel::columnCount begin ";
return PtmPeptideTableModel::getDescription((std::int8_t) column);
//qDebug() << "ProteinTableModel::columnCount end ";
}
const QString PtmPeptideTableModel::getTitle(std::int8_t column) {
switch (column) {
case (std::int8_t) PtmPeptideListColumn::peptide_ptm_grouping_id:
return "peptide ID";
break;
case (std::int8_t) PtmPeptideListColumn::sample:
return "sample";
break;
case (std::int8_t) PtmPeptideListColumn::scan:
return "scan";
break;
case (std::int8_t) PtmPeptideListColumn::rt:
return "RT";
break;
case (std::int8_t) PtmPeptideListColumn::charge:
return "charge";
break;
case (std::int8_t) PtmPeptideListColumn::sequence:
return "sequence";
break;
case (std::int8_t) PtmPeptideListColumn::modifs:
return "modifs";
break;
case (std::int8_t) PtmPeptideListColumn::label:
return "label";
break;
case (std::int8_t) PtmPeptideListColumn::start:
return "start";
break;
case (std::int8_t) PtmPeptideListColumn::length:
return "length";
break;
case (std::int8_t) PtmPeptideListColumn::used:
return "used";
break;
case (std::int8_t) PtmPeptideListColumn::subgroups:
return "subgroups";
break;
case (std::int8_t) PtmPeptideListColumn::Evalue:
return "Evalue";
break;
case (std::int8_t) PtmPeptideListColumn::theoretical_mhplus:
return "theoretical MH+";
break;
case (std::int8_t) PtmPeptideListColumn::delta_mhplus:
return "delta MH+";
break;
case (std::int8_t) PtmPeptideListColumn::hyperscore:
return "hyperscore";
}
return "";
}
const QString PtmPeptideTableModel::getDescription(std::int8_t column) {
switch (column) {
case (std::int8_t) PtmPeptideListColumn::peptide_ptm_grouping_id:
return "unique PTM peptide identifier within this PTM grouping experiment";
break;
case (std::int8_t) PtmPeptideListColumn::sample:
return "MS sample name";
break;
case (std::int8_t) PtmPeptideListColumn::scan:
return "scan number";
break;
case (std::int8_t) PtmPeptideListColumn::rt:
return "retention time in seconds";
break;
case (std::int8_t) PtmPeptideListColumn::charge:
return "peptide charge";
break;
case (std::int8_t) PtmPeptideListColumn::sequence:
return "peptide sequence";
break;
case (std::int8_t) PtmPeptideListColumn::modifs:
return "peptide modifications";
break;
case (std::int8_t) PtmPeptideListColumn::label:
return "peptide label";
break;
case (std::int8_t) PtmPeptideListColumn::start:
return "peptide start position on protein";
break;
case (std::int8_t) PtmPeptideListColumn::length:
return "peptide length";
break;
case (std::int8_t) PtmPeptideListColumn::used:
return "number of subgroups in which this peptide is used";
break;
case (std::int8_t) PtmPeptideListColumn::subgroups:
return "list of subgroups in which this peptide is used";
break;
case (std::int8_t) PtmPeptideListColumn::Evalue:
return "peptide Evalue";
break;
case (std::int8_t) PtmPeptideListColumn::theoretical_mhplus:
return "peptide theoretical MH+";
break;
case (std::int8_t) PtmPeptideListColumn::delta_mhplus:
return "peptide mass difference betwenn observed mass and theoretical mass";
break;
case (std::int8_t) PtmPeptideListColumn::hyperscore:
return "X!Tandem hyperscore";
}
return "";
}
int PtmPeptideTableModel::rowCount(const QModelIndex &parent ) const {
qDebug() << "PtmPeptideTableModel::rowCount begin ";
return _ptm_sample_scan_list.size();
}
int PtmPeptideTableModel::columnCount(const QModelIndex &parent ) const {
//qDebug() << "ProteinTableModel::columnCount begin ";
return 6;
}
QVariant PtmPeptideTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal)
{
switch (role) {
case Qt::DisplayRole :
return QVariant(getTitle(section));
break;
case Qt::ToolTipRole :
return QVariant(getDescription(section));
break;
}
}
return QVariant();
}
QVariant PtmPeptideTableModel::data(const QModelIndex &index, int role ) const {
// generate a log message when this method gets called
int row = index.row();
int col = index.column();
if (row >= _ptm_sample_scan_list.size()) return QVariant();
switch(role) {
case Qt::DisplayRole:
switch (col) {
case (std::int8_t)PtmPeptideListColumn::peptide_ptm_grouping_id:
return QVariant();
break;
case (std::int8_t)PtmPeptideListColumn::sample:
return _ptm_sample_scan_list.at(row).get()->getRepresentativePeptideMatch()->getIdentificationDataSource()->getSampleName();
break;
case (std::int8_t)PtmPeptideListColumn::scan:
//return QVariant ((quint32) _p_protein_match->getPeptideMatchList().at(row)->getScan());
break;
case (std::int8_t)PtmPeptideListColumn::rt:
//return QVariant ((qreal) _p_protein_match->getPeptideMatchList().at(row)->getRetentionTime());
break;
case (std::int8_t)PtmPeptideListColumn::charge:
//return QVariant ((qreal) _p_protein_match->getPeptideMatchList().at(row)->getCharge());
break;
case (std::int8_t)PtmPeptideListColumn::sequence:
//return _p_protein_match->getPeptideMatchList().at(row)->getPeptideXtpSp().get()->getSequence();
break;
case (std::int8_t)PtmPeptideListColumn::modifs:
//return _p_protein_match->getPeptideMatchList().at(row)->getPeptideXtpSp().get()->getModifString();
break;
}
}
return QVariant();
}
......@@ -29,8 +29,57 @@
#ifndef PTMPEPTIDETABLEMODEL_H
#define PTMPEPTIDETABLEMODEL_H
class PtmPeptideTableModel
#include <QAbstractTableModel>
#include "../../grouping/ptm/ptmsamplescan.h"
/** \def PtmPeptideListColumn list of available fields to display in ptm peptide list
*
*/
enum class PtmPeptideListColumn: std::int8_t {
peptide_ptm_grouping_id=0, ///< peptide PTM grouping id
sample=1,
scan=2,
rt=3,
charge=4,
sequence=5,
modifs=6,
label=7,
start=8,
length=9,
used=10,
subgroups=11,
Evalue=12,
theoretical_mhplus=13,
delta_mhplus=14,
hyperscore=15
};
class PtmPeptideListWindow;
class PtmPeptideTableModel: public QAbstractTableModel
{
Q_OBJECT
public:
PtmPeptideTableModel(PtmPeptideListWindow * p_ptm_peptide_list_window);
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
static const QString getTitle(PtmPeptideListColumn column);
static const QString getDescription(PtmPeptideListColumn column);
~PtmPeptideTableModel();
private :
static const QString getTitle(std::int8_t column);
static const QString getDescription(std::int8_t column);
private:
std::vector<PtmSampleScanSp> _ptm_sample_scan_list;
};
#endif // PTMPEPTIDETABLEMODEL_H
......@@ -27,3 +27,16 @@
******************************************************************************/
#include "ptmpeptidetableproxymodel.h"
#include "ptmpeptidetablemodel.h"
#include "ptmpeptidelistwindow.h"
PtmPeptideTableProxyModel::PtmPeptideTableProxyModel(PtmPeptideListWindow * p_ptm_peptide_list_window, PtmPeptideTableModel* ptm_table_model_p)
{
_p_ptm_peptide_list_window = p_ptm_peptide_list_window;
_p_ptm_table_model = ptm_table_model_p;
}
PtmPeptideTableProxyModel::~PtmPeptideTableProxyModel()
{
}
......@@ -29,8 +29,23 @@
#ifndef PTMPEPTIDETABLEPROXYMODEL_H
#define PTMPEPTIDETABLEPROXYMODEL_H
class PtmPeptideTableProxyModel
#include <QAbstractTableModel>
#include <QSortFilterProxyModel>
class PtmPeptideListWindow;
class PtmPeptideTableModel;
class PtmPeptideTableProxyModel: public QSortFilterProxyModel
{
Q_OBJECT
public:
PtmPeptideTableProxyModel(PtmPeptideListWindow * p_ptm_peptide_list_window, PtmPeptideTableModel* ptm_table_model_p);
~PtmPeptideTableProxyModel();
private:
PtmPeptideListWindow * p_ptm_peptide_list_window;
PtmPeptideTableModel* ptm_table_model_p;
};
#endif // PTMPEPTIDETABLEPROXYMODEL_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