Commit cd237cfe authored by Renne Thomas's avatar Renne Thomas
Browse files

add ms compute multitasking

parent 497bdba0
......@@ -184,6 +184,7 @@ SET(XTPCPP_SRCS
./gui/lists/ms_identification_run_list_view/msidentificationlistwindow.cpp
./gui/lists/ms_identification_run_list_view/msidentificationtablemodel.cpp
./gui/lists/ms_identification_run_list_view/msidentificationtableproxymodel.cpp
./gui/lists/ms_identification_run_list_view/msidlistworkerthread.cpp
./gui/lists/ms_identification_run_list_view/engine_detail_view/enginedetailwindow.cpp
./gui/mainwindow.cpp
./gui/peptide_detail_view/peptidewindow.cpp
......
......@@ -27,6 +27,7 @@
#include <QDebug>
#include <pappsomspp/pappsoexception.h>
#include "msidentificationlistwindow.h"
#include "msidlistworkerthread.h"
#include "../../../utils/identificationdatasourcestore.h"
MsIdentificationTableModel::MsIdentificationTableModel(
......@@ -34,6 +35,26 @@ MsIdentificationTableModel::MsIdentificationTableModel(
: QAbstractTableModel(ms_id_list_window)
{
m_ms_id_list_window = ms_id_list_window;
MsIdListWorkerThread *p_worker = new MsIdListWorkerThread(this);
p_worker->moveToThread(&m_ms_id_list_thread);
m_ms_id_list_thread.start();
connect(this,
&MsIdentificationTableModel::computeMsNumber,
p_worker,
&MsIdListWorkerThread::doComputeMsNumber);
connect(p_worker,
&MsIdListWorkerThread::MsNumberComputed,
this,
&MsIdentificationTableModel::onMsIdentificationDataChanged);
}
MsIdentificationTableModel::~MsIdentificationTableModel()
{
m_ms_id_list_thread.quit();
m_ms_id_list_thread.wait();
}
void
......@@ -121,6 +142,12 @@ MsIdentificationTableModel::getTitle(std::int8_t column)
case(std::int8_t)msIdentificationListColumn::id_msrun_id:
return "MsRunID";
break;
case(std::int8_t)msIdentificationListColumn::nb_ms_1:
return "Number of ms1";
break;
case(std::int8_t)msIdentificationListColumn::nb_ms_2:
return "Number of ms2";
break;
}
return "";
}
......@@ -160,6 +187,12 @@ MsIdentificationTableModel::getDescription(std::int8_t column)
case(std::int8_t)msIdentificationListColumn::id_msrun_id:
return "Identification of MsRunID";
break;
case(std::int8_t)msIdentificationListColumn::nb_ms_1:
return "Number of ms1 spectra";
break;
case(std::int8_t)msIdentificationListColumn::nb_ms_2:
return "Number of ms2 spectra";
break;
}
return "";
}
......@@ -301,6 +334,40 @@ MsIdentificationTableModel::data(const QModelIndex &index, int role) const
IdentificationEngineStatistics::total_spectra_used)
.toDouble());
}
if(col == (std::int8_t)msIdentificationListColumn::nb_ms_1)
{
QVariant nb_ms1 =
m_identificationDataSourceSpList.at(row)
->getMsRunSp()
->getMsRunStatistics(MsRunStatistics::total_spectra_ms1);
if(nb_ms1.isNull())
{
emit computeMsNumber(
m_identificationDataSourceSpList.at(row));
}
else
{
return nb_ms1;
}
return QVariant("Wait");
}
if(col == (std::int8_t)msIdentificationListColumn::nb_ms_2)
{
QVariant nb_ms2 =
m_identificationDataSourceSpList.at(row)
->getMsRunSp()
->getMsRunStatistics(MsRunStatistics::total_spectra_ms2);
if(nb_ms2.isNull())
{
emit computeMsNumber(
m_identificationDataSourceSpList.at(row));
}
else
{
return nb_ms2;
}
return QVariant("Wait2");
}
case Qt::ToolTipRole:
if(col == (std::int8_t)msIdentificationListColumn::id_file)
{
......
......@@ -26,6 +26,7 @@
#include <QAbstractTableModel>
#include "../../../core/project.h"
#include <QThread>
/** \def msIdentificationListColumn list of available fields to display in ms
......@@ -44,7 +45,9 @@ enum class msIdentificationListColumn : std::int8_t
nbr_unique = 6, ///< number of unique spectra
percent_assign = 7, ///< percent of assignation
id_msrun_id = 8, ///< identification of MsRunId
last = 9, ///< get list size
nb_ms_1 = 9, ///< number of ms1
nb_ms_2 = 10, ///< number of ms1
last = 11, ///< get list size
};
class MsIdentificationListWindow;
......@@ -54,6 +57,7 @@ class MsIdentificationTableModel : public QAbstractTableModel
Q_OBJECT
public:
MsIdentificationTableModel(MsIdentificationListWindow *ms_id_list_window);
virtual ~MsIdentificationTableModel();
virtual int
rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int
......@@ -61,7 +65,7 @@ class MsIdentificationTableModel : public QAbstractTableModel
virtual QVariant
headerData(int section, Qt::Orientation orientation, int role) const override;
virtual QVariant data(const QModelIndex &index,
int role = Qt::DisplayRole) const override;
int role = Qt::DisplayRole)const override;
static const QString getTitle(msIdentificationListColumn column);
static const QString getDescription(msIdentificationListColumn column);
......@@ -80,11 +84,15 @@ class MsIdentificationTableModel : public QAbstractTableModel
public slots:
void onMsIdentificationDataChanged();
signals:
void computeMsNumber(IdentificationDataSourceSp identificationDataSource) const;
private:
static int getColumnWidth(int column);
void refresh();
private:
std::vector<IdentificationDataSourceSp> m_identificationDataSourceSpList;
MsIdentificationListWindow *m_ms_id_list_window;
QThread m_ms_id_list_thread;
std::vector<bool> m_list_done;
};
/**
* \file src/gui/xic_view/xicworkerthread.cpp
* \date 12/1/2018
* \author Olivier Langella
* \brief XIC worker
*/
/*******************************************************************************
* Copyright (c) 2018 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 <tuple>
#include "msidlistworkerthread.h"
#include <pappsomspp/pappsoexception.h>
#include <pappsomspp/exception/exceptionnotfound.h>
#include <unistd.h>
MsIdListWorkerThread::MsIdListWorkerThread(MsIdentificationTableModel *parent)
{
}
MsIdListWorkerThread::~MsIdListWorkerThread()
{
}
void
MsIdListWorkerThread::doComputeMsNumber(
IdentificationDataSourceSp identificationDataSource)
{
if(std::find(m_vectorWorking.begin(),
m_vectorWorking.end(),
identificationDataSource.get()) != m_vectorWorking.end())
{
qDebug() << " TEST";
emit MsNumberComputed();
}
else
{
m_vectorWorking.push_back(identificationDataSource.get());
if(identificationDataSource->getMsRunSp()->findMsRunFile())
{
identificationDataSource->getMsRunSp()->checkMsRunStatistics();
}
identificationDataSource->getMsRunSp()->freeMsRunReaderSp();
}
emit MsNumberComputed();
}
/**
* \file src/gui/xic_view/xicworkerthread.h
* \date 12/1/2018
* \author Olivier Langella
* \brief XIC worker
*/
/*******************************************************************************
* Copyright (c) 2018 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
******************************************************************************/
# pragma once
#include <QObject>
#include "../../../core/msrun.h"
#include "msidentificationtablemodel.h"
class MsIdListWorkerThread : public QObject
{
Q_OBJECT
public:
MsIdListWorkerThread(MsIdentificationTableModel *parent);
virtual ~MsIdListWorkerThread();
public slots:
void doComputeMsNumber(IdentificationDataSourceSp identificationDataSource);
signals:
void MsNumberComputed();
private:
std::vector<IdentificationDataSource*> m_vectorWorking;
};
......@@ -52,7 +52,7 @@ main(int argc, char *argv[])
"std::vector<pappso::PeptideNaturalIsotopeAverageSp>");
qRegisterMetaType<ExportFastaType>("ExportFastaType");
qRegisterMetaType<MasschroqFileParameters>("MasschroqFileParameters");
qRegisterMetaType<IdentificationDataSourceSp>("IdentificationDataSourceSp");
qRegisterMetaType<ContaminantRemovalMode>("ContaminantRemovalMode");
// qRegisterMetaType<pappso::PeakIonIsotopeMatch>("pappso::PeakIonIsotopeMatch");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment