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

ods export system

parent bf94a97d
No related branches found
No related tags found
No related merge requests found
Showing
with 513 additions and 6 deletions
......@@ -72,6 +72,8 @@ SET(CPP_FILES
input/xpipsaxhandler.cpp
input/xtandemsaxhandler.cpp
output/masschroqml.cpp
output/ods/odsexport.cpp
output/ods/simplesheet.cpp
utils/identificationdatasourcestore.cpp
utils/groupstore.cpp
utils/msrunstore.cpp
......@@ -86,6 +88,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/export_spreadsheet_dialog/exportspreadsheetdialog.cpp
./gui/load_results_dialog/loadresultsdialog.cpp
./gui/mainwindow.cpp
./gui/peptide_detail_view/peptidewindow.cpp
......@@ -103,6 +106,7 @@ SET(XTPCPP_SRCS
)
SET (GUI_UIS
./gui/export_spreadsheet_dialog/export_spreadsheet_dialog.ui
./gui/load_results_dialog/load_results_dialog.ui
./gui/main.ui
./gui/peptide_detail_view/peptide_detail_view.ui
......@@ -116,6 +120,7 @@ SET (GUI_UIS
SET(XTPCPP_MOC_HDRS
./gui/export_spreadsheet_dialog/exportspreadsheetdialog.h
./gui/load_results_dialog/loadresultsdialog.h
./gui/mainwindow.h
./gui/peptide_detail_view/peptidewindow.h
......
......@@ -49,6 +49,10 @@ MsRun::~MsRun() {
}
const QString & MsRun::getSampleName() const {
return _name;
}
void MsRun::setFilename(const QString filename) {
_location = filename;
}
......
......@@ -50,6 +50,7 @@ public:
void setXmlId(const QString xmlid);
const QString & getFilename() const;
const QString & getSampleName() const;
const QString & getXmlId() const;
MzFormat getMzFormat() const;
......
......@@ -55,6 +55,10 @@ void Project::setCombineMode(bool is_combine_mode) {
std::vector<IdentificationGroup *> Project::getIdentificationGroupList() {
return _identification_goup_list;
}
const std::vector<IdentificationGroup *> Project::getIdentificationGroupList() const {
return _identification_goup_list;
}
const GroupingType Project::getGroupingType() const {
return _grouping_type;
}
......
......@@ -61,6 +61,7 @@ public:
const GroupingType getGroupingType() const;
std::vector<IdentificationGroup *> getIdentificationGroupList();
const std::vector<IdentificationGroup *> getIdentificationGroupList() const;
void setCombineMode(bool is_combine_mode);
bool isCombineMode() const;
void readResultFile(QString filename);
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ExportSpreadsheetDialog</class>
<widget class="QWidget" name="ExportSpreadsheetDialog">
<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 spreadsheets</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="simple_checkbox">
<property name="text">
<string>simple protein and peptide list</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</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>ExportSpreadsheetDialog</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>ExportSpreadsheetDialog</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>
<connection>
<sender>simple_checkbox</sender>
<signal>toggled(bool)</signal>
<receiver>ExportSpreadsheetDialog</receiver>
<slot>doSimpleProteinPeptideList(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>115</x>
<y>110</y>
</hint>
<hint type="destinationlabel">
<x>633</x>
<y>369</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 "ui_export_spreadsheet_dialog.h"
#include "exportspreadsheetdialog.h"
#include <QDebug>
#include <QSettings>
ExportSpreadsheetDialog::ExportSpreadsheetDialog(QWidget * parent):
QDialog(parent),
ui(new Ui::ExportSpreadsheetDialog)
{
qDebug() << "ExportSpreadsheetDialog::ExportSpreadsheetDialog begin";
ui->setupUi(this);
this->setModal(true);
QSettings settings;
ui->simple_checkbox->setCheckState(Qt::Unchecked);
if (settings.value("export_ods/simple", "true").toBool()) {
ui->simple_checkbox->setCheckState(Qt::Checked);
}
//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
qDebug() << "ExportSpreadsheetDialog::ExportSpreadsheetDialog end";
}
ExportSpreadsheetDialog::~ExportSpreadsheetDialog()
{
delete ui;
}
void ExportSpreadsheetDialog::doSimpleProteinPeptideList(bool simple) {
QSettings settings;
settings.setValue("export_ods/simple", QString("%1").arg(simple));
}
/*******************************************************************************
* 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 EXPORTSPREADSHEETDIALOG_H
#define EXPORTSPREADSHEETDIALOG_H
#include <QDialog>
#include <QStringListModel>
#include "../project_view/automatic_filter_widget/automaticfilterwidget.h"
namespace Ui {
class ExportSpreadsheetDialog;
}
class ProjectWindow;
class ExportSpreadsheetDialog : public QDialog
{
Q_OBJECT
public:
explicit ExportSpreadsheetDialog(QWidget * parent);
~ExportSpreadsheetDialog();
public slots:
void doSimpleProteinPeptideList(bool simple);
signals:
private:
Ui::ExportSpreadsheetDialog *ui;
};
#endif // EXPORTSPREADSHEETDIALOG_H
......@@ -33,7 +33,6 @@ namespace Ui {
class LoadResultsDialog;
}
class ProjectWindow;
class LoadResultsDialog : public QDialog
{
......
......@@ -30,7 +30,9 @@
#include "ui_main.h"
#include <pappsomspp/pappsoexception.h>
#include <odsstream/odsdocwriter.h>
#include "../output/masschroqml.h"
#include "../output/ods/odsexport.h"
void XtpLoaderThread::doXpipFileLoad(QString filename) {
......@@ -90,6 +92,7 @@ MainWindow::MainWindow(QWidget *parent):
workerThread.start();
_p_load_results_dialog = new LoadResultsDialog(this);
_p_export_spreadsheet_dialog = new ExportSpreadsheetDialog(this);
_project_window = new ProjectWindow(this);
......@@ -118,6 +121,7 @@ MainWindow::MainWindow(QWidget *parent):
connect(worker, SIGNAL(projectReady(ProjectSp)), this,SLOT(doProjectReady(ProjectSp)));
connect(this, SIGNAL(operateLoadingResults(bool,AutomaticFilterParameters,QStringList)), worker,SLOT(doLoadingResults(bool,AutomaticFilterParameters,QStringList)));
connect(_p_load_results_dialog, SIGNAL(accepted()), this,SLOT(doAcceptedLoadResultDialog()));
connect(_p_export_spreadsheet_dialog, SIGNAL(accepted()), this,SLOT(doAcceptedExportSpreadsheetDialog()));
connect(worker, SIGNAL(loadingMessage(QString)), this,SLOT(doDisplayLoadingMessage(QString)));
connect(worker, SIGNAL(projectNotReady(QString)), this,SLOT(doProjectNotReady(QString)));
/*
......@@ -157,6 +161,35 @@ void MainWindow::doDisplayLoadingMessage(QString message) {
ui->statusbar->showMessage(message);
}
void MainWindow::doAcceptedExportSpreadsheetDialog() {
qDebug() << "MainWindow::doAcceptedExportSpreadsheetDialog begin";
try {
QSettings settings;
QString default_location = settings.value("path/export_ods", "").toString();
QString filename = QFileDialog::getSaveFileName(this, tr("Save ODS file"),
QString("%1/untitled.ods").arg(default_location),
tr("Open Document Spreadsheet (*.ods)"));
if (filename.isEmpty()) {
return;
}
settings.setValue("path/export_ods", QFileInfo(filename).absolutePath());
OdsDocWriter writer(filename);
OdsExport export_ods(_project_sp.get());
export_ods.write(&writer);
writer.close();
//emit operateXpipFile(filename);
}
catch (pappso::PappsoException & error) {
viewError(tr("Error while writing ODS file :\n%1").arg(error.qwhat()));
}
qDebug() << "MainWindow::doAcceptedExportSpreadsheetDialog end";
}
void MainWindow::doAcceptedLoadResultDialog() {
qDebug() << "MainWindow::doAcceptedLoadResultDialog begin";
AutomaticFilterParameters param = _p_load_results_dialog->getAutomaticFilterParameters();
......@@ -227,12 +260,12 @@ void MainWindow::selectXpipFile() {
qDebug() << "MainWindow::doActionSpreadsheet begin";
try {
_p_load_results_dialog->show();
_p_load_results_dialog->raise();
_p_load_results_dialog->activateWindow();
_p_export_spreadsheet_dialog->show();
_p_export_spreadsheet_dialog->raise();
_p_export_spreadsheet_dialog->activateWindow();
}
catch (pappso::PappsoException & error) {
viewError(tr("Error while writing MassChroqML file :\n%1").arg(error.qwhat()));
viewError(tr("Error doActionSpreadsheet :\n%1").arg(error.qwhat()));
}
qDebug() << "MainWindow::doActionSpreadsheet end";
}
......
......@@ -38,6 +38,7 @@
#include "files/xpipfile.h"
#include "project_view/projectwindow.h"
#include "load_results_dialog/loadresultsdialog.h"
#include "export_spreadsheet_dialog/exportspreadsheetdialog.h"
......@@ -85,6 +86,7 @@ public slots:
void doProjectReady(ProjectSp project_sp);
void doProjectNotReady(QString error);
void doAcceptedLoadResultDialog();
void doAcceptedExportSpreadsheetDialog();
//void peptideEdited(QString peptideStr);
// void setColor(const QColor &color);
// void setShape(Shape shape);
......@@ -109,6 +111,7 @@ private :
ProjectWindow * _project_window=nullptr;
LoadResultsDialog * _p_load_results_dialog=nullptr;
ExportSpreadsheetDialog * _p_export_spreadsheet_dialog;
};
......
......@@ -21,7 +21,7 @@
<bool>true</bool>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="identifications">
<attribute name="title">
......
/**
* \file output/ods/odsexport.cpp
* \date 11/4/2017
* \author Olivier Langella
* \brief ODS export
*/
/*******************************************************************************
* 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 "odsexport.h"
#include "simplesheet.h"
#include <QSettings>
OdsExport::OdsExport(const Project * project):_p_project(project) {
}
void OdsExport::write(CalcWriterInterface * p_writer) {
QSettings settings;
if (settings.value("export_ods/simple", "false").toBool()) {
SimpleSheet(p_writer, _p_project);
}
}
/**
* \file output/ods/odsexport.h
* \date 11/4/2017
* \author Olivier Langella
* \brief ODS export
*/
/*******************************************************************************
* 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 ODSEXPORT_H
#define ODSEXPORT_H
#include "../../core/project.h"
#include <odsstream/calcwriterinterface.h>
class OdsExport
{
public:
OdsExport(const Project * project);
void write(CalcWriterInterface * p_writer);
private:
const Project * _p_project;
};
#endif // ODSEXPORT_H
/**
* \file output/ods/simplesheet.h
* \date 11/4/2017
* \author Olivier Langella
* \brief ODS simple sheet
*/
/*******************************************************************************
* 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 "simplesheet.h"
#include "../../core/identificationgroup.h"
SimpleSheet::SimpleSheet (CalcWriterInterface * p_writer, const Project * p_project): _p_project(p_project) {
_p_writer = p_writer;
p_writer->writeSheet("simple");
std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList();
for (IdentificationGroup * p_ident:identification_list) {
writeIdentificationGroup(p_ident);
}
}
void SimpleSheet::writeIdentificationGroup(IdentificationGroup * p_ident) {
//_p_writer->writeSheet("simple");
const std::vector<MsRunSp> msrun_list = p_ident->getMsRunSpList();
_p_writer->writeCell("protein");
_p_writer->writeLine();
_p_writer->writeEmptyCell();
_p_writer->writeCell("peptide");
_p_writer->writeLine();
if (msrun_list.size() == 1) {
_p_writer->writeCell("sample");
_p_writer->writeLine();
_p_writer->writeCell(msrun_list[0].get()->getSampleName());
_p_writer->writeLine();
}
for (ProteinMatch * p_protein_match :p_ident->getProteinMatchList()) {
_p_writer->writeCell(p_protein_match->getProteinXtpSp().get()->getAccession());
_p_writer->writeLine();
}
}
/**
* \file output/ods/simplesheet.h
* \date 11/4/2017
* \author Olivier Langella
* \brief ODS simple sheet
*/
/*******************************************************************************
* 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 SIMPLESHEET_H
#define SIMPLESHEET_H
#include "../../core/project.h"
#include <odsstream/calcwriterinterface.h>
#include "../../core/proteinmatch.h"
class SimpleSheet
{
public :
SimpleSheet (CalcWriterInterface * p_writer, const Project * p_project);
private :
void writeIdentificationGroup(IdentificationGroup * p_ident);
private :
const Project * _p_project;
CalcWriterInterface * _p_writer;
};
#endif // SIMPLESHEET_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