, string, string, string, bool, bool)));
+ connect(summarytableofmatchedpeaks, SIGNAL(sendFilterOptionsToChromatogram(cPeaksList)), chromatogramwindow, SLOT(setFilterOptionsSlot(cPeaksList)));
connect(summarytableofmatchedpeaks, SIGNAL(resetRegion()), imagewindow, SLOT(clearSelection()));
- // add subitems to the items in main menu
- // menuFile->addAction(actionOpen);
menuFile->addAction(actionOpenResults);
menuFile->addAction(actionSaveResults);
menuFile->addSeparator();
@@ -241,45 +255,48 @@ cMainWindow::cMainWindow() {
menuFile->addAction(actionExportToHTML);
menuFile->addSeparator();
menuFile->addAction(actionQuit);
+
menuSearch->addAction(actionRun);
menuSearch->addAction(actionStop);
menuSearch->addSeparator();
menuSearch->addAction(actionProperties);
+
menuTools->addAction(actionBricksDatabase);
menuTools->addAction(actionSequenceDatabase);
menuTools->addAction(actionModifications);
menuTools->addSeparator();
menuTools->addAction(actionDrawPeptide);
menuTools->addSeparator();
+ menuTools->addAction(actionSummaryTableOfMatchedPeaks);
+ menuTools->addAction(actionChromatogramWindow);
+ menuTools->addAction(actionImageWindow);
+ menuTools->addSeparator();
menuTools->addAction(actionNorine);
menuTools->addAction(actionSmilesToMonomers);
+
menuView->addAction(actionShowIsomers);
- menuView->addAction(actionGraph);
- menuView->addSeparator();
- menuView->addAction(actionSummaryTableOfMatchedPeaks);
- menuView->addAction(actionImageWindow);
menuView->addSeparator();
+ menuView->addAction(actionGraph);
menuView->addAction(actionLog);
+
menuHelp->addAction(actionHTMLDocumentation);
menuHelp->addAction(actionPDFManual);
menuHelp->addSeparator();
menuHelp->addAction(actionAbout);
- // add items to the main menu
menuBar->addMenu(menuFile);
menuBar->addMenu(menuSearch);
menuBar->addMenu(menuTools);
menuBar->addMenu(menuView);
menuBar->addMenu(menuHelp);
- // enable the menu
setMenuBar(menuBar);
resultsproxymodel->setSourceModel(resultsmodel);
resultsproxymodel->setDynamicSortFilter(false);
results->setModel(resultsproxymodel);
results->setSelectionBehavior(QAbstractItemView::SelectItems);
- results->setSelectionMode(QAbstractItemView::SingleSelection);
+ results->setSelectionMode(QAbstractItemView::ContiguousSelection);
results->setEditTriggers(QAbstractItemView::NoEditTriggers);
results->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
results->horizontalHeader()->setSectionsMovable(true);
@@ -296,6 +313,7 @@ cMainWindow::cMainWindow() {
drawpeptidewidget->hide();
summarytableofmatchedpeaks->hide();
imagewindow->hide();
+ chromatogramwindow->hide();
parameterswidget->hide();
splitter->setOrientation(Qt::Vertical);
@@ -303,10 +321,8 @@ cMainWindow::cMainWindow() {
splitter->addWidget(logWindow);
splitter->setStretchFactor(0, 1);
- // set the central widget
setCentralWidget(splitter);
- // set the size of main window
resize(1280, 770);
resultsbasecolumncount = 9;
@@ -330,8 +346,11 @@ cMainWindow::cMainWindow() {
cMainWindow::~cMainWindow() {
deleteResults();
+ delete rowsfiltercombobox;
+ delete rowsfiltercomparatorcombobox;
delete rowsfilterline;
delete rowsfiltercasesensitive;
+ delete rowsfilterwholeword;
delete rowsfilterbutton;
delete rowsfilterclearbutton;
delete rowsfilterhbox;
@@ -352,6 +371,7 @@ cMainWindow::~cMainWindow() {
delete drawpeptidewidget;
delete summarytableofmatchedpeaks;
delete imagewindow;
+ delete chromatogramwindow;
delete parameterswidget;
delete htmlexportdialog;
@@ -372,6 +392,7 @@ cMainWindow::~cMainWindow() {
delete actionGraph;
delete actionSummaryTableOfMatchedPeaks;
delete actionImageWindow;
+ delete actionChromatogramWindow;
delete actionLog;
delete actionHTMLDocumentation;
delete actionPDFManual;
@@ -393,8 +414,8 @@ void cMainWindow::keyPressEvent(QKeyEvent *event) {
filterResults();
}
else {
- if ((results->selectionModel()->selectedRows().count() > 0) && (results->selectionModel()->selectedRows()[0].row() >= 0) && resultsproxymodel->mapFromSource(results->selectionModel()->selectedRows()[0]).isValid()) {
- rowDoubleClicked(results->selectionModel()->selectedRows()[0]);
+ if (results->selectionModel()->selectedIndexes().count() > 0) {
+ rowDoubleClicked(results->selectionModel()->selectedIndexes()[0]);
}
}
}
@@ -407,6 +428,10 @@ void cMainWindow::keyPressEvent(QKeyEvent *event) {
rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked());
}
+ if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_W)) {
+ rowsfilterwholeword->setChecked(!rowsfilterwholeword->isChecked());
+ }
+
event->accept();
}
@@ -419,29 +444,12 @@ void cMainWindow::closeEvent(QCloseEvent *event) {
void cMainWindow::preparePeptideSequence(int row, string& peptidesequence, bool reportisomers) {
int spectrumindex = resultsmodel->item(row, 1)->data(Qt::DisplayRole).toInt() - 1;
- string tmpsequence;
- bool copy;
+ peptidesequence = theoreticalspectrumlist[spectrumindex].getCandidate().getAcronymPeptideNameWithHTMLReferences();
+ peptidesequence = stripHTML(peptidesequence);
if (!reportisomers) {
- tmpsequence = stripHTML(theoreticalspectrumlist[spectrumindex].getCandidate().getAcronymPeptideNameWithHTMLReferences());
- peptidesequence = "";
- copy = true;
- for (int j = 0; j < (int)tmpsequence.size(); j++) {
- if (tmpsequence[j] == '/') {
- copy = false;
- }
- if (tmpsequence[j] == ']') {
- copy = true;
- }
- if (copy) {
- peptidesequence += tmpsequence[j];
- }
- }
- }
- else {
- peptidesequence = stripHTML(theoreticalspectrumlist[spectrumindex].getCandidate().getAcronymPeptideNameWithHTMLReferences());
+ stripIsomers(peptidesequence);
}
-
}
@@ -590,30 +598,45 @@ void cMainWindow::showHideLog() {
void cMainWindow::showAbout() {
about->show();
about->activateWindow();
+ if (about->isMinimized()) {
+ about->showNormal();
+ }
}
void cMainWindow::showBricksDatabase() {
bricksdatabasewidget->show();
bricksdatabasewidget->activateWindow();
+ if (bricksdatabasewidget->isMinimized()) {
+ bricksdatabasewidget->showNormal();
+ }
}
void cMainWindow::showSequenceDatabase() {
sequencedatabasewidget->show();
sequencedatabasewidget->activateWindow();
+ if (sequencedatabasewidget->isMinimized()) {
+ sequencedatabasewidget->showNormal();
+ }
}
void cMainWindow::showModifications() {
modificationswidget->show();
modificationswidget->activateWindow();
+ if (modificationswidget->isMinimized()) {
+ modificationswidget->showNormal();
+ }
}
void cMainWindow::showDrawPeptideWidget() {
drawpeptidewidget->show();
drawpeptidewidget->activateWindow();
+ if (drawpeptidewidget->isMinimized()) {
+ drawpeptidewidget->showNormal();
+ }
}
@@ -624,11 +647,19 @@ void cMainWindow::setAndShowDrawPeptideWidget(int peptidetypeindex, QString sequ
bool cMainWindow::prepareSummaryTableOfMatchedPeaks() {
+ bool imagewindowstate = actionImageWindow->isEnabled();
+ actionImageWindow->setEnabled(false);
+ actionSummaryTableOfMatchedPeaks->setEnabled(false);
+
if (!summarytableisprepared) {
rowsfilterwidget->setEnabled(false);
- summarytableisprepared = summarytableofmatchedpeaks->prepareToShow(resultsmodel, resultsproxymodel, ¶meters, &theoreticalspectrumlist);
+ summarytableisprepared = summarytableofmatchedpeaks->prepareToShow(resultsmodel, resultsproxymodel, ¶meters, &theoreticalspectrumlist, actionShowIsomers->isChecked());
rowsfilterwidget->setEnabled(true);
}
+
+ actionImageWindow->setEnabled(imagewindowstate);
+ actionSummaryTableOfMatchedPeaks->setEnabled(true);
+
return summarytableisprepared;
}
@@ -637,15 +668,32 @@ void cMainWindow::showSummaryTableOfMatchedPeaks() {
if (prepareSummaryTableOfMatchedPeaks()) {
summarytableofmatchedpeaks->show();
summarytableofmatchedpeaks->activateWindow();
+ if (summarytableofmatchedpeaks->isMinimized()) {
+ summarytableofmatchedpeaks->showNormal();
+ }
}
}
void cMainWindow::showImageWindow() {
if (prepareSummaryTableOfMatchedPeaks()) {
- imagewindow->setDefaultMaxXY(parameters.maxcountx, parameters.maxcounty, parameters.vendor);
+ imagewindow->setDefaultMaxXY(parameters.defaultmaxx, parameters.defaultmaxy, parameters.pixelsize, parameters.vendor);
imagewindow->show();
imagewindow->activateWindow();
+ if (imagewindow->isMinimized()) {
+ imagewindow->showNormal();
+ }
+ }
+}
+
+
+void cMainWindow::showChromatogramWindow() {
+ if (prepareSummaryTableOfMatchedPeaks()) {
+ chromatogramwindow->show();
+ chromatogramwindow->activateWindow();
+ if (chromatogramwindow->isMinimized()) {
+ chromatogramwindow->showNormal();
+ }
}
}
@@ -653,12 +701,18 @@ void cMainWindow::showImageWindow() {
void cMainWindow::showGraph() {
graph->show();
graph->activateWindow();
+ if (graph->isMinimized()) {
+ graph->showNormal();
+ }
}
void cMainWindow::showProperties() {
parameterswidget->show();
parameterswidget->activateWindow();
+ if (parameterswidget->isMinimized()) {
+ parameterswidget->showNormal();
+ }
}
@@ -739,6 +793,7 @@ void cMainWindow::run() {
summarytableofmatchedpeaks->hide();
summarytableisprepared = false;
imagewindow->hide();
+ chromatogramwindow->hide();
thread->start();
}
@@ -785,18 +840,29 @@ void cMainWindow::enableButtonsHandlingResults(bool enable) {
rowsfilterwidget->setEnabled(enable);
actionSummaryTableOfMatchedPeaks->setEnabled(enable);
- if (parameters.mode == dereplication) {
- actionShowIsomers->setEnabled(false);
- if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) {
- actionImageWindow->setEnabled(enable);
+ if (enable) {
+ if (parameters.mode == dereplication) {
+ actionShowIsomers->setEnabled(false);
+ if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) {
+ actionImageWindow->setEnabled(true);
+ actionChromatogramWindow->setEnabled(false);
+ }
+ else {
+ actionImageWindow->setEnabled(false);
+ actionChromatogramWindow->setEnabled(true);
+ }
}
else {
+ actionShowIsomers->setEnabled(true);
actionImageWindow->setEnabled(false);
+ actionChromatogramWindow->setEnabled(false);
}
}
else {
- actionShowIsomers->setEnabled(enable);
- }
+ actionShowIsomers->setEnabled(false);
+ actionImageWindow->setEnabled(false);
+ actionChromatogramWindow->setEnabled(false);
+ }
}
@@ -1005,6 +1071,10 @@ void cMainWindow::reportSpectra() {
}
}
+ rowsfiltercombobox->clear();
+ for (int i = 0; i < resultsmodel->columnCount(); i++) {
+ rowsfiltercombobox->addItem(resultsmodel->horizontalHeaderItem(i)->text());
+ }
results->resizeColumnsToContents();
@@ -1013,7 +1083,7 @@ void cMainWindow::reportSpectra() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
results->setModel(0);
resultsproxymodel->setSourceModel(0);
@@ -1033,8 +1103,8 @@ void cMainWindow::reportSpectra() {
resultsproxymodel->setSourceModel(resultsmodel);
results->setModel(resultsproxymodel);
- resultsproxymodel->setSortRole(Qt::InitialSortOrderRole);
results->setSortingEnabled(true);
+ resultsproxymodel->sort(-1);
for (int i = 0; i < resultsmodel->columnCount(); i++) {
results->resizeColumnToContents(i);
@@ -1045,10 +1115,21 @@ void cMainWindow::reportSpectra() {
}
-void cMainWindow::updateSpectra() {
+void cMainWindow::showIsomersStateChanged() {
if ((parameters.mode == denovoengine) || (parameters.mode == singlecomparison) || (parameters.mode == databasesearch)) {
+ if (!summarytableofmatchedpeaks->isHidden()) {
+ summarytableofmatchedpeaks->deleteTable();
+ summarytableisprepared = false;
+
+ prepareSummaryTableOfMatchedPeaks();
+ }
+ else {
+ summarytableofmatchedpeaks->deleteTable();
+ summarytableisprepared = false;
+ }
+
bool reportisomers = actionShowIsomers->isChecked();
string peptidesequence;
@@ -1057,7 +1138,7 @@ void cMainWindow::updateSpectra() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
for (int i = 0; i < resultsmodel->rowCount(); i++) {
preparePeptideSequence(i, peptidesequence, reportisomers);
@@ -1070,6 +1151,8 @@ void cMainWindow::updateSpectra() {
results->resizeColumnToContents(i);
}
+ graph->updateView(reportisomers);
+
progress.setValue(theoreticalspectrumlist.size());
}
@@ -1091,14 +1174,19 @@ void cMainWindow::deleteResults() {
void cMainWindow::rowDoubleClicked(const QModelIndex& item) {
int row = resultsproxymodel->mapToSource(item).row();
- spectradetails[resultsmodel->item(row, 1)->data(Qt::DisplayRole).toInt() - 1].prepareToShow(parameters.peptidetype);
- spectradetails[resultsmodel->item(row, 1)->data(Qt::DisplayRole).toInt() - 1].show();
- spectradetails[resultsmodel->item(row, 1)->data(Qt::DisplayRole).toInt() - 1].activateWindow();
+ int rowid = resultsmodel->item(row, 1)->data(Qt::DisplayRole).toInt() - 1;
+
+ spectradetails[rowid].prepareToShow(parameters.peptidetype, actionShowIsomers);
+ spectradetails[rowid].show();
+ spectradetails[rowid].activateWindow();
+ if (spectradetails[rowid].isMinimized()) {
+ spectradetails[rowid].showNormal();
+ }
}
void cMainWindow::setGraph(string s) {
- graph->setHTML(s);
+ graph->setHTML(s, actionShowIsomers->isChecked());
}
@@ -1113,7 +1201,7 @@ void cMainWindow::exportToCsv() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
bool removefile = false;
QFile file(filename);
@@ -1177,7 +1265,7 @@ void cMainWindow::exportToHTML() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
bool removefile = false;
QFile file(filename);
@@ -1185,6 +1273,8 @@ void cMainWindow::exportToHTML() {
return;
}
+ bool reportisomers = actionShowIsomers->isChecked();
+
QTextStream out(&file);
if (resultsmodel->rowCount() > 0) {
@@ -1215,7 +1305,13 @@ void cMainWindow::exportToHTML() {
if (htmlexportdialog->checkboxdenovo->isChecked() && (parameters.mode == denovoengine)) {
out << "De Novo Graph
\n";
- out << "\n" << graph->getHTML().c_str() << "
\n";
+ out << "\n";
+ string graphhtml = graph->getHTML();
+ if (!reportisomers) {
+ stripIsomers(graphhtml);
+ }
+ out << graphhtml.c_str();
+ out << "
\n";
out << "
\n";
}
@@ -1269,7 +1365,7 @@ void cMainWindow::exportToHTML() {
if (parameters.mode == dereplication) {
if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) {
if (parameters.generateisotopepattern) {
- columncount = 13;
+ columncount = 15;
}
else {
columncount = 12;
@@ -1277,7 +1373,7 @@ void cMainWindow::exportToHTML() {
}
else {
if (parameters.generateisotopepattern) {
- columncount = 11;
+ columncount = 13;
}
else {
columncount = 10;
@@ -1300,7 +1396,12 @@ void cMainWindow::exportToHTML() {
out << "Coordinate X | ";
out << "Coordinate Y | ";
}
- out << "Ion Type | ";
+ if (parameters.generateisotopepattern) {
+ out << "Pattern Type | ";
+ }
+ else {
+ out << "Ion Type | ";
+ }
}
if (parameters.mode == denovoengine) {
@@ -1323,6 +1424,10 @@ void cMainWindow::exportToHTML() {
out << "Error [ppm] | ";
if (parameters.mode == dereplication) {
+ if (parameters.generateisotopepattern) {
+ out << "Score | ";
+ out << "FDR | ";
+ }
out << "Summary Formula | ";
out << "Name | ";
out << "Reference | ";
@@ -1342,7 +1447,7 @@ void cMainWindow::exportToHTML() {
continue;
}
- out << spectradetails[spectrumindex].getPartialPeaksTableAsHTMLString(spectrumindex).c_str();
+ out << spectradetails[spectrumindex].getPartialPeaksTableAsHTMLString(spectrumindex, reportisomers).c_str();
}
@@ -1352,7 +1457,7 @@ void cMainWindow::exportToHTML() {
}
if (htmlexportdialog->checkboxdetails->isChecked() || htmlexportdialog->checkboxpeakstable->isChecked()) {
- out << "Individual Rows in Output Report Table
\n";
+ out << "Individual Rows in Output Report
\n";
int spectrumindex;
for (int i = 0; i < resultsproxymodel->rowCount(); i++) {
@@ -1369,15 +1474,18 @@ void cMainWindow::exportToHTML() {
if (htmlexportdialog->checkboxpeakstable->isChecked()) {
out << "";
- out << spectradetails[spectrumindex].getPeaksTableAsHTMLString(htmlexportdialog->checkboxunmatchedtheoretical->isChecked(), htmlexportdialog->checkboxunmatchedexperimental->isChecked()).c_str();
+ out << spectradetails[spectrumindex].getPeaksTableAsHTMLString(htmlexportdialog->checkboxunmatchedtheoretical->isChecked(), htmlexportdialog->checkboxunmatchedexperimental->isChecked(), reportisomers).c_str();
out << "
\n";
}
if (htmlexportdialog->checkboxdetails->isChecked()) {
out << "";
out << "";
- out << spectradetails[spectrumindex].getDetailsAsHTMLString().c_str();
- out << spectradetails[spectrumindex].getTheoreticalSpectrum().getCoverageBySeries().c_str();
+ string textinfo = spectradetails[spectrumindex].getDetailsAsHTMLString() + spectradetails[spectrumindex].getTheoreticalSpectrum().getCoverageBySeries();
+ if (!reportisomers) {
+ stripIsomers(textinfo);
+ }
+ out << textinfo.c_str();
out << "
";
out << "\n";
}
@@ -1447,7 +1555,7 @@ void cMainWindow::saveResultsFile() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
bool removefile = false;
ofstream outfile;
@@ -1545,12 +1653,14 @@ void cMainWindow::openResultsFile() {
summarytableisprepared = false;
imagewindow->hide();
+ chromatogramwindow->hide();
theoreticalspectrumlist.clear();
spectradetails.clear();
// load graph window
graph->load(infile);
+ graph->updateView(actionShowIsomers->isChecked());
// load log window
infile.read((char *)&size, sizeof(int));
@@ -1568,13 +1678,17 @@ void cMainWindow::openResultsFile() {
actionShowIsomers->setEnabled(false);
if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) {
actionImageWindow->setEnabled(true);
+ actionChromatogramWindow->setEnabled(false);
}
else {
actionImageWindow->setEnabled(false);
+ actionChromatogramWindow->setEnabled(true);
}
}
else {
actionShowIsomers->setEnabled(true);
+ actionImageWindow->setEnabled(false);
+ actionChromatogramWindow->setEnabled(false);
}
// load theoretical spectra
@@ -1585,7 +1699,7 @@ void cMainWindow::openResultsFile() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
for (int i = 0; i < size; i++) {
theoreticalspectrum.load(infile);
@@ -1642,28 +1756,44 @@ void cMainWindow::quitApplication() {
void cMainWindow::filterResults() {
- summarytableofmatchedpeaks->deleteTable();
- summarytableofmatchedpeaks->hide();
- summarytableisprepared = false;
-
+ resultsproxymodel->setWholeWord(rowsfilterwholeword->isChecked());
resultsproxymodel->setFilterKeyColumn(-1);
resultsproxymodel->setFilterCaseSensitivity(rowsfiltercasesensitive->isChecked()?Qt::CaseSensitive:Qt::CaseInsensitive);
resultsproxymodel->setFilterFixedString(rowsfilterline->text());
+
+ if (!summarytableofmatchedpeaks->isHidden() || !imagewindow->isHidden() || !chromatogramwindow->isHidden()) {
+ summarytableofmatchedpeaks->deleteTable();
+ summarytableisprepared = false;
+
+ prepareSummaryTableOfMatchedPeaks();
+ }
+ else {
+ summarytableofmatchedpeaks->deleteTable();
+ summarytableisprepared = false;
+ }
}
void cMainWindow::resetFilter() {
- summarytableofmatchedpeaks->deleteTable();
- summarytableofmatchedpeaks->hide();
- summarytableisprepared = false;
-
rowsfilterline->setText("");
results->horizontalHeader()->setSortIndicator(-1, Qt::AscendingOrder);
resultsproxymodel->sort(-1);
+ resultsproxymodel->setWholeWord(false);
resultsproxymodel->setFilterKeyColumn(-1);
resultsproxymodel->setFilterFixedString("");
+
+ if (!summarytableofmatchedpeaks->isHidden() || !imagewindow->isHidden() || !chromatogramwindow->isHidden()) {
+ summarytableofmatchedpeaks->deleteTable();
+ summarytableisprepared = false;
+
+ prepareSummaryTableOfMatchedPeaks();
+ }
+ else {
+ summarytableofmatchedpeaks->deleteTable();
+ summarytableisprepared = false;
+ }
}
@@ -1682,7 +1812,17 @@ void cMainWindow::summaryPeaksTableCancelled() {
}
-void cMainWindow::updateSummaryPeaksTableFilter(int xmin, int xmax, int ymin, int ymax) {
+void cMainWindow::summaryPeaksTableRowDoubleClicked(int rowid) {
+ spectradetails[rowid].prepareToShow(parameters.peptidetype, actionShowIsomers);
+ spectradetails[rowid].show();
+ spectradetails[rowid].activateWindow();
+ if (spectradetails[rowid].isMinimized()) {
+ spectradetails[rowid].showNormal();
+ }
+}
+
+
+void cMainWindow::updateSummaryPeaksTableFilterSlot(int xmin, int xmax, int ymin, int ymax) {
summarytableofmatchedpeaks->updateFilterBySelectedRegion(xmin, xmax, ymin, ymax);
}
diff --git a/CycloBranch/gui/cMainWindow.h b/CycloBranch/gui/cMainWindow.h
index 22fc059..a098e95 100644
--- a/CycloBranch/gui/cMainWindow.h
+++ b/CycloBranch/gui/cMainWindow.h
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
#include "core/utilities.h"
#include "core/cTheoreticalSpectrum.h"
#include "gui/cAboutWidget.h"
@@ -30,6 +31,7 @@
#include "gui/cMainThread.h"
#include "gui/cHTMLExportDialog.h"
#include "gui/cImageWindow.h"
+#include "gui/cChromatogramWindow.h"
#include "gui/cMainWindowProxyModel.h"
@@ -72,17 +74,14 @@ class cMainWindow : public QMainWindow
private:
- // main menu
QMenuBar* menuBar;
- // items in the menu
QMenu* menuFile;
QMenu* menuSearch;
QMenu* menuTools;
QMenu* menuView;
QMenu* menuHelp;
- // toolbars
QToolBar* toolbarFile;
QToolBar* toolbarSearch;
QToolBar* toolbarTools;
@@ -90,7 +89,6 @@ class cMainWindow : public QMainWindow
QToolBar* toolbarHelp;
QToolBar* toolbarFilter;
- // subitems in the menu
QAction* actionOpenResults;
QAction* actionSaveResults;
QAction* actionExportToCsv;
@@ -109,6 +107,7 @@ class cMainWindow : public QMainWindow
QAction* actionGraph;
QAction* actionSummaryTableOfMatchedPeaks;
QAction* actionImageWindow;
+ QAction* actionChromatogramWindow;
QAction* actionLog;
QAction* actionHTMLDocumentation;
QAction* actionPDFManual;
@@ -116,8 +115,11 @@ class cMainWindow : public QMainWindow
QWidget* rowsfilterwidget;
QHBoxLayout* rowsfilterhbox;
+ QComboBox* rowsfiltercombobox;
+ QComboBox* rowsfiltercomparatorcombobox;
QLineEdit* rowsfilterline;
QCheckBox* rowsfiltercasesensitive;
+ QCheckBox* rowsfilterwholeword;
QPushButton* rowsfilterbutton;
QPushButton* rowsfilterclearbutton;
@@ -140,6 +142,7 @@ class cMainWindow : public QMainWindow
cDrawPeptideWidget* drawpeptidewidget;
cSummaryPeaksTableWidget* summarytableofmatchedpeaks;
cImageWindow* imagewindow;
+ cChromatogramWindow* chromatogramwindow;
cParametersWidget* parameterswidget;
cHTMLExportDialog* htmlexportdialog;
@@ -187,6 +190,8 @@ private slots:
void showImageWindow();
+ void showChromatogramWindow();
+
void showGraph();
void showProperties();
@@ -207,7 +212,7 @@ private slots:
void reportSpectra();
- void updateSpectra();
+ void showIsomersStateChanged();
void rowDoubleClicked(const QModelIndex& item);
@@ -243,7 +248,9 @@ private slots:
void summaryPeaksTableCancelled();
- void updateSummaryPeaksTableFilter(int xmin, int xmax, int ymin, int ymax);
+ void summaryPeaksTableRowDoubleClicked(int rowid);
+
+ void updateSummaryPeaksTableFilterSlot(int xmin, int xmax, int ymin, int ymax);
//void showContextMenu(const QPoint &pt);
diff --git a/CycloBranch/gui/cMainWindowProxyModel.cpp b/CycloBranch/gui/cMainWindowProxyModel.cpp
index 5144453..c251917 100644
--- a/CycloBranch/gui/cMainWindowProxyModel.cpp
+++ b/CycloBranch/gui/cMainWindowProxyModel.cpp
@@ -2,16 +2,132 @@
cMainWindowProxyModel::cMainWindowProxyModel(QObject *parent) : QSortFilterProxyModel(parent) {
+ wholeword = false;
+}
+
+
+void cMainWindowProxyModel::initialize(QComboBox* rowsfiltercombobox, QComboBox* rowsfiltercomparatorcombobox) {
+ this->rowsfiltercombobox = rowsfiltercombobox;
+ this->rowsfiltercomparatorcombobox = rowsfiltercomparatorcombobox;
+}
+
+
+void cMainWindowProxyModel::setWholeWord(bool wholeword) {
+ this->wholeword = wholeword;
}
bool cMainWindowProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
- for (int i = 0; i < sourceModel()->columnCount(); i++) {
- if (sourceModel()->data(sourceModel()->index(sourceRow, i, sourceParent)).toString().contains(filterRegExp())) {
- return true;
+ if (filterRegExp().isEmpty()) {
+ return true;
+ }
+
+ int col = rowsfiltercombobox->currentIndex();
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::ByteArray) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() == filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() < filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() <= filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() > filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() >= filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::String) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (wholeword) {
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) == 0) {
+ return true;
+ }
+ }
+ else {
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().contains(filterRegExp())) {
+ return true;
+ }
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) < 0) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) <= 0) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) > 0) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) >= 0) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::Int) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() == filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() < filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() <= filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() > filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() >= filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ default:
+ break;
}
}
- return false;
+
+ return false;
}
@@ -19,12 +135,20 @@ bool cMainWindowProxyModel::lessThan(const QModelIndex &left, const QModelIndex
QVariant leftData = sourceModel()->data(left);
QVariant rightData = sourceModel()->data(right);
+ if (leftData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? false : true;
+ }
+
+ if (rightData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? true : false;
+ }
+
if (leftData.type() == QVariant::ByteArray) {
return leftData.toDouble() < rightData.toDouble();
}
if (leftData.type() == QVariant::String) {
- return leftData.toString() < rightData.toString();
+ return leftData.toString().toLower() < rightData.toString().toLower();
}
if (leftData.type() == QVariant::Int) {
diff --git a/CycloBranch/gui/cMainWindowProxyModel.h b/CycloBranch/gui/cMainWindowProxyModel.h
index d0e261d..9546fa7 100644
--- a/CycloBranch/gui/cMainWindowProxyModel.h
+++ b/CycloBranch/gui/cMainWindowProxyModel.h
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
/**
@@ -19,6 +20,12 @@ class cMainWindowProxyModel : public QSortFilterProxyModel {
Q_OBJECT
+private:
+
+ QComboBox* rowsfiltercombobox;
+ QComboBox* rowsfiltercomparatorcombobox;
+ bool wholeword;
+
public:
@@ -29,6 +36,21 @@ class cMainWindowProxyModel : public QSortFilterProxyModel {
cMainWindowProxyModel(QObject *parent = 0);
+ /**
+ \brief Initialize the model.
+ \param rowsfiltercombobox reference to the combobox with selection of columns
+ \param rowsfiltercomparatorcombobox reference to the combobox with selection of comparator
+ */
+ void initialize(QComboBox* rowsfiltercombobox, QComboBox* rowsfiltercomparatorcombobox);
+
+
+ /**
+ \brief Set whole word option.
+ \param wholeword true if whole words are matched, false otherwise
+ */
+ void setWholeWord(bool wholeword);
+
+
protected:
@@ -47,7 +69,7 @@ class cMainWindowProxyModel : public QSortFilterProxyModel {
\param right QModelIndex
\retval bool bool
*/
- bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
+ bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
};
diff --git a/CycloBranch/gui/cModificationsProxyModel.cpp b/CycloBranch/gui/cModificationsProxyModel.cpp
index 69f3a5d..2fe0239 100644
--- a/CycloBranch/gui/cModificationsProxyModel.cpp
+++ b/CycloBranch/gui/cModificationsProxyModel.cpp
@@ -2,19 +2,132 @@
cModificationsProxyModel::cModificationsProxyModel(QObject *parent) : QSortFilterProxyModel(parent) {
+ wholeword = false;
+}
+
+
+void cModificationsProxyModel::initialize(QComboBox* rowsfiltercombobox, QComboBox* rowsfiltercomparatorcombobox) {
+ this->rowsfiltercombobox = rowsfiltercombobox;
+ this->rowsfiltercomparatorcombobox = rowsfiltercomparatorcombobox;
+}
+
+
+void cModificationsProxyModel::setWholeWord(bool wholeword) {
+ this->wholeword = wholeword;
}
bool cModificationsProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
- int size = 4;
+ if (filterRegExp().isEmpty()) {
+ return true;
+ }
+
+ int col = rowsfiltercombobox->currentIndex() + 1;
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::ByteArray) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() == filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() < filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() <= filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() > filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() >= filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::String) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (wholeword) {
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) == 0) {
+ return true;
+ }
+ }
+ else {
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().contains(filterRegExp())) {
+ return true;
+ }
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) < 0) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) <= 0) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) > 0) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) >= 0) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
- for (int i = 1; i < size; i++) {
- if (sourceModel()->data(sourceModel()->index(sourceRow, i, sourceParent)).toString().contains(filterRegExp())) {
- return true;
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::Int) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() == filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() < filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() <= filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() > filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() >= filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ default:
+ break;
}
}
- return false;
+ return false;
}
@@ -22,6 +135,14 @@ bool cModificationsProxyModel::lessThan(const QModelIndex &left, const QModelInd
QVariant leftData = sourceModel()->data(left);
QVariant rightData = sourceModel()->data(right);
+ if (leftData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? false : true;
+ }
+
+ if (rightData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? true : false;
+ }
+
if ((left.column() == 0) || (left.column() == 4) || (left.column() == 5)) {
return leftData.toInt() < rightData.toInt();
}
@@ -31,7 +152,7 @@ bool cModificationsProxyModel::lessThan(const QModelIndex &left, const QModelInd
}
if (leftData.type() == QVariant::String) {
- return leftData.toString() < rightData.toString();
+ return leftData.toString().toLower() < rightData.toString().toLower();
}
return QSortFilterProxyModel::lessThan(left, right);
diff --git a/CycloBranch/gui/cModificationsProxyModel.h b/CycloBranch/gui/cModificationsProxyModel.h
index 717fb19..787a19a 100644
--- a/CycloBranch/gui/cModificationsProxyModel.h
+++ b/CycloBranch/gui/cModificationsProxyModel.h
@@ -9,6 +9,7 @@
#include
#include
+#include
#include
#include "core/cFragmentIons.h"
@@ -20,6 +21,12 @@ class cModificationsProxyModel : public QSortFilterProxyModel {
Q_OBJECT
+private:
+
+ QComboBox* rowsfiltercombobox;
+ QComboBox* rowsfiltercomparatorcombobox;
+ bool wholeword;
+
public:
@@ -30,6 +37,21 @@ class cModificationsProxyModel : public QSortFilterProxyModel {
cModificationsProxyModel(QObject *parent = 0);
+ /**
+ \brief Initialize the model.
+ \param rowsfiltercombobox reference to the combobox with selection of columns
+ \param rowsfiltercomparatorcombobox reference to the combobox with selection of comparator
+ */
+ void initialize(QComboBox* rowsfiltercombobox, QComboBox* rowsfiltercomparatorcombobox);
+
+
+ /**
+ \brief Set whole word option.
+ \param wholeword true if whole words are matched, false otherwise
+ */
+ void setWholeWord(bool wholeword);
+
+
protected:
@@ -48,7 +70,7 @@ class cModificationsProxyModel : public QSortFilterProxyModel {
\param right QModelIndex
\retval bool bool
*/
- bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
+ bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
};
diff --git a/CycloBranch/gui/cModificationsWidget.cpp b/CycloBranch/gui/cModificationsWidget.cpp
index 44a8785..8dcbdf1 100644
--- a/CycloBranch/gui/cModificationsWidget.cpp
+++ b/CycloBranch/gui/cModificationsWidget.cpp
@@ -30,40 +30,62 @@ cModificationsWidget::cModificationsWidget(QWidget* parent) {
menuEdit = new QMenu(tr("&Edit"), this);
menuHelp = new QMenu(tr("&Help"), this);
+ rowsfiltercombobox = new QComboBox();
+ rowsfiltercombobox->setToolTip("Column to be Searched");
+ rowsfiltercombobox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
+ rowsfiltercomparatorcombobox = new QComboBox();
+ rowsfiltercomparatorcombobox->setToolTip("Type of Comparison");
+ rowsfiltercomparatorcombobox->addItem("=");
+ rowsfiltercomparatorcombobox->addItem("<");
+ rowsfiltercomparatorcombobox->addItem("<=");
+ rowsfiltercomparatorcombobox->addItem(">");
+ rowsfiltercomparatorcombobox->addItem(">=");
+ rowsfiltercomparatorcombobox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
rowsfilterline = new QLineEdit();
- rowsfilterline->setMinimumWidth(250);
+ rowsfilterline->setMinimumWidth(300);
rowsfilterline->setToolTip("Text to Find");
rowsfiltercasesensitive = new QCheckBox();
rowsfiltercasesensitive->setToolTip("Case Sensitive");
+ rowsfilterwholeword = new QCheckBox();
+ rowsfilterwholeword->setToolTip("Whole Words Only");
+
rowsfilterbutton = new QPushButton("Filter");
rowsfilterbutton->setToolTip("Filter Search Results");
- rowsfilterbutton->setMinimumWidth(50);
+ rowsfilterbutton->setMinimumWidth(75);
rowsfilterclearbutton = new QPushButton("Reset");
rowsfilterclearbutton->setToolTip("Reset Search Results");
- rowsfilterclearbutton->setMinimumWidth(50);
+ rowsfilterclearbutton->setMinimumWidth(75);
rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
rowsfilterhbox = new QHBoxLayout();
+ rowsfilterhbox->addWidget(rowsfiltercombobox);
+ rowsfilterhbox->addSpacing(10);
+ rowsfilterhbox->addWidget(rowsfiltercomparatorcombobox);
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterline);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfiltercasesensitive);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
+ rowsfilterhbox->addWidget(rowsfilterwholeword);
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterbutton);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterclearbutton);
rowsfilterwidget = new QWidget();
rowsfilterwidget->setLayout(rowsfilterhbox);
- rowsfilterwidget->setMaximumWidth(420);
database = new QTableView(this);
databasemodel = new QStandardItemModel(0, 0, this);
proxymodel = new cModificationsProxyModel(this);
proxymodel->setSourceModel(databasemodel);
proxymodel->setDynamicSortFilter(false);
+ proxymodel->initialize(rowsfiltercombobox, rowsfiltercomparatorcombobox);
database->setModel(proxymodel);
database->setSortingEnabled(true);
@@ -204,8 +226,11 @@ cModificationsWidget::~cModificationsWidget() {
delete proxymodel;
delete database;
+ delete rowsfiltercombobox;
+ delete rowsfiltercomparatorcombobox;
delete rowsfilterline;
delete rowsfiltercasesensitive;
+ delete rowsfilterwholeword;
delete rowsfilterbutton;
delete rowsfilterclearbutton;
delete rowsfilterhbox;
@@ -265,6 +290,11 @@ void cModificationsWidget::resetHeader() {
databasemodel->setHorizontalHeaderItem(5, new QStandardItem("C-terminal"));
database->setItemDelegateForColumn(5, new cCheckBoxDelegate());
+ rowsfiltercombobox->clear();
+ for (int i = 1; i < databasemodel->columnCount() - 2; i++) {
+ rowsfiltercombobox->addItem(databasemodel->horizontalHeaderItem(i)->text());
+ }
+
database->horizontalHeader()->setStretchLastSection(true);
for (int i = 0; i < databasemodel->columnCount(); i++) {
database->resizeColumnToContents(i);
@@ -341,6 +371,10 @@ void cModificationsWidget::keyPressEvent(QKeyEvent *event) {
rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked());
}
+ if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_W)) {
+ rowsfilterwholeword->setChecked(!rowsfilterwholeword->isChecked());
+ }
+
event->accept();
}
@@ -392,7 +426,7 @@ void cModificationsWidget::openDatabase() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
database->setModel(0);
proxymodel->setSourceModel(0);
@@ -438,8 +472,8 @@ void cModificationsWidget::openDatabase() {
proxymodel->setSourceModel(databasemodel);
database->setModel(proxymodel);
- proxymodel->setSortRole(Qt::InitialSortOrderRole);
database->setSortingEnabled(true);
+ proxymodel->sort(-1);
for (int i = 0; i < databasemodel->columnCount(); i++) {
database->resizeColumnToContents(i);
@@ -484,7 +518,7 @@ bool cModificationsWidget::saveDatabase() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
fragmentDescription modification;
modifications.clear();
@@ -617,6 +651,7 @@ void cModificationsWidget::headerItemClicked(int index) {
void cModificationsWidget::filterRows() {
+ proxymodel->setWholeWord(rowsfilterwholeword->isChecked());
proxymodel->setFilterKeyColumn(-1);
proxymodel->setFilterCaseSensitivity(rowsfiltercasesensitive->isChecked()?Qt::CaseSensitive:Qt::CaseInsensitive);
proxymodel->setFilterFixedString(rowsfilterline->text());
@@ -629,6 +664,7 @@ void cModificationsWidget::resetFilter() {
database->horizontalHeader()->setSortIndicator(-1, Qt::AscendingOrder);
proxymodel->sort(-1);
+ proxymodel->setWholeWord(false);
proxymodel->setFilterKeyColumn(-1);
proxymodel->setFilterFixedString("");
}
@@ -682,7 +718,7 @@ void cModificationsWidget::importDatabase() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
database->setModel(0);
proxymodel->setSourceModel(0);
@@ -731,8 +767,8 @@ void cModificationsWidget::importDatabase() {
proxymodel->setSourceModel(databasemodel);
database->setModel(proxymodel);
- proxymodel->setSortRole(Qt::InitialSortOrderRole);
database->setSortingEnabled(true);
+ proxymodel->sort(-1);
for (int i = 0; i < databasemodel->columnCount(); i++) {
database->resizeColumnToContents(i);
diff --git a/CycloBranch/gui/cModificationsWidget.h b/CycloBranch/gui/cModificationsWidget.h
index 1c73aa6..494c1e9 100644
--- a/CycloBranch/gui/cModificationsWidget.h
+++ b/CycloBranch/gui/cModificationsWidget.h
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include "core/utilities.h"
#include "core/cFragmentIons.h"
@@ -95,8 +96,11 @@ class cModificationsWidget : public QMainWindow
QToolBar* toolbarFilter;
QWidget* rowsfilterwidget;
QHBoxLayout* rowsfilterhbox;
+ QComboBox* rowsfiltercombobox;
+ QComboBox* rowsfiltercomparatorcombobox;
QLineEdit* rowsfilterline;
QCheckBox* rowsfiltercasesensitive;
+ QCheckBox* rowsfilterwholeword;
QPushButton* rowsfilterbutton;
QPushButton* rowsfilterclearbutton;
diff --git a/CycloBranch/gui/cParametersWidget.cpp b/CycloBranch/gui/cParametersWidget.cpp
index 4884404..0d5b92f 100644
--- a/CycloBranch/gui/cParametersWidget.cpp
+++ b/CycloBranch/gui/cParametersWidget.cpp
@@ -58,7 +58,8 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
peaklistformlayout = new QFormLayout();
peptidetype = new QComboBox();
- peptidetype->setToolTip("Select the type of peptide best corresponding to the peaklist.");
+ peptidetype->setToolTip("Select the type of peptide or polyketide.");
+ peptidetype->setSizeAdjustPolicy(QComboBox::AdjustToContents);
peptidetype->addItem(tr("Linear"));
peptidetype->addItem(tr("Cyclic"));
peptidetype->addItem(tr("Branched"));
@@ -71,11 +72,11 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
peaklistline = new QLineEdit();
peaklistbutton = new QPushButton("Select");
#if OS_TYPE != WIN
- peaklistline->setToolTip("Select a file. Supported formats:\ntxt (peaklists),\nmgf (peaklists),\nmzML (profile spectra or peaklists),\nmzXML (peaklists),\nimzML (profile spectra or peaklists).");
- peaklistbutton->setToolTip("Select a file. Supported formats:\ntxt (peaklists),\nmgf (peaklists),\nmzML (profile spectra or peaklists),\nmzXML (peaklists),\nimzML (profile spectra or peaklists).");
+ peaklistline->setToolTip("Select a file. Supported file formats:\ntxt (peaklists),\nmgf (peaklists),\nmzML (profile spectra or peaklists),\nmzXML (peaklists),\nimzML (profile spectra or peaklists).");
+ peaklistbutton->setToolTip("Select a file. Supported file formats:\ntxt (peaklists),\nmgf (peaklists),\nmzML (profile spectra or peaklists),\nmzXML (peaklists),\nimzML (profile spectra or peaklists).");
#else
- peaklistline->setToolTip("Select a file. Supported formats:\ntxt (peaklists),\nmgf (peaklists),\nmzML (profile spectra or peaklists),\nmzXML (peaklists),\nbaf (profile spectra),\nimzML (profile spectra or peaklists),\nmis (deprecated),\nser (deprecated).");
- peaklistbutton->setToolTip("Select a file. Supported formats:\ntxt (peaklists),\nmgf (peaklists),\nmzML (profile spectra or peaklists),\nmzXML (peaklists),\nbaf (profile spectra),\nimzML (profile spectra or peaklists),\nmis (deprecated),\nser (deprecated).");
+ peaklistline->setToolTip("Select a file. Supported file formats:\ntxt (peaklists),\nmgf (peaklists),\nmzML (profile spectra or peaklists),\nmzXML (peaklists),\nimzML (profile spectra or peaklists),\nbaf (profile spectra),\ndat (peaklists),\nmis (deprecated),\nser (deprecated).");
+ peaklistbutton->setToolTip("Select a file. Supported file formats:\ntxt (peaklists),\nmgf (peaklists),\nmzML (profile spectra or peaklists),\nmzXML (peaklists),\nimzML (profile spectra or peaklists),\nbaf (profile spectra),\ndat (peaklists),\nmis (deprecated),\nser (deprecated).");
#endif
peaklistbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
peaklistlayout = new QHBoxLayout();
@@ -84,24 +85,24 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
peaklistformlayout->addRow(tr("File: "), peaklistlayout);
scannumber = new QSpinBox();
- scannumber->setToolTip("Number of a spectrum to be processed in a LC-MS/MS data file.");
+ scannumber->setToolTip("Number of a spectrum to be processed in a LC-MS/MS data file.\nThe number may be different from an internal scan number stored in the input data file.");
scannumber->setRange(1, 100000000);
scannumber->setSingleStep(1);
peaklistformlayout->addRow(tr("Scan no.: "), scannumber);
precursormass = new QDoubleSpinBox();
- precursormass->setToolTip("Enter the precursor mass-to-charge (m/z) ratio (a precursor m/z ratio in the peaklist file is ignored). The value will be automatically decharged.");
+ precursormass->setToolTip("Enter the precursor mass-to-charge (m/z) ratio.\nThe value is decharged automatically.\nThe precursor m/z ratio in the input peaklist file is ignored.");
precursormass->setDecimals(6);
precursormass->setRange(0, 100000);
precursormass->setSingleStep(1);
peaklistformlayout->addRow(tr("Precursor m/z Ratio: "), precursormass);
precursoradduct = new QLineEdit();
- precursoradduct->setToolTip("Enter the formula of a precursor ion adduct (e.g., Na, K, Li). H is used by default when empty.");
+ precursoradduct->setToolTip("Enter the formula of a precursor ion adduct (e.g., Na, K, Li).\nH is used by default if the field is empty.\nSee the manual for more options.");
peaklistformlayout->addRow(tr("Precursor Ion Adduct: "), precursoradduct);
precursorcharge = new QSpinBox();
- precursorcharge->setToolTip("Enter the precursor charge (a precursor charge in the peaklist file is ignored). Negative values are allowed.\nWhen mode is set up to \"Compare Peaklist(s) with Database - MS or MSI data\", the value determines the maximum charge of generated peaks.");
+ precursorcharge->setToolTip("Enter the charge of precursor ion. Negative values are allowed. The charge of precursor ion in the input peaklist file is ignored.\nIf the mode \"Compare Peaklist(s) with Database - MS or MSI data\" is used, the value determines the maximum charge of generated theoretical peaks.\nFor example, 3 means that theoretical peaks of compouds are generated with charges 1+, 2+, and 3+. The value -1 means that theoretical peaks of compounds are generated with charge 1-.");
precursorcharge->setRange(-100, 100);
precursorcharge->setSingleStep(1);
peaklistformlayout->addRow(tr("Charge: "), precursorcharge);
@@ -131,15 +132,21 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
peaklistformlayout->addRow(tr("m/z Error Tolerance for Deisotoping: "), masserrortolerancefordeisotoping);
minimumrelativeintensitythreshold = new QDoubleSpinBox();
- minimumrelativeintensitythreshold->setToolTip("Enter the threshold of relative intensity in %. Peaks having relative intensities below the threshold will be removed from the peaklist.");
+ minimumrelativeintensitythreshold->setToolTip("Enter the minimum threshold of relative intensity in %. Peaks with relative intensities below the threshold are removed from the peaklist.");
minimumrelativeintensitythreshold->setDecimals(3);
minimumrelativeintensitythreshold->setRange(0, 100);
minimumrelativeintensitythreshold->setSingleStep(1);
minimumrelativeintensitythreshold->setSuffix(" %");
peaklistformlayout->addRow(tr("Minimum Threshold of Relative Intensity: "), minimumrelativeintensitythreshold);
+ minimumabsoluteintensitythreshold = new QSpinBox();
+ minimumabsoluteintensitythreshold->setToolTip("Enter the minimum threshold of absolute intensity. Peaks with absolute intensities below the threshold are removed from the peaklist.");
+ minimumabsoluteintensitythreshold->setRange(0, INT32_MAX);
+ minimumabsoluteintensitythreshold->setSingleStep(100);
+ peaklistformlayout->addRow(tr("Minimum Threshold of Absolute Intensity: "), minimumabsoluteintensitythreshold);
+
minimummz = new QDoubleSpinBox();
- minimummz->setToolTip("Enter the minimum m/z ratio. Peaks having m/z ratios below the threshold will be removed from the peaklist.");
+ minimummz->setToolTip("Enter the minimum m/z ratio. Peaks with m/z ratios below the threshold are removed from the peaklist.");
minimummz->setDecimals(3);
minimummz->setRange(0, 10000);
minimummz->setSingleStep(1);
@@ -194,10 +201,6 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
maximumcumulativemass->setSingleStep(1);
brickdatabaseformlayout->addRow(tr("Maximum Cumulative Mass of Blocks: "), maximumcumulativemass);
- generatebrickspermutations = new QCheckBox();
- generatebrickspermutations->setToolTip("Permutations of combined blocks are generated when checked (e.g., when an edge corresponds to a combination of blocks leucine, proline and valine, the order of blocks can be LPV, LVP, PVL, PLV, VLP or VPL).\nIt is recommended to enable this option by default.");
- brickdatabaseformlayout->addRow(tr("Generate Permutations of Combined Blocks: "), generatebrickspermutations);
-
modificationsline = new QLineEdit();
modificationsline->setToolTip("Select the txt file containing a list of modifications.");
modificationsbutton = new QPushButton("Select");
@@ -215,18 +218,19 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
miscformlayout = new QFormLayout();
blindedges = new QComboBox();
- blindedges->setToolTip("The operation to be performed with edges forming incomplete paths:\nkeep (edges are kept - useful when you would like to see the whole de novo graph in 'View -> Graph');\nremove (edges are removed - speeds up the search);\nconnect (edges are connected - useful when you are looking for sequence tags).");
+ blindedges->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+ blindedges->setToolTip("The operation to be performed with edges forming incomplete paths:\nkeep (edges are kept - useful if you would like to see the whole de novo graph in 'View -> Graph');\nremove (edges are removed - speeds up the search);\nconnect (edges are connected - useful if you are looking for sequence tags).");
blindedges->addItem(tr("keep (you can see a complete de novo graph)"));
blindedges->addItem(tr("remove (speed up the search)"));
blindedges->addItem(tr("connect (allow detection of sequence tags)"));
miscformlayout->addRow(tr("Incomplete Paths in De Novo Graph: "), blindedges);
cyclicnterminus = new QCheckBox();
- cyclicnterminus->setToolTip("The water molecule is subtracted from all theoretical N-terminal fragment ions and the theoretical precursor mass.\nThis feature is useful when a linear peptide includes a small cycle close to the N-terminus.\nIf the linear polyketide is selected as the peptide type, the water molecule is subtracted only from the precursor ion.");
+ cyclicnterminus->setToolTip("The water molecule is subtracted from all theoretical N-terminal fragment ions and the theoretical precursor mass.\nThis feature is useful if a linear peptide includes a small cycle close to the N-terminus.\nIf the linear polyketide is selected as the peptide type, the water molecule is subtracted only from the precursor ion.");
miscformlayout->addRow(tr("Cyclic N-terminus: "), cyclicnterminus);
cycliccterminus = new QCheckBox();
- cycliccterminus->setToolTip("The water molecule is subtracted from all theoretical C-terminal fragment ions and the theoretical precursor mass.\nThis feature is useful when a linear peptide includes a small cycle close to the C-terminus.\nIf the linear polyketide is selected as the peptide type, the water molecule is subtracted only from the precursor ion.");
+ cycliccterminus->setToolTip("The water molecule is subtracted from all theoretical C-terminal fragment ions and the theoretical precursor mass.\nThis feature is useful if a linear peptide includes a small cycle close to the C-terminus.\nIf the linear polyketide is selected as the peptide type, the water molecule is subtracted only from the precursor ion.");
miscformlayout->addRow(tr("Cyclic C-terminus: "), cycliccterminus);
enablescrambling = new QCheckBox();
@@ -248,7 +252,8 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
applicationformlayout = new QFormLayout();
mode = new QComboBox();
- mode->setToolTip("'De Novo Search Engine' - the default mode of the application.\n'Compare Peaklist with Spectrum of Searched Sequence' - a theoretical spectrum is generated for the input 'Searched Sequence' and is compared with the peaklist.\n'Compare Peaklist with Database - MS/MS data' - a peaklist is compared with theoretical spectra generated from a database of sequences.\n'Compare Peaklist(s) with Database - MS or MSI data' - dereplication; compounds search; the peaklists are compared with theoretical peaks generated from a database of compounds/sequences.");
+ mode->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+ mode->setToolTip("'De Novo Search Engine' - the default mode of the application.\n'Compare Peaklist with Spectrum of Searched Sequence' - a theoretical spectrum is generated for the input 'Searched Sequence' and is compared with the peaklist.\n'Compare Peaklist with Database - MS/MS data' - a peaklist is compared with theoretical spectra generated from a database of sequences.\n'Compare Peaklist(s) with Database - MS or MSI data' - compound search; dereplication; the peaklists are compared with theoretical peaks generated from a database of compounds/sequences.");
mode->addItem(tr("De Novo Search Engine"));
mode->addItem(tr("Compare Peaklist with Spectrum of Searched Sequence"));
mode->addItem(tr("Compare Peaklist with Database - MS/MS data"));
@@ -267,12 +272,13 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
applicationformlayout->addRow(tr("Sequence/Compound Database File: "), sequencedatabaselayout);
maximumnumberofthreads = new QSpinBox();
- maximumnumberofthreads->setToolTip("A maximum number of threads used when the peaklist is compared with theoretical spectra of peptide sequence candidates.");
+ maximumnumberofthreads->setToolTip("A maximum number of threads used if the peaklist is compared with theoretical spectra of peptide sequence candidates.");
maximumnumberofthreads->setRange(1, 1024);
maximumnumberofthreads->setSingleStep(1);
applicationformlayout->addRow(tr("Maximum Number of Threads: "), maximumnumberofthreads);
scoretype = new QComboBox();
+ scoretype->setSizeAdjustPolicy(QComboBox::AdjustToContents);
scoretype->setToolTip("A score for peptide-spectrum matches.");
scoretype->addItem(tr("Number of b-ions"));
scoretype->addItem(tr("Number of b-ions + dehydrated b-ions"));
@@ -300,13 +306,20 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
applicationformlayout->addRow(tr("Ion Types in Theoretical Spectra: "), fragmentiontypes);
clearhitswithoutparent = new QCheckBox();
- clearhitswithoutparent->setToolTip("When checked, a hit of a peak is not considered when corresponding parent peak is not hit (e.g., a hit of a dehydrated b-ion is not considered as a hit when corresponding b-ion has not been hit).");
+ clearhitswithoutparent->setToolTip("If checked, a peak is not matched if the corresponding parent peak is not matched (e.g., a dehydrated b-ion is not matched if corresponding b-ion is not matched).");
applicationformlayout->addRow(tr("Remove Hits of Fragments without Hits of Parent Fragments: "), clearhitswithoutparent);
generateisotopepattern = new QCheckBox();
- generateisotopepattern->setToolTip("Full isotope patters of compounds are generated in theoretical spectra (MS and MSI). The FWHM value must be set up correctly.");
+ generateisotopepattern->setChecked(true);
+ generateisotopepattern->setToolTip("Full isotope patters of compounds are generated in theoretical spectra (MS and MSI).\nThe FWHM value is used when theoretical patterns are generated.");
applicationformlayout->addRow(tr("Generate Full Isotope Patterns: "), generateisotopepattern);
+ minimumpatternsize = new QSpinBox();
+ minimumpatternsize->setToolTip("The minimum number of peaks that must be matched in an isotope pattern of a compound to be reported (MS and MSI). \"Generate Full Isotope Patterns\" must be enabled.");
+ minimumpatternsize->setRange(1, 100);
+ minimumpatternsize->setSingleStep(1);
+ applicationformlayout->addRow(tr("Minimum Pattern Size: "), minimumpatternsize);
+
applicationgroupbox = new QGroupBox("Application");
applicationgroupbox->setLayout(applicationformlayout);
@@ -314,7 +327,7 @@ cParametersWidget::cParametersWidget(QWidget* parent) {
searchedsequenceformlayout = new QFormLayout();
searchedsequenceline = new QLineEdit();
- searchedsequenceline->setToolTip("A peptide sequence which you are searching for or a peptide sequence tag.\nA peptide sequence must be entered when \"Mode\" is set up to \"Compare Peaklist with Spectrum of Searched Sequence\".\nOtherwise, it is similar to the option \"Peptide Sequence Tag\" with a difference that a peptide sequence candidate is not removed from the search but it is just highlighted in an output report of peptide sequence candidates.");
+ searchedsequenceline->setToolTip("A peptide sequence which you are searching for or a peptide sequence tag.\nA peptide sequence must be entered if \"Mode\" is set up to \"Compare Peaklist with Spectrum of Searched Sequence\".\nOtherwise, the option is similar to \"Peptide Sequence Tag\" with a difference that a peptide sequence candidate is not removed from the search but it is just highlighted in the output list of peptide sequence candidates.");
searchedsequenceline->setMaxLength(5000);
searchedsequencebutton = new QPushButton("Edit");
searchedsequencebutton->setMinimumWidth(50);
@@ -434,6 +447,7 @@ cParametersWidget::~cParametersWidget() {
delete fragmentmasserrortolerance;
delete masserrortolerancefordeisotoping;
delete minimumrelativeintensitythreshold;
+ delete minimumabsoluteintensitythreshold;
delete minimummz;
delete fwhm;
delete peaklistformlayout;
@@ -446,7 +460,6 @@ cParametersWidget::~cParametersWidget() {
delete maximumbricksincombinationmiddle;
delete maximumbricksincombinationend;
delete maximumcumulativemass;
- delete generatebrickspermutations;
delete modificationsline;
delete modificationsbutton;
delete modificationslayout;
@@ -473,6 +486,7 @@ cParametersWidget::~cParametersWidget() {
delete fragmentiontypes;
delete clearhitswithoutparent;
delete generateisotopepattern;
+ delete minimumpatternsize;
delete applicationformlayout;
delete applicationgroupbox;
@@ -521,12 +535,18 @@ void cParametersWidget::closeEvent(QCloseEvent *event) {
void cParametersWidget::setSequence(int peptidetypeindex, QString sequence) {
+ if ((eModeType)mode->currentIndex() == dereplication) {
+ mode->setCurrentIndex(denovoengine);
+ }
peptidetype->setCurrentIndex(peptidetypeindex);
searchedsequenceline->setText(sequence);
}
void cParametersWidget::setTag(int peptidetypeindex, QString tag) {
+ if ((eModeType)mode->currentIndex() == dereplication) {
+ mode->setCurrentIndex(denovoengine);
+ }
peptidetype->setCurrentIndex(peptidetypeindex);
sequencetag->setText(tag);
}
@@ -579,6 +599,7 @@ void cParametersWidget::loadSettings() {
fragmentmasserrortolerance->setValue(settings.value("fragmentmasserrortolerance", 5.0).toDouble());
masserrortolerancefordeisotoping->setValue(settings.value("masserrortolerancefordeisotoping", 0).toDouble());
minimumrelativeintensitythreshold->setValue(settings.value("minimumrelativeintensitythreshold", 1).toDouble());
+ minimumabsoluteintensitythreshold->setValue(settings.value("minimumabsoluteintensitythreshold", 0).toUInt());
minimummz->setValue(settings.value("minimummz", 150).toDouble());
fwhm->setValue(settings.value("fwhm", 0.05).toDouble());
@@ -587,7 +608,6 @@ void cParametersWidget::loadSettings() {
maximumbricksincombinationmiddle->setValue(settings.value("maximumbricksincombinationmiddle", 1).toInt());
maximumbricksincombinationend->setValue(settings.value("maximumbricksincombinationend", 1).toInt());
maximumcumulativemass->setValue(settings.value("maximumcumulativemass", 0).toDouble());
- settings.value("generatebrickspermutations", 1).toInt() == 0 ? generatebrickspermutations->setChecked(false) : generatebrickspermutations->setChecked(true);
modificationsline->setText(settings.value("modificationsfile", "").toString());
blindedges->setCurrentIndex(settings.value("blindedges", 2).toInt());
@@ -610,7 +630,8 @@ void cParametersWidget::loadSettings() {
}
settings.value("clearhitswithoutparent", 0).toInt() == 0 ? clearhitswithoutparent->setChecked(false) : clearhitswithoutparent->setChecked(true);
- settings.value("generateisotopepattern", 0).toInt() == 0 ? generateisotopepattern->setChecked(false) : generateisotopepattern->setChecked(true);
+ settings.value("generateisotopepattern", 1).toInt() == 0 ? generateisotopepattern->setChecked(false) : generateisotopepattern->setChecked(true);
+ minimumpatternsize->setValue(settings.value("minimumpatternsize", 1).toInt());
searchedsequenceline->setText(settings.value("searchedsequence", "").toString());
searchedsequenceNtermmodif->setText(settings.value("searchedsequenceNtermmodif", "").toString());
@@ -644,6 +665,7 @@ void cParametersWidget::saveSettings() {
settings.setValue("fragmentmasserrortolerance", fragmentmasserrortolerance->value());
settings.setValue("masserrortolerancefordeisotoping", masserrortolerancefordeisotoping->value());
settings.setValue("minimumrelativeintensitythreshold", minimumrelativeintensitythreshold->value());
+ settings.setValue("minimumabsoluteintensitythreshold", minimumabsoluteintensitythreshold->value());
settings.setValue("minimummz", minimummz->value());
settings.setValue("fwhm", fwhm->value());
@@ -652,7 +674,6 @@ void cParametersWidget::saveSettings() {
settings.setValue("maximumbricksincombinationmiddle", maximumbricksincombinationmiddle->value());
settings.setValue("maximumbricksincombinationend", maximumbricksincombinationend->value());
settings.setValue("maximumcumulativemass", maximumcumulativemass->value());
- generatebrickspermutations->isChecked() ? settings.setValue("generatebrickspermutations", 1) : settings.setValue("generatebrickspermutations", 0);
settings.setValue("modificationsfile", modificationsline->text());
settings.setValue("blindedges", blindedges->currentIndex());
@@ -676,6 +697,7 @@ void cParametersWidget::saveSettings() {
clearhitswithoutparent->isChecked() ? settings.setValue("clearhitswithoutparent", 1) : settings.setValue("clearhitswithoutparent", 0);
generateisotopepattern->isChecked() ? settings.setValue("generateisotopepattern", 1) : settings.setValue("generateisotopepattern", 0);
+ settings.setValue("minimumpatternsize", minimumpatternsize->value());
settings.setValue("searchedsequence", searchedsequenceline->text());
settings.setValue("searchedsequenceNtermmodif", searchedsequenceNtermmodif->text());
@@ -702,7 +724,7 @@ void cParametersWidget::peaklistButtonReleased() {
#if OS_TYPE != WIN
QString filename = QFileDialog::getOpenFileName(this, tr("Select Peaklist..."), lastdirselectpeaklist, tr("Peak Lists (*.txt *.mgf *.mzML *.mzXML *.imzML)"));
#else
- QString filename = QFileDialog::getOpenFileName(this, tr("Select Peaklist..."), lastdirselectpeaklist, tr("Peak Lists (*.txt *.mgf *.mzML *.mzXML *.baf *.imzML *.mis ser)"));
+ QString filename = QFileDialog::getOpenFileName(this, tr("Select Peaklist..."), lastdirselectpeaklist, tr("Peak Lists (*.txt *.mgf *.mzML *.mzXML *.imzML *.baf *.dat *.mis ser)"));
#endif
if (!filename.isEmpty()) {
@@ -800,6 +822,7 @@ bool cParametersWidget::updateParameters() {
parameters.fragmentmasserrortolerance = fragmentmasserrortolerance->value();
parameters.masserrortolerancefordeisotoping = masserrortolerancefordeisotoping->value();
parameters.minimumrelativeintensitythreshold = minimumrelativeintensitythreshold->value();
+ parameters.minimumabsoluteintensitythreshold = minimumabsoluteintensitythreshold->value();
parameters.minimummz = minimummz->value();
parameters.fwhm = fwhm->value();
@@ -809,7 +832,6 @@ bool cParametersWidget::updateParameters() {
parameters.maximumbricksincombinationend = maximumbricksincombinationend->value();
parameters.maximumcumulativemass = maximumcumulativemass->value();
parameters.maximumbricksincombination = max(max(parameters.maximumbricksincombinationbegin, parameters.maximumbricksincombinationmiddle), parameters.maximumbricksincombinationend);
- parameters.generatebrickspermutations = generatebrickspermutations->isChecked();
parameters.modificationsfilename = modificationsline->text().toStdString();
parameters.blindedges = blindedges->currentIndex();
@@ -831,7 +853,7 @@ bool cParametersWidget::updateParameters() {
int start;
if ((eModeType)mode->currentIndex() == dereplication) {
- start = ms_hplus;
+ start = ms_Hplus;
}
else {
switch ((ePeptideType)peptidetype->currentIndex())
@@ -862,6 +884,7 @@ bool cParametersWidget::updateParameters() {
parameters.clearhitswithoutparent = clearhitswithoutparent->isChecked();
parameters.generateisotopepattern = generateisotopepattern->isChecked();
+ parameters.minimumpatternsize = minimumpatternsize->value();
parameters.searchedsequence = searchedsequenceline->text().toStdString();
parameters.originalsearchedsequence = parameters.searchedsequence;
@@ -895,6 +918,7 @@ void cParametersWidget::restoreParameters() {
fragmentmasserrortolerance->setValue(parameters.fragmentmasserrortolerance);
masserrortolerancefordeisotoping->setValue(parameters.masserrortolerancefordeisotoping);
minimumrelativeintensitythreshold->setValue(parameters.minimumrelativeintensitythreshold);
+ minimumabsoluteintensitythreshold->setValue(parameters.minimumabsoluteintensitythreshold);
minimummz->setValue(parameters.minimummz);
fwhm->setValue(parameters.fwhm);
@@ -903,7 +927,6 @@ void cParametersWidget::restoreParameters() {
maximumbricksincombinationmiddle->setValue(parameters.maximumbricksincombinationmiddle);
maximumbricksincombinationend->setValue(parameters.maximumbricksincombinationend);
maximumcumulativemass->setValue(parameters.maximumcumulativemass);
- generatebrickspermutations->setChecked(parameters.generatebrickspermutations);
modificationsline->setText(parameters.modificationsfilename.c_str());
blindedges->setCurrentIndex(parameters.blindedges);
@@ -922,7 +945,7 @@ void cParametersWidget::restoreParameters() {
int start;
if (parameters.mode == dereplication) {
- start = ms_hplus;
+ start = ms_Hplus;
}
else {
switch (parameters.peptidetype)
@@ -951,6 +974,7 @@ void cParametersWidget::restoreParameters() {
clearhitswithoutparent->setChecked(parameters.clearhitswithoutparent);
generateisotopepattern->setChecked(parameters.generateisotopepattern);
+ minimumpatternsize->setValue(parameters.minimumpatternsize);
searchedsequenceline->setText(parameters.searchedsequence.c_str());
searchedsequenceNtermmodif->setText(parameters.searchedsequenceNtermmodif.c_str());
@@ -1070,7 +1094,6 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
maximumbricksincombinationmiddle->setDisabled(false);
maximumbricksincombinationend->setDisabled(false);
maximumcumulativemass->setDisabled(false);
- generatebrickspermutations->setDisabled(false);
modificationsline->setDisabled(false);
modificationsbutton->setDisabled(false);
sequencedatabaseline->setDisabled(true);
@@ -1084,6 +1107,7 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
fragmentiontypes->setDisabled(false);
clearhitswithoutparent->setDisabled(false);
generateisotopepattern->setDisabled(true);
+ minimumpatternsize->setDisabled(true);
searchedsequenceline->setDisabled(false);
searchedsequencebutton->setDisabled(false);
@@ -1104,7 +1128,6 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
maximumbricksincombinationmiddle->setDisabled(true);
maximumbricksincombinationend->setDisabled(true);
maximumcumulativemass->setDisabled(true);
- generatebrickspermutations->setDisabled(true);
modificationsline->setDisabled(false);
modificationsbutton->setDisabled(false);
sequencedatabaseline->setDisabled(true);
@@ -1118,6 +1141,7 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
fragmentiontypes->setDisabled(false);
clearhitswithoutparent->setDisabled(false);
generateisotopepattern->setDisabled(true);
+ minimumpatternsize->setDisabled(true);
searchedsequenceline->setDisabled(false);
searchedsequencebutton->setDisabled(false);
@@ -1138,7 +1162,6 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
maximumbricksincombinationmiddle->setDisabled(true);
maximumbricksincombinationend->setDisabled(true);
maximumcumulativemass->setDisabled(true);
- generatebrickspermutations->setDisabled(true);
modificationsline->setDisabled(false);
modificationsbutton->setDisabled(false);
blindedges->setDisabled(true);
@@ -1152,6 +1175,7 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
fragmentiontypes->setDisabled(false);
clearhitswithoutparent->setDisabled(false);
generateisotopepattern->setDisabled(true);
+ minimumpatternsize->setDisabled(true);
searchedsequenceline->setDisabled(false);
searchedsequencebutton->setDisabled(false);
@@ -1172,7 +1196,6 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
maximumbricksincombinationmiddle->setDisabled(true);
maximumbricksincombinationend->setDisabled(true);
maximumcumulativemass->setDisabled(true);
- generatebrickspermutations->setDisabled(true);
modificationsline->setDisabled(true);
modificationsbutton->setDisabled(true);
blindedges->setDisabled(true);
@@ -1186,6 +1209,7 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
fragmentiontypes->setDisabled(false);
clearhitswithoutparent->setDisabled(true);
generateisotopepattern->setDisabled(false);
+ minimumpatternsize->setDisabled(false);
searchedsequenceline->setDisabled(true);
searchedsequencebutton->setDisabled(true);
@@ -1196,6 +1220,7 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) {
cyclicnterminus->setDisabled(true);
cycliccterminus->setDisabled(true);
enablescrambling->setDisabled(true);
+ regularblocksorder->setDisabled(true);
searchedsequenceNtermmodif->setDisabled(true);
searchedsequenceCtermmodif->setDisabled(true);
searchedsequenceTmodif->setDisabled(true);
@@ -1213,8 +1238,8 @@ void cParametersWidget::resetFragmentIonTypes() {
eFragmentIonType start, end;
if ((eModeType)mode->currentIndex() == dereplication) {
- start = ms_hplus;
- end = ms_MGa4H;
+ start = ms_Hplus;
+ end = ms_NH4plus;
}
else {
switch ((ePeptideType)peptidetype->currentIndex()) {
@@ -1251,7 +1276,7 @@ void cParametersWidget::resetFragmentIonTypes() {
fragmentiontypes->getList()->addItem(tr(parameters.fragmentdefinitions[(eFragmentIonType)i].name.c_str()));
if ((eModeType)mode->currentIndex() == dereplication) {
- if ((eFragmentIonType)i == ms_hplus) {
+ if ((eFragmentIonType)i == ms_Hplus) {
fragmentiontypes->getList()->item(i-start)->setSelected(true);
}
}
diff --git a/CycloBranch/gui/cParametersWidget.h b/CycloBranch/gui/cParametersWidget.h
index 0080a60..a06e4a5 100644
--- a/CycloBranch/gui/cParametersWidget.h
+++ b/CycloBranch/gui/cParametersWidget.h
@@ -139,6 +139,7 @@ class cParametersWidget : public QWidget
QDoubleSpinBox* fragmentmasserrortolerance;
QDoubleSpinBox* masserrortolerancefordeisotoping;
QDoubleSpinBox* minimumrelativeintensitythreshold;
+ QSpinBox* minimumabsoluteintensitythreshold;
QDoubleSpinBox* minimummz;
QDoubleSpinBox* fwhm;
@@ -151,7 +152,6 @@ class cParametersWidget : public QWidget
QSpinBox* maximumbricksincombinationmiddle;
QSpinBox* maximumbricksincombinationend;
QDoubleSpinBox* maximumcumulativemass;
- QCheckBox* generatebrickspermutations;
QLineEdit* modificationsline;
QPushButton* modificationsbutton;
QHBoxLayout* modificationslayout;
@@ -179,6 +179,7 @@ class cParametersWidget : public QWidget
cFragmentIonsListWidget* fragmentiontypes;
QCheckBox* clearhitswithoutparent;
QCheckBox* generateisotopepattern;
+ QSpinBox* minimumpatternsize;
QGroupBox* searchedsequencegroupbox;
QFormLayout* searchedsequenceformlayout;
diff --git a/CycloBranch/gui/cSequenceDatabaseProxyModel.cpp b/CycloBranch/gui/cSequenceDatabaseProxyModel.cpp
index 71952a0..8965a8f 100644
--- a/CycloBranch/gui/cSequenceDatabaseProxyModel.cpp
+++ b/CycloBranch/gui/cSequenceDatabaseProxyModel.cpp
@@ -2,19 +2,178 @@
cSequenceDatabaseProxyModel::cSequenceDatabaseProxyModel(QObject *parent) : QSortFilterProxyModel(parent) {
+ wholeword = false;
+}
+
+
+void cSequenceDatabaseProxyModel::initialize(QComboBox* rowsfiltercombobox, QComboBox* rowsfiltercomparatorcombobox) {
+ this->rowsfiltercombobox = rowsfiltercombobox;
+ this->rowsfiltercomparatorcombobox = rowsfiltercomparatorcombobox;
+}
+
+
+void cSequenceDatabaseProxyModel::setWholeWord(bool wholeword) {
+ this->wholeword = wholeword;
}
bool cSequenceDatabaseProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
- int size = 10;
+ if (filterRegExp().isEmpty()) {
+ return true;
+ }
+
+ int col = rowsfiltercombobox->currentIndex() + 1;
+
+ if (col == 1) {
- for (int i = 2; i < size; i++) {
- if (sourceModel()->data(sourceModel()->index(sourceRow, i, sourceParent)).toString().contains(filterRegExp())) {
- return true;
+ QString qstr = getStringFromPeptideType((ePeptideType)sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt()).c_str();
+
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (wholeword) {
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) == 0) {
+ return true;
+ }
+ }
+ else {
+ if (qstr.contains(filterRegExp())) {
+ return true;
+ }
+ }
+ break;
+ case 1:
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) < 0) {
+ return true;
+ }
+ break;
+ case 2:
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) <= 0) {
+ return true;
+ }
+ break;
+ case 3:
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) > 0) {
+ return true;
+ }
+ break;
+ case 4:
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) >= 0) {
+ return true;
+ }
+ break;
+ default:
+ break;
}
+
}
+ else {
- return false;
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::ByteArray) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() == filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() < filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() <= filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() > filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() >= filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::String) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (wholeword) {
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) == 0) {
+ return true;
+ }
+ }
+ else {
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().contains(filterRegExp())) {
+ return true;
+ }
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) < 0) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) <= 0) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) > 0) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().compare(filterRegExp().pattern(), filterCaseSensitivity()) >= 0) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::Int) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() == filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() < filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() <= filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() > filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() >= filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ }
+
+ return false;
}
@@ -22,6 +181,14 @@ bool cSequenceDatabaseProxyModel::lessThan(const QModelIndex &left, const QModel
QVariant leftData = sourceModel()->data(left);
QVariant rightData = sourceModel()->data(right);
+ if (leftData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? false : true;
+ }
+
+ if (rightData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? true : false;
+ }
+
if (left.column() == 0) {
return leftData.toInt() < rightData.toInt();
}
@@ -35,7 +202,7 @@ bool cSequenceDatabaseProxyModel::lessThan(const QModelIndex &left, const QModel
}
if (leftData.type() == QVariant::String) {
- return leftData.toString() < rightData.toString();
+ return leftData.toString().toLower() < rightData.toString().toLower();
}
return QSortFilterProxyModel::lessThan(left, right);
diff --git a/CycloBranch/gui/cSequenceDatabaseProxyModel.h b/CycloBranch/gui/cSequenceDatabaseProxyModel.h
index d2f8b62..46067cd 100644
--- a/CycloBranch/gui/cSequenceDatabaseProxyModel.h
+++ b/CycloBranch/gui/cSequenceDatabaseProxyModel.h
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include "core/cFragmentIons.h"
@@ -20,6 +21,12 @@ class cSequenceDatabaseProxyModel : public QSortFilterProxyModel {
Q_OBJECT
+private:
+
+ QComboBox* rowsfiltercombobox;
+ QComboBox* rowsfiltercomparatorcombobox;
+ bool wholeword;
+
public:
@@ -30,6 +37,21 @@ class cSequenceDatabaseProxyModel : public QSortFilterProxyModel {
cSequenceDatabaseProxyModel(QObject *parent = 0);
+ /**
+ \brief Initialize the model.
+ \param rowsfiltercombobox reference to the combobox with selection of columns
+ \param rowsfiltercomparatorcombobox reference to the combobox with selection of comparator
+ */
+ void initialize(QComboBox* rowsfiltercombobox, QComboBox* rowsfiltercomparatorcombobox);
+
+
+ /**
+ \brief Set whole word option.
+ \param wholeword true if whole words are matched, false otherwise
+ */
+ void setWholeWord(bool wholeword);
+
+
protected:
diff --git a/CycloBranch/gui/cSequenceDatabaseWidget.cpp b/CycloBranch/gui/cSequenceDatabaseWidget.cpp
index c5f1909..a6c80d4 100644
--- a/CycloBranch/gui/cSequenceDatabaseWidget.cpp
+++ b/CycloBranch/gui/cSequenceDatabaseWidget.cpp
@@ -32,40 +32,62 @@ cSequenceDatabaseWidget::cSequenceDatabaseWidget(QWidget* parent) {
menuEdit = new QMenu(tr("&Edit"), this);
menuHelp = new QMenu(tr("&Help"), this);
+ rowsfiltercombobox = new QComboBox();
+ rowsfiltercombobox->setToolTip("Column to be Searched");
+ rowsfiltercombobox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
+ rowsfiltercomparatorcombobox = new QComboBox();
+ rowsfiltercomparatorcombobox->setToolTip("Type of Comparison");
+ rowsfiltercomparatorcombobox->addItem("=");
+ rowsfiltercomparatorcombobox->addItem("<");
+ rowsfiltercomparatorcombobox->addItem("<=");
+ rowsfiltercomparatorcombobox->addItem(">");
+ rowsfiltercomparatorcombobox->addItem(">=");
+ rowsfiltercomparatorcombobox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
rowsfilterline = new QLineEdit();
- rowsfilterline->setMinimumWidth(250);
+ rowsfilterline->setMinimumWidth(300);
rowsfilterline->setToolTip("Text to Find");
rowsfiltercasesensitive = new QCheckBox();
rowsfiltercasesensitive->setToolTip("Case Sensitive");
+ rowsfilterwholeword = new QCheckBox();
+ rowsfilterwholeword->setToolTip("Whole Words Only");
+
rowsfilterbutton = new QPushButton("Filter");
rowsfilterbutton->setToolTip("Filter Search Results");
- rowsfilterbutton->setMinimumWidth(50);
+ rowsfilterbutton->setMinimumWidth(75);
rowsfilterclearbutton = new QPushButton("Reset");
rowsfilterclearbutton->setToolTip("Reset Search Results");
- rowsfilterclearbutton->setMinimumWidth(50);
+ rowsfilterclearbutton->setMinimumWidth(75);
rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
rowsfilterhbox = new QHBoxLayout();
+ rowsfilterhbox->addWidget(rowsfiltercombobox);
+ rowsfilterhbox->addSpacing(10);
+ rowsfilterhbox->addWidget(rowsfiltercomparatorcombobox);
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterline);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfiltercasesensitive);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
+ rowsfilterhbox->addWidget(rowsfilterwholeword);
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterbutton);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterclearbutton);
rowsfilterwidget = new QWidget();
rowsfilterwidget->setLayout(rowsfilterhbox);
- rowsfilterwidget->setMaximumWidth(420);
database = new QTableView(this);
databasemodel = new QStandardItemModel(0, 0, this);
proxymodel = new cSequenceDatabaseProxyModel(this);
proxymodel->setSourceModel(databasemodel);
proxymodel->setDynamicSortFilter(false);
+ proxymodel->initialize(rowsfiltercombobox, rowsfiltercomparatorcombobox);
database->setModel(proxymodel);
database->setSortingEnabled(true);
@@ -209,8 +231,11 @@ cSequenceDatabaseWidget::~cSequenceDatabaseWidget() {
delete proxymodel;
delete database;
+ delete rowsfiltercombobox;
+ delete rowsfiltercomparatorcombobox;
delete rowsfilterline;
delete rowsfiltercasesensitive;
+ delete rowsfilterwholeword;
delete rowsfilterbutton;
delete rowsfilterclearbutton;
delete rowsfilterhbox;
@@ -289,6 +314,11 @@ void cSequenceDatabaseWidget::resetHeader() {
databasemodel->setHorizontalHeaderItem(10, new QStandardItem("View"));
database->setItemDelegateForColumn(10, new cViewButtonDelegate());
+ rowsfiltercombobox->clear();
+ for (int i = 1; i < databasemodel->columnCount() - 1; i++) {
+ rowsfiltercombobox->addItem(databasemodel->horizontalHeaderItem(i)->text());
+ }
+
database->horizontalHeader()->setStretchLastSection(true);
for (int i = 0; i < databasemodel->columnCount(); i++) {
database->resizeColumnToContents(i);
@@ -436,6 +466,10 @@ void cSequenceDatabaseWidget::keyPressEvent(QKeyEvent *event) {
rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked());
}
+ if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_W)) {
+ rowsfilterwholeword->setChecked(!rowsfilterwholeword->isChecked());
+ }
+
event->accept();
}
@@ -489,7 +523,7 @@ void cSequenceDatabaseWidget::openDatabase() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
database->setModel(0);
proxymodel->setSourceModel(0);
@@ -556,8 +590,8 @@ void cSequenceDatabaseWidget::openDatabase() {
proxymodel->setSourceModel(databasemodel);
database->setModel(proxymodel);
- proxymodel->setSortRole(Qt::InitialSortOrderRole);
database->setSortingEnabled(true);
+ proxymodel->sort(-1);
for (int i = 0; i < databasemodel->columnCount(); i++) {
database->resizeColumnToContents(i);
@@ -602,7 +636,7 @@ bool cSequenceDatabaseWidget::saveDatabase() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
// close an editor of a combobox
database->setDisabled(true);
@@ -786,6 +820,7 @@ void cSequenceDatabaseWidget::headerItemClicked(int index) {
void cSequenceDatabaseWidget::filterRows() {
+ proxymodel->setWholeWord(rowsfilterwholeword->isChecked());
proxymodel->setFilterKeyColumn(-1);
proxymodel->setFilterCaseSensitivity(rowsfiltercasesensitive->isChecked()?Qt::CaseSensitive:Qt::CaseInsensitive);
proxymodel->setFilterFixedString(rowsfilterline->text());
@@ -798,6 +833,7 @@ void cSequenceDatabaseWidget::resetFilter() {
database->horizontalHeader()->setSortIndicator(-1, Qt::AscendingOrder);
proxymodel->sort(-1);
+ proxymodel->setWholeWord(false);
proxymodel->setFilterKeyColumn(-1);
proxymodel->setFilterFixedString("");
}
@@ -853,7 +889,7 @@ void cSequenceDatabaseWidget::importDatabase() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
database->setModel(0);
proxymodel->setSourceModel(0);
@@ -923,8 +959,8 @@ void cSequenceDatabaseWidget::importDatabase() {
proxymodel->setSourceModel(databasemodel);
database->setModel(proxymodel);
- proxymodel->setSortRole(Qt::InitialSortOrderRole);
database->setSortingEnabled(true);
+ proxymodel->sort(-1);
for (int i = 0; i < databasemodel->columnCount(); i++) {
database->resizeColumnToContents(i);
diff --git a/CycloBranch/gui/cSequenceDatabaseWidget.h b/CycloBranch/gui/cSequenceDatabaseWidget.h
index 92ae214..75fee82 100644
--- a/CycloBranch/gui/cSequenceDatabaseWidget.h
+++ b/CycloBranch/gui/cSequenceDatabaseWidget.h
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include "core/utilities.h"
#include "core/cSequenceDatabase.h"
@@ -104,8 +105,11 @@ class cSequenceDatabaseWidget : public QMainWindow
QToolBar* toolbarFilter;
QWidget* rowsfilterwidget;
QHBoxLayout* rowsfilterhbox;
+ QComboBox* rowsfiltercombobox;
+ QComboBox* rowsfiltercomparatorcombobox;
QLineEdit* rowsfilterline;
QCheckBox* rowsfiltercasesensitive;
+ QCheckBox* rowsfilterwholeword;
QPushButton* rowsfilterbutton;
QPushButton* rowsfilterclearbutton;
diff --git a/CycloBranch/gui/cSpectrumDetailProxyModel.cpp b/CycloBranch/gui/cSpectrumDetailProxyModel.cpp
index aa7a732..1c71e4e 100644
--- a/CycloBranch/gui/cSpectrumDetailProxyModel.cpp
+++ b/CycloBranch/gui/cSpectrumDetailProxyModel.cpp
@@ -21,8 +21,10 @@ bool cSpectrumDetailProxyModel::filterAcceptsRow(int sourceRow, const QModelInde
if (hidematched
&& ((QStandardItemModel *)sourceModel())->item(sourceRow, 1)
&& ((QStandardItemModel *)sourceModel())->item(sourceRow, 2)
+ && ((QStandardItemModel *)sourceModel())->item(sourceRow, 3)
&& !((QStandardItemModel *)sourceModel())->item(sourceRow, 1)->data(Qt::DisplayRole).toString().isEmpty()
&& !((QStandardItemModel *)sourceModel())->item(sourceRow, 2)->data(Qt::DisplayRole).toString().isEmpty()
+ && !((QStandardItemModel *)sourceModel())->item(sourceRow, 3)->data(Qt::DisplayRole).toString().isEmpty()
) {
show = false;
}
@@ -30,8 +32,10 @@ bool cSpectrumDetailProxyModel::filterAcceptsRow(int sourceRow, const QModelInde
if (hideunmatched && (
(((QStandardItemModel *)sourceModel())->item(sourceRow, 1) == 0)
|| (((QStandardItemModel *)sourceModel())->item(sourceRow, 2) == 0)
+ || (((QStandardItemModel *)sourceModel())->item(sourceRow, 3) == 0)
|| ((QStandardItemModel *)sourceModel())->item(sourceRow, 1)->data(Qt::DisplayRole).toString().isEmpty()
|| ((QStandardItemModel *)sourceModel())->item(sourceRow, 2)->data(Qt::DisplayRole).toString().isEmpty()
+ || ((QStandardItemModel *)sourceModel())->item(sourceRow, 3)->data(Qt::DisplayRole).toString().isEmpty()
)) {
show = false;
}
@@ -48,12 +52,20 @@ bool cSpectrumDetailProxyModel::lessThan(const QModelIndex &left, const QModelIn
QVariant leftData = sourceModel()->data(left);
QVariant rightData = sourceModel()->data(right);
+ if (leftData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? false : true;
+ }
+
+ if (rightData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? true : false;
+ }
+
if (leftData.type() == QVariant::ByteArray) {
return leftData.toDouble() < rightData.toDouble();
}
if (leftData.type() == QVariant::String) {
- return leftData.toString() < rightData.toString();
+ return leftData.toString().toLower() < rightData.toString().toLower();
}
return QSortFilterProxyModel::lessThan(left, right);
diff --git a/CycloBranch/gui/cSpectrumDetailProxyModel.h b/CycloBranch/gui/cSpectrumDetailProxyModel.h
index 39e1a85..c02232a 100644
--- a/CycloBranch/gui/cSpectrumDetailProxyModel.h
+++ b/CycloBranch/gui/cSpectrumDetailProxyModel.h
@@ -61,7 +61,8 @@ class cSpectrumDetailProxyModel : public QSortFilterProxyModel {
\param right QModelIndex
\retval bool bool
*/
- bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
+ bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
+
};
diff --git a/CycloBranch/gui/cSpectrumDetailWidget.cpp b/CycloBranch/gui/cSpectrumDetailWidget.cpp
index 5e966de..ae4d436 100644
--- a/CycloBranch/gui/cSpectrumDetailWidget.cpp
+++ b/CycloBranch/gui/cSpectrumDetailWidget.cpp
@@ -11,7 +11,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -43,7 +42,7 @@ cSpectrumDetailWidget& cSpectrumDetailWidget::operator=(const cSpectrumDetailWid
}
if (parameters && sd.preparedToShow) {
- prepareToShow(parameters->peptidetype);
+ prepareToShow(parameters->peptidetype, actionShowIsomers);
}
setWindowTitle(sd.windowTitle());
@@ -151,7 +150,7 @@ string cSpectrumDetailWidget::getDetailsAsHTMLString() {
}
-string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoreticalpeaks, bool unmatchedexperimentalpeaks) {
+string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoreticalpeaks, bool unmatchedexperimentalpeaks, bool exportisomers) {
string s = "";
int rowcount, columncount, thpeakscount;
int secondspace, langle, rangle, tmp1, tmp2;
@@ -159,6 +158,8 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
cPeak* peak;
bool isred;
string tdwidth;
+ string desc;
+ size_t pos;
if (theoreticalspectrum && parameters) {
@@ -166,7 +167,7 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
if (parameters->mode == dereplication) {
if (parameters->generateisotopepattern) {
- columncount = 10;
+ columncount = 12;
}
else {
columncount = 9;
@@ -179,7 +180,12 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
tdwidth = to_string(100/columncount);
if (parameters->mode == dereplication) {
- s += "Ion Type | ";
+ if (parameters->generateisotopepattern) {
+ s += "Pattern Type | ";
+ }
+ else {
+ s += "Ion Type | ";
+ }
}
else {
s += "Fragment Type | ";
@@ -197,6 +203,10 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
s += "Error [ppm] | ";
if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ s += "Score | ";
+ s += "FDR | ";
+ }
s += "Summary Formula | ";
s += "Name | ";
s += "Reference | ";
@@ -207,22 +217,10 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
s += "";
- if (parameters->mode == dereplication) {
- thpeaks = new cPeaksList();
- for (int i = 0; i < (int)theoreticalspectrum->getTheoreticalPeaks()->size(); i++) {
- peak = &((*(theoreticalspectrum->getTheoreticalPeaks()))[i]);
- if (peak->matchedmz > 0) {
- thpeaks->add(*peak);
- }
- }
- thpeakscount = thpeaks->size();
- }
- else {
- thpeaks = theoreticalspectrum->getTheoreticalPeaks();
- thpeakscount = theoreticalspectrum->getTheoreticalPeaks()->size();
- }
+ thpeaks = theoreticalspectrum->getTheoreticalPeaks();
+ thpeakscount = theoreticalspectrum->getTheoreticalPeaks()->size();
- rowcount = thpeakscount + theoreticalspectrum->getUnmatchedPeaksCount();
+ rowcount = thpeakscount + theoreticalspectrum->getUnmatchedExperimentalPeaksCount();
// theoretical peaks
for (int i = 0; i < thpeakscount; i++) {
@@ -263,9 +261,20 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedrelativeintensity)), isred);
s += printHTMLTableCell(QVariant(cropDecimalsByteArray(peak->matchedabsoluteintensity)).toString().toStdString(), isred);
s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedppm)), isred);
+ if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(theoreticalspectrum->getTargetPatternScore(peak->groupid))), isred);
+ s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(theoreticalspectrum->getTargetPatternFDR(peak->groupid))), isred);
+ }
+ }
}
else {
s += " | | | | ";
+ if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ s += " | | ";
+ }
+ }
}
if (parameters->mode == dereplication) {
@@ -287,8 +296,13 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
}
}
else {
- if (peak->description.find(':') + 2 < peak->description.size()) {
- s += printHTMLTableCell(peak->description.substr(peak->description.find(':') + 2), isred);
+ pos = peak->description.find(':');
+ if ((pos != string::npos) && (pos + 2 < peak->description.size())) {
+ desc = peak->description.substr(pos + 2);
+ if (!exportisomers) {
+ stripIsomers(desc);
+ }
+ s += printHTMLTableCell(desc, isred);
}
else {
s += " | ";
@@ -317,6 +331,9 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
s += " | | ";
if (parameters->mode == dereplication) {
s += " | | ";
+ if (parameters->generateisotopepattern) {
+ s += " | | ";
+ }
}
s += "";
}
@@ -324,23 +341,21 @@ string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoretica
s += "";
- if (parameters->mode == dereplication) {
- delete thpeaks;
- }
-
}
return s;
}
-string cSpectrumDetailWidget::getPartialPeaksTableAsHTMLString(int id) {
+string cSpectrumDetailWidget::getPartialPeaksTableAsHTMLString(int id, bool exportisomers) {
string s = "";
int thpeakscount;
int secondspace, langle, rangle, tmp1, tmp2;
cPeaksList* thpeaks;
cPeak* peak;
bool isred;
+ string desc;
+ size_t pos;
if (theoreticalspectrum && parameters) {
@@ -414,9 +429,20 @@ string cSpectrumDetailWidget::getPartialPeaksTableAsHTMLString(int id) {
s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedrelativeintensity)), isred);
s += printHTMLTableCell(QVariant(cropDecimalsByteArray(peak->matchedabsoluteintensity)).toString().toStdString(), isred);
s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedppm)), isred);
+ if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(theoreticalspectrum->getTargetPatternScore(peak->groupid))), isred);
+ s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(theoreticalspectrum->getTargetPatternFDR(peak->groupid))), isred);
+ }
+ }
}
else {
s += " | | | | ";
+ if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ s += " | | ";
+ }
+ }
}
if (parameters->mode == dereplication) {
@@ -438,8 +464,13 @@ string cSpectrumDetailWidget::getPartialPeaksTableAsHTMLString(int id) {
}
}
else {
- if (peak->description.find(':') + 2 < peak->description.size()) {
- s += printHTMLTableCell(peak->description.substr(peak->description.find(':') + 2), isred);
+ pos = peak->description.find(':');
+ if ((pos != string::npos) && (pos + 2 < peak->description.size())) {
+ desc = peak->description.substr(pos + 2);
+ if (!exportisomers) {
+ stripIsomers(desc);
+ }
+ s += printHTMLTableCell(desc, isred);
}
else {
s += " | ";
@@ -482,6 +513,7 @@ cSpectrumDetailWidget::~cSpectrumDetailWidget() {
delete labelmz;
delete minmz;
+ delete labelseparator;
delete maxmz;
delete setmzinterval;
delete resetmzinterval;
@@ -529,21 +561,32 @@ cSpectrumDetailWidget::~cSpectrumDetailWidget() {
delete vsplitter;
+ delete actionExportTable;
delete actionExportSpectrum;
+ delete actionCloseWindow;
delete actionFind;
delete actionPrevious;
delete actionNext;
delete actionZoomIn;
delete actionZoomOut;
delete actionZoomReset;
+ delete actionAbsoluteIntensity;
delete actionHideMatched;
delete actionHideUnmatched;
delete actionHideScrambled;
delete actionMouseMzSelection;
+ delete actionHTMLDocumentation;
delete finddialog;
delete exportdialog;
+ delete menuFile;
+ delete menuFind;
+ delete menuView;
+ delete menuHelp;
+
+ delete menuBar;
+
}
}
@@ -554,10 +597,14 @@ void cSpectrumDetailWidget::closeEvent(QCloseEvent *event) {
}
-void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
+void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype, QAction* actionShowIsomers) {
if (!preparedToShow) {
+ connect(actionShowIsomers, SIGNAL(triggered()), this, SLOT(showIsomersStateChanged()));
+ this->actionShowIsomers = actionShowIsomers;
+ reportisomers = actionShowIsomers->isChecked();
+
vsplitter = new QSplitter();
vsplitter->setOrientation(Qt::Vertical);
@@ -594,41 +641,52 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
spectrumscene = new cSpectrumSceneWidget(this);
- toolbarExport = addToolBar(tr("Export"));
- toolbarExport->setMovable(false);
- toolbarExport->setFloatable(false);
- actionExportTable = new QAction(QIcon(":/images/icons/62.png"), tr("Export Table to CSV"), this);
+ menuBar = new QMenuBar(this);
+ menuBar->setNativeMenuBar(false);
+ menuFile = new QMenu(tr("&File"), this);
+ menuFind = new QMenu(tr("Fin&d"), this);
+ menuView = new QMenu(tr("&View"), this);
+ menuHelp = new QMenu(tr("&Help"), this);
+
+
+ toolbarFile = addToolBar(tr("File"));
+
+ actionExportTable = new QAction(QIcon(":/images/icons/62.png"), tr("&Export Table to CSV"), this);
actionExportTable->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
actionExportTable->setToolTip("Export Table to CSV (Ctrl + E)");
- toolbarExport->addAction(actionExportTable);
+ toolbarFile->addAction(actionExportTable);
connect(actionExportTable, SIGNAL(triggered()), this, SLOT(exportTableToCSV()));
- actionExportSpectrum = new QAction(QIcon(":/images/icons/66.png"), tr("Export Image"), this);
- actionExportSpectrum->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
- actionExportSpectrum->setToolTip("Export Image (Ctrl + I)");
- toolbarExport->addAction(actionExportSpectrum);
+ actionExportSpectrum = new QAction(QIcon(":/images/icons/66.png"), tr("Export Ima&ge"), this);
+ actionExportSpectrum->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
+ actionExportSpectrum->setToolTip("Export Image (Ctrl + G)");
+ toolbarFile->addAction(actionExportSpectrum);
connect(actionExportSpectrum, SIGNAL(triggered()), this, SLOT(openExportImageDialog()));
+ actionCloseWindow = new QAction(QIcon(":/images/icons/33.png"), tr("&Close"), this);
+ actionCloseWindow->setShortcut(QKeySequence(Qt::Key_Escape));
+ actionCloseWindow->setToolTip("Close (Esc)");
+ toolbarFile->addAction(actionCloseWindow);
+ connect(actionCloseWindow, SIGNAL(triggered()), this, SLOT(closeWindow()));
+
toolbarFind = addToolBar(tr("Find"));
- toolbarFind->setMovable(false);
- toolbarFind->setFloatable(false);
- actionFind = new QAction(QIcon(":/images/icons/65.png"), tr("Find Text"), this);
+ actionFind = new QAction(QIcon(":/images/icons/65.png"), tr("&Find Text"), this);
actionFind->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
actionFind->setToolTip("Find Text (Ctrl + F)");
toolbarFind->addAction(actionFind);
connect(actionFind, SIGNAL(triggered()), this, SLOT(openFindDialog()));
- actionPrevious = new QAction(QIcon(":/images/icons/56.png"), tr("Find Previous"), this);
+ actionPrevious = new QAction(QIcon(":/images/icons/56.png"), tr("Find &Previous"), this);
actionPrevious->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1));
actionPrevious->setToolTip("Find Previous (Ctrl + 1)");
toolbarFind->addAction(actionPrevious);
connect(actionPrevious, SIGNAL(triggered()), this, SLOT(movePrevious()));
actionPrevious->setDisabled(true);
- actionNext = new QAction(QIcon(":/images/icons/57.png"), tr("Find Next"), this);
+ actionNext = new QAction(QIcon(":/images/icons/57.png"), tr("Find &Next"), this);
actionNext->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_2));
actionNext->setToolTip("Find Next (Ctrl + 2)");
toolbarFind->addAction(actionNext);
@@ -636,53 +694,66 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
actionNext->setDisabled(true);
- toolbarZoom = addToolBar(tr("Zoom"));
- toolbarZoom->setMovable(false);
- toolbarZoom->setFloatable(false);
+ toolbarView = addToolBar(tr("View"));
- actionZoomIn = new QAction(QIcon(":/images/icons/83.png"), tr("Zoom In"), this);
+ actionZoomIn = new QAction(QIcon(":/images/icons/83.png"), tr("Zoom &In"), this);
actionZoomIn->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus));
actionZoomIn->setToolTip("Zoom In (Ctrl +)");
- toolbarZoom->addAction(actionZoomIn);
+ toolbarView->addAction(actionZoomIn);
connect(actionZoomIn, SIGNAL(triggered()), spectrumscene, SLOT(zoomIn()));
- actionZoomOut = new QAction(QIcon(":/images/icons/82.png"), tr("Zoom Out"), this);
+ actionZoomOut = new QAction(QIcon(":/images/icons/82.png"), tr("Zoom &Out"), this);
actionZoomOut->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus));
actionZoomOut->setToolTip("Zoom Out (Ctrl -)");
- toolbarZoom->addAction(actionZoomOut);
+ toolbarView->addAction(actionZoomOut);
connect(actionZoomOut, SIGNAL(triggered()), spectrumscene, SLOT(zoomOut()));
- actionZoomReset = new QAction(QIcon(":/images/icons/84.png"), tr("Reset Zoom"), this);
+ actionZoomReset = new QAction(QIcon(":/images/icons/84.png"), tr("&Reset Zoom"), this);
actionZoomReset->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
actionZoomReset->setToolTip("Zoom Reset (Ctrl + R)");
- toolbarZoom->addAction(actionZoomReset);
+ toolbarView->addAction(actionZoomReset);
connect(actionZoomReset, SIGNAL(triggered()), spectrumscene, SLOT(normalSize()));
+ toolbarView->addSeparator();
+
+ actionAbsoluteIntensity = new QAction(QIcon(":/images/icons/11.png"), tr("&Absolute Intensity"), this);
+ actionAbsoluteIntensity->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
+ actionAbsoluteIntensity->setToolTip("Absolute Intensity (Ctrl + I)");
+ actionAbsoluteIntensity->setCheckable(true);
+ toolbarView->addAction(actionAbsoluteIntensity);
+ connect(actionAbsoluteIntensity, SIGNAL(toggled(bool)), spectrumscene, SLOT(absoluteIntensityStateChanged(bool)));
- toolbarHide = addToolBar(tr("Show/Hide Peaks"));
- toolbarHide->setMovable(false);
- toolbarHide->setFloatable(false);
+ toolbarView->addSeparator();
- actionHideMatched = new QAction(QIcon(":/images/icons/20.png"), tr("Hide Matched Peaks"), this);
+ actionHideMatched = new QAction(QIcon(":/images/icons/20.png"), tr("Hide &Matched Peaks"), this);
actionHideMatched->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
actionHideMatched->setToolTip("Hide Matched Peaks (Ctrl + M)");
actionHideMatched->setCheckable(true);
- toolbarHide->addAction(actionHideMatched);
+ toolbarView->addAction(actionHideMatched);
connect(actionHideMatched, SIGNAL(toggled(bool)), this, SLOT(hideMatchedPeaks(bool)));
- actionHideUnmatched = new QAction(QIcon(":/images/icons/81.png"), tr("Hide Unmatched Peaks"), this);
+ actionHideUnmatched = new QAction(QIcon(":/images/icons/81.png"), tr("Hide &Unmatched Peaks"), this);
actionHideUnmatched->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U));
actionHideUnmatched->setToolTip("Hide Unmatched Peaks (Ctrl + U)");
actionHideUnmatched->setCheckable(true);
- toolbarHide->addAction(actionHideUnmatched);
+ toolbarView->addAction(actionHideUnmatched);
connect(actionHideUnmatched, SIGNAL(toggled(bool)), this, SLOT(hideUnmatchedPeaks(bool)));
- actionHideScrambled = new QAction(QIcon(":/images/icons/80.png"), tr("Hide Scrambled Peaks"), this);
+ actionHideScrambled = new QAction(QIcon(":/images/icons/80.png"), tr("Hide &Scrambled Peaks"), this);
actionHideScrambled->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
actionHideScrambled->setToolTip("Hide Scrambled Peaks (Ctrl + S)");
actionHideScrambled->setCheckable(true);
actionHideScrambled->setEnabled(false);
- toolbarHide->addAction(actionHideScrambled);
+ toolbarView->addAction(actionHideScrambled);
+
+
+ toolbarHelp = addToolBar(tr("Help"));
+
+ actionHTMLDocumentation = new QAction(QIcon(":/images/icons/3.png"), tr("&HTML Documentation"), this);
+ actionHTMLDocumentation->setShortcut(QKeySequence(Qt::Key_F1));
+ actionHTMLDocumentation->setToolTip("Show HTML Documentation (F1)");
+ toolbarHelp->addAction(actionHTMLDocumentation);
+ connect(actionHTMLDocumentation, SIGNAL(triggered()), this, SLOT(showHTMLDocumentation()));
if (parameters && ((parameters->mode == denovoengine) || (parameters->mode == singlecomparison) || (parameters->mode == databasesearch))) {
@@ -709,47 +780,44 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
peakstable->setModel(proxymodel);
peakstable->setSortingEnabled(true);
- labelmz = new QLabel(tr("View m/z (from - to): "));
+ labelmz = new QLabel(tr("m/z: "));
minmz = new QDoubleSpinBox();
minmz->setDecimals(6);
minmz->setRange(0, 100000);
minmz->setSingleStep(1);
+ labelseparator = new QLabel(tr("-"));
+
maxmz = new QDoubleSpinBox();
maxmz->setDecimals(6);
maxmz->setRange(0, 100000);
maxmz->setSingleStep(1);
setmzinterval = new QPushButton("Set");
- setmzinterval->setMaximumWidth(50);
+ setmzinterval->setMinimumWidth(75);
connect(setmzinterval, SIGNAL(released()), this, SLOT(setMZInterval()));
connect(this, SIGNAL(emitMZInterval(double, double)), spectrumscene, SLOT(setMZInterval(double, double)));
resetmzinterval = new QPushButton("Reset");
- resetmzinterval->setMaximumWidth(50);
+ resetmzinterval->setMinimumWidth(75);
connect(resetmzinterval, SIGNAL(released()), spectrumscene, SLOT(resetMZInterval()));
connect(spectrumscene, SIGNAL(updateMZInterval(double, double)), this, SLOT(updateMZInterval(double, double)));
hboxmz = new QHBoxLayout();
- hboxmz->addSpacing(1);
hboxmz->addWidget(labelmz);
- hboxmz->addSpacing(1);
hboxmz->addWidget(minmz);
- hboxmz->addSpacing(1);
+ hboxmz->addWidget(labelseparator);
hboxmz->addWidget(maxmz);
- hboxmz->addSpacing(1);
+ hboxmz->addSpacing(5);
hboxmz->addWidget(setmzinterval);
- hboxmz->addSpacing(1);
+ hboxmz->addSpacing(5);
hboxmz->addWidget(resetmzinterval);
- hboxmz->addSpacing(1);
widgetmz = new QWidget();
widgetmz->setLayout(hboxmz);
- toolbarMz = addToolBar(tr("Range of m/z"));
- toolbarMz->setMovable(false);
- toolbarMz->setFloatable(false);
+ toolbarMz = addToolBar(tr("m/z"));
actionMouseMzSelection = new QAction(QIcon(":/images/icons/64.png"), tr("Mouse m/z Selection Tool"), this);
actionMouseMzSelection->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T));
@@ -762,16 +830,16 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
toolbarMz->addWidget(widgetmz);
+ addToolBarBreak();
+
labelrotation = new QLabel(tr("Ring break up point: "));
rotation = new QComboBox();
+ rotation->setSizeAdjustPolicy(QComboBox::AdjustToContents);
hboxrotation = new QHBoxLayout();
- hboxrotation->addSpacing(1);
hboxrotation->addWidget(labelrotation);
- hboxrotation->addSpacing(1);
hboxrotation->addWidget(rotation);
- hboxrotation->addSpacing(1);
widgetrotation = new QWidget();
widgetrotation->setLayout(hboxrotation);
@@ -779,13 +847,11 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
labeltrotation = new QLabel(tr("Linearized sequence: "));
trotation = new QComboBox();
+ trotation->setSizeAdjustPolicy(QComboBox::AdjustToContents);
hboxtrotation = new QHBoxLayout();
- hboxtrotation->addSpacing(1);
hboxtrotation->addWidget(labeltrotation);
- hboxtrotation->addSpacing(1);
hboxtrotation->addWidget(trotation);
- hboxtrotation->addSpacing(1);
widgettrotation = new QWidget();
widgettrotation->setLayout(hboxtrotation);
@@ -814,8 +880,6 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
toolbarRotation = addToolBar(tr("Ring break up point"));
toolbarRotation->addWidget(widgetrotation);
- toolbarRotation->setMovable(false);
- toolbarRotation->setFloatable(false);
}
// branched
@@ -833,8 +897,6 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
toolbarTrotation = addToolBar(tr("Linearized sequence"));
toolbarTrotation->addWidget(widgettrotation);
- toolbarTrotation->setMovable(false);
- toolbarTrotation->setFloatable(false);
}
// branch-cyclic
@@ -858,8 +920,6 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
toolbarRotation = addToolBar(tr("Ring break up point"));
toolbarRotation->addWidget(widgetrotation);
- toolbarRotation->setMovable(false);
- toolbarRotation->setFloatable(false);
trotation->addItem(tr("all"));
trotation->addItem(tr("1 (left-to-right)"));
@@ -874,8 +934,6 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
toolbarTrotation = addToolBar(tr("Linearized sequence"));
toolbarTrotation->addWidget(widgettrotation);
- toolbarTrotation->setMovable(false);
- toolbarTrotation->setFloatable(false);
}
}
@@ -924,11 +982,39 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
vsplitter->setSizes(sizes);
setCentralWidget(vsplitter);
- centralWidget()->setContentsMargins(10, 10, 10, 10);
+ centralWidget()->setContentsMargins(5, 5, 5, 5);
finddialog = new cFindDialog(this);
exportdialog = new cExportDialog(this);
+ menuFile->addAction(actionExportTable);
+ menuFile->addAction(actionExportSpectrum);
+ menuFile->addSeparator();
+ menuFile->addAction(actionCloseWindow);
+
+ menuFind->addAction(actionFind);
+ menuFind->addAction(actionPrevious);
+ menuFind->addAction(actionNext);
+
+ menuView->addAction(actionZoomIn);
+ menuView->addAction(actionZoomOut);
+ menuView->addAction(actionZoomReset);
+ menuView->addSeparator();
+ menuView->addAction(actionAbsoluteIntensity);
+ menuView->addSeparator();
+ menuView->addAction(actionHideMatched);
+ menuView->addAction(actionHideUnmatched);
+ menuView->addAction(actionHideScrambled);
+
+ menuHelp->addAction(actionHTMLDocumentation);
+
+ menuBar->addMenu(menuFile);
+ menuBar->addMenu(menuFind);
+ menuBar->addMenu(menuView);
+ menuBar->addMenu(menuHelp);
+
+ setMenuBar(menuBar);
+
resize(1280, 770);
if (parameters && theoreticalspectrum) {
@@ -940,16 +1026,20 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
case linear:
case linearpolyketide:
linearwidget->initialize(parameters, theoreticalspectrum);
+ linearwidget->setReportIsomers(reportisomers);
break;
case cyclic:
case cyclicpolyketide:
cyclicwidget->initialize(parameters, theoreticalspectrum);
+ cyclicwidget->setReportIsomers(reportisomers);
break;
case branched:
branchedwidget->initialize(parameters, theoreticalspectrum);
+ branchedwidget->setReportIsomers(reportisomers);
break;
case branchcyclic:
branchcyclicwidget->initialize(parameters, theoreticalspectrum);
+ branchcyclicwidget->setReportIsomers(reportisomers);
break;
case other:
break;
@@ -957,7 +1047,11 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) {
break;
}
- textbrowser->setHtml((getDetailsAsHTMLString() + theoreticalspectrum->getCoverageBySeries()).c_str());
+ string textinfo = getDetailsAsHTMLString() + theoreticalspectrum->getCoverageBySeries();
+ if (!reportisomers) {
+ stripIsomers(textinfo);
+ }
+ textbrowser->setHtml(textinfo.c_str());
}
@@ -1015,8 +1109,11 @@ void cSpectrumDetailWidget::findAll(const QString& str, QTextDocument::FindFlags
continue;
}
+ string itemstr = item->text().toStdString();
+ QString qstr = stripHTML(itemstr).c_str();
+
if (opt & QTextDocument::FindWholeWords) {
- if (item->text().compare(str, (opt & QTextDocument::FindCaseSensitively)?Qt::CaseSensitive:Qt::CaseInsensitive) == 0) {
+ if (qstr.compare(str, (opt & QTextDocument::FindCaseSensitively)?Qt::CaseSensitive:Qt::CaseInsensitive) == 0) {
tpos.row = i;
tpos.column = j;
tablematches.push_back(tpos);
@@ -1024,7 +1121,7 @@ void cSpectrumDetailWidget::findAll(const QString& str, QTextDocument::FindFlags
}
}
else {
- if (item->text().contains(str, (opt & QTextDocument::FindCaseSensitively)?Qt::CaseSensitive:Qt::CaseInsensitive)) {
+ if (qstr.contains(str, (opt & QTextDocument::FindCaseSensitively)?Qt::CaseSensitive:Qt::CaseInsensitive)) {
tpos.row = i;
tpos.column = j;
tablematches.push_back(tpos);
@@ -1080,78 +1177,10 @@ void cSpectrumDetailWidget::exportImage(bool exportspectrum) {
void cSpectrumDetailWidget::keyPressEvent(QKeyEvent *event) {
- if (event->key() == Qt::Key_Escape) {
- hide();
- }
-
if ((event->key() == Qt::Key_Enter) || (event->key() == Qt::Key_Return)) {
setMZInterval();
}
- if ((event->key() == Qt::Key_F1) && parameters) {
- #if OS_TYPE == WIN
- if (parameters->mode == dereplication) {
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/dereplication.html").absoluteFilePath()));
- }
- else {
- switch (parameters->peptidetype) {
- case linear:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/lineardetail.html").absoluteFilePath()));
- break;
- case cyclic:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/cyclicdetail.html").absoluteFilePath()));
- break;
- case branched:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/brancheddetail.html").absoluteFilePath()));
- break;
- case branchcyclic:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/branchcyclicdetail.html").absoluteFilePath()));
- break;
- case linearpolyketide:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/linearketidedetail.html").absoluteFilePath()));
- break;
- case cyclicpolyketide:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/cyclicketidedetail.html").absoluteFilePath()));
- break;
- case other:
- break;
- default:
- break;
- }
- }
- #else
- if (parameters->mode == dereplication) {
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/dereplication.html").absoluteFilePath()));
- }
- else {
- switch (parameters->peptidetype) {
- case linear:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/lineardetail.html").absoluteFilePath()));
- break;
- case cyclic:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/cyclicdetail.html").absoluteFilePath()));
- break;
- case branched:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/brancheddetail.html").absoluteFilePath()));
- break;
- case branchcyclic:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/branchcyclicdetail.html").absoluteFilePath()));
- break;
- case linearpolyketide:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/linearketidedetail.html").absoluteFilePath()));
- break;
- case cyclicpolyketide:
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/cyclicketidedetail.html").absoluteFilePath()));
- break;
- case other:
- break;
- default:
- break;
- }
- }
- #endif
- }
-
event->accept();
}
@@ -1161,12 +1190,11 @@ void cSpectrumDetailWidget::preparePeaksTable() {
peakstable->setEditTriggers(QAbstractItemView::NoEditTriggers);
peakstable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
peakstable->horizontalHeader()->setSectionsMovable(true);
- peakstable->setSelectionMode(QAbstractItemView::SingleSelection);
- peakstable->verticalHeader()->setDefaultSectionSize(25);
+ //peakstable->verticalHeader()->setDefaultSectionSize(30);
if (parameters->mode == dereplication) {
if (parameters->generateisotopepattern) {
- peakstablemodel->setColumnCount(10);
+ peakstablemodel->setColumnCount(12);
}
else {
peakstablemodel->setColumnCount(9);
@@ -1182,7 +1210,12 @@ void cSpectrumDetailWidget::preparePeaksTable() {
int currentcolumn = 0;
if (parameters->mode == dereplication) {
- peakstablemodel->horizontalHeaderItem(currentcolumn)->setText("Ion Type");
+ if (parameters->generateisotopepattern) {
+ peakstablemodel->horizontalHeaderItem(currentcolumn)->setText("Pattern Type");
+ }
+ else {
+ peakstablemodel->horizontalHeaderItem(currentcolumn)->setText("Ion Type");
+ }
}
else {
peakstablemodel->horizontalHeaderItem(currentcolumn)->setText("Fragment Type");
@@ -1210,6 +1243,15 @@ void cSpectrumDetailWidget::preparePeaksTable() {
currentcolumn++;
if (parameters->mode == dereplication) {
+
+ if (parameters->generateisotopepattern) {
+ peakstablemodel->horizontalHeaderItem(currentcolumn)->setText("Score");
+ currentcolumn++;
+
+ peakstablemodel->horizontalHeaderItem(currentcolumn)->setText("FDR");
+ currentcolumn++;
+ }
+
peakstablemodel->horizontalHeaderItem(currentcolumn)->setText("Summary Formula");
if (parameters->generateisotopepattern) {
peakstable->setItemDelegateForColumn(currentcolumn, new cHTMLDelegate());
@@ -1234,32 +1276,21 @@ void cSpectrumDetailWidget::preparePeaksTable() {
int thpeakscount;
cPeak* peak;
int secondspace, langle, rangle, tmp;
- string stmp;
+ string stmp, desc;
+ size_t pos;
QBrush brush;
- if (parameters->mode == dereplication) {
- thpeaks = new cPeaksList();
- for (int i = 0; i < (int)theoreticalspectrum->getTheoreticalPeaks()->size(); i++) {
- peak = &((*(theoreticalspectrum->getTheoreticalPeaks()))[i]);
- if (peak->matchedmz > 0) {
- thpeaks->add(*peak);
- }
- }
- thpeakscount = thpeaks->size();
- }
- else {
- thpeaks = theoreticalspectrum->getTheoreticalPeaks();
- thpeakscount = theoreticalspectrum->getTheoreticalPeaks()->size();
- }
+ thpeaks = theoreticalspectrum->getTheoreticalPeaks();
+ thpeakscount = theoreticalspectrum->getTheoreticalPeaks()->size();
- peakstablemodel->setRowCount(thpeakscount + theoreticalspectrum->getUnmatchedPeaksCount());
+ peakstablemodel->setRowCount(thpeakscount + theoreticalspectrum->getUnmatchedExperimentalPeaksCount());
- QProgressDialog progress("Preparing the peaklist...", /*"Cancel"*/0, 0, thpeakscount + theoreticalspectrum->getUnmatchedPeaksCount(), parent);
+ QProgressDialog progress("Preparing the peaklist...", /*"Cancel"*/0, 0, thpeakscount + theoreticalspectrum->getUnmatchedExperimentalPeaksCount(), parent);
progress.setMinimumWidth(250);
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
peakstable->setModel(0);
proxymodel->setSourceModel(0);
@@ -1326,20 +1357,39 @@ void cSpectrumDetailWidget::preparePeaksTable() {
peakstablemodel->item(i, currentcolumn)->setForeground(brush);
peakstablemodel->item(i, currentcolumn)->setData(QVariant::fromValue(cropPrecisionToSixDecimalsByteArray(peak->matchedppm)), Qt::DisplayRole);
currentcolumn++;
+
+ if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ peakstablemodel->setItem(i, currentcolumn, new QStandardItem());
+ peakstablemodel->item(i, currentcolumn)->setForeground(brush);
+ peakstablemodel->item(i, currentcolumn)->setData(QVariant::fromValue(cropPrecisionToSixDecimalsByteArray(theoreticalspectrum->getTargetPatternScore(peak->groupid))), Qt::DisplayRole);
+ currentcolumn++;
+
+ peakstablemodel->setItem(i, currentcolumn, new QStandardItem());
+ peakstablemodel->item(i, currentcolumn)->setForeground(brush);
+ peakstablemodel->item(i, currentcolumn)->setData(QVariant::fromValue(cropPrecisionToSixDecimalsByteArray(theoreticalspectrum->getTargetPatternFDR(peak->groupid))), Qt::DisplayRole);
+ currentcolumn++;
+ }
+ }
}
else {
currentcolumn += 4;
+ if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ currentcolumn += 2;
+ }
+ }
}
if (parameters->mode == dereplication) {
peakstablemodel->setItem(i, currentcolumn, new QStandardItem());
peakstablemodel->item(i, currentcolumn)->setForeground(brush);
QString summary;
- if (parameters->generateisotopepattern) {
+ if (parameters->generateisotopepattern && (peak->matched > 0)) {
summary += "";
}
summary += peak->description.substr(peak->description.rfind('(') + 1, peak->description.rfind(')') - peak->description.rfind('(') - 1).c_str();
- if (parameters->generateisotopepattern) {
+ if (parameters->generateisotopepattern && (peak->matched > 0)) {
summary += "";
}
peakstablemodel->item(i, currentcolumn)->setText(summary);
@@ -1369,10 +1419,15 @@ void cSpectrumDetailWidget::preparePeaksTable() {
}
}
else {
- if (peak->description.find(':') + 2 < peak->description.size()) {
+ pos = peak->description.find(':');
+ if ((pos != string::npos) && (pos + 2 < peak->description.size())) {
peakstablemodel->setItem(i, currentcolumn, new QStandardItem());
peakstablemodel->item(i, currentcolumn)->setForeground(brush);
- peakstablemodel->item(i, currentcolumn)->setText(peak->description.substr(peak->description.find(':') + 2).c_str());
+ desc = peak->description.substr(pos + 2);
+ if (!reportisomers) {
+ stripIsomers(desc);
+ }
+ peakstablemodel->item(i, currentcolumn)->setText(desc.c_str());
currentcolumn++;
}
}
@@ -1430,21 +1485,17 @@ void cSpectrumDetailWidget::preparePeaksTable() {
if (parameters->mode == dereplication) {
if (parameters->generateisotopepattern) {
- peakstable->setColumnWidth(7, min(400, peakstable->columnWidth(7)));
+ peakstable->setColumnWidth(9, min(400, peakstable->columnWidth(9)));
}
else {
peakstable->setColumnWidth(6, min(400, peakstable->columnWidth(6)));
}
}
- progress.setValue(thpeakscount + theoreticalspectrum->getUnmatchedPeaksCount());
+ progress.setValue(thpeakscount + theoreticalspectrum->getUnmatchedExperimentalPeaksCount());
tablematches.clear();
- if (parameters->mode == dereplication) {
- delete thpeaks;
- }
-
}
@@ -1688,7 +1739,7 @@ void cSpectrumDetailWidget::exportTableToCSV() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
bool removefile = false;
QFile file(filename);
@@ -1821,3 +1872,148 @@ void cSpectrumDetailWidget::hideScrambledPeaks(bool hide) {
filterPeaksTable();
}
+
+void cSpectrumDetailWidget::showIsomersStateChanged() {
+
+ if (parameters->mode != dereplication) {
+
+ reportisomers = actionShowIsomers->isChecked();
+
+ // update graphical widget
+ switch (parameters->peptidetype) {
+ case linear:
+ linearwidget->setReportIsomers(reportisomers);
+ break;
+ case cyclic:
+ cyclicwidget->setReportIsomers(reportisomers);
+ break;
+ case branched:
+ branchedwidget->setReportIsomers(reportisomers);
+ break;
+ case branchcyclic:
+ branchcyclicwidget->setReportIsomers(reportisomers);
+ break;
+ case linearpolyketide:
+ linearwidget->setReportIsomers(reportisomers);
+ break;
+ case cyclicpolyketide:
+ cyclicwidget->setReportIsomers(reportisomers);
+ break;
+ case other:
+ break;
+ default:
+ break;
+ }
+
+
+ // update table of peaks
+ cPeak* peak;
+ string desc;
+ size_t pos;
+
+ cPeaksList* thpeaks = theoreticalspectrum->getTheoreticalPeaks();
+ int thpeakscount = theoreticalspectrum->getTheoreticalPeaks()->size();
+ int currentcolumn = peakstablemodel->columnCount() - 1;
+
+ for (int i = 0; i < thpeakscount; i++) {
+ peak = &((*thpeaks)[i]);
+ if (peak->descriptionid != -1) {
+ peak->description = parameters->peakidtodesc[peak->descriptionid];
+ }
+
+ pos = peak->description.find(':');
+ if ((pos != string::npos) && (pos + 2 < peak->description.size()) && peakstablemodel->item(i, currentcolumn)) {
+ desc = peak->description.substr(pos + 2);
+ if (!reportisomers) {
+ stripIsomers(desc);
+ }
+ peakstablemodel->item(i, currentcolumn)->setText(desc.c_str());
+ }
+ }
+
+
+ // update text info
+ string textinfo = getDetailsAsHTMLString() + theoreticalspectrum->getCoverageBySeries();
+ if (!reportisomers) {
+ stripIsomers(textinfo);
+ }
+ textbrowser->setHtml(textinfo.c_str());
+
+
+ // reset search tool
+ findAll("", 0, false);
+
+ }
+
+}
+
+
+void cSpectrumDetailWidget::showHTMLDocumentation() {
+ #if OS_TYPE == WIN
+ if (parameters->mode == dereplication) {
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/dereplication.html").absoluteFilePath()));
+ }
+ else {
+ switch (parameters->peptidetype) {
+ case linear:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/lineardetail.html").absoluteFilePath()));
+ break;
+ case cyclic:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/cyclicdetail.html").absoluteFilePath()));
+ break;
+ case branched:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/brancheddetail.html").absoluteFilePath()));
+ break;
+ case branchcyclic:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/branchcyclicdetail.html").absoluteFilePath()));
+ break;
+ case linearpolyketide:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/linearketidedetail.html").absoluteFilePath()));
+ break;
+ case cyclicpolyketide:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/cyclicketidedetail.html").absoluteFilePath()));
+ break;
+ case other:
+ break;
+ default:
+ break;
+ }
+ }
+ #else
+ if (parameters->mode == dereplication) {
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/dereplication.html").absoluteFilePath()));
+ }
+ else {
+ switch (parameters->peptidetype) {
+ case linear:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/lineardetail.html").absoluteFilePath()));
+ break;
+ case cyclic:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/cyclicdetail.html").absoluteFilePath()));
+ break;
+ case branched:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/brancheddetail.html").absoluteFilePath()));
+ break;
+ case branchcyclic:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/branchcyclicdetail.html").absoluteFilePath()));
+ break;
+ case linearpolyketide:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/linearketidedetail.html").absoluteFilePath()));
+ break;
+ case cyclicpolyketide:
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/cyclicketidedetail.html").absoluteFilePath()));
+ break;
+ case other:
+ break;
+ default:
+ break;
+ }
+ }
+ #endif
+}
+
+
+void cSpectrumDetailWidget::closeWindow() {
+ hide();
+}
+
diff --git a/CycloBranch/gui/cSpectrumDetailWidget.h b/CycloBranch/gui/cSpectrumDetailWidget.h
index ba069a6..2e7237a 100644
--- a/CycloBranch/gui/cSpectrumDetailWidget.h
+++ b/CycloBranch/gui/cSpectrumDetailWidget.h
@@ -9,6 +9,9 @@
#include
#include
+#include
+#include
+#include
#include
#include
#include
@@ -43,7 +46,6 @@ class QPushButton;
class QSplitter;
class QComboBox;
class QDoubleSpinBox;
-class QToolBar;
class QAction;
class QLabel;
@@ -141,24 +143,27 @@ class cSpectrumDetailWidget : public QMainWindow
\brief Get a table of peaks as a HTML string.
\param unmatchedtheoreticalpeaks if true then unmatched theoretical peaks are included
\param unmatchedexperimentalpeaks if true then unmatched experimental peaks are included
+ \param exportisomers if true then isomers of building blocks are exported
\retval string a table of peaks as a HTML string
*/
- string getPeaksTableAsHTMLString(bool unmatchedtheoreticalpeaks, bool unmatchedexperimentalpeaks);
+ string getPeaksTableAsHTMLString(bool unmatchedtheoreticalpeaks, bool unmatchedexperimentalpeaks, bool exportisomers);
/**
\brief Get a partial table of peaks as a HTML string.
\param id identifier of a spectrum
+ \param exportisomers if true then isomers of building blocks are exported
\retval string a partial table of peaks as a HTML string
*/
- string getPartialPeaksTableAsHTMLString(int id);
+ string getPartialPeaksTableAsHTMLString(int id, bool exportisomers);
/**
\brief Prepare the widget to show.
\param peptidetype a type of peptide
+ \param actionShowIsomers reference to QAction to show isomers of building blocks
*/
- void prepareToShow(ePeptideType peptidetype);
+ void prepareToShow(ePeptideType peptidetype, QAction* actionShowIsomers);
/**
@@ -188,29 +193,39 @@ class cSpectrumDetailWidget : public QMainWindow
private:
+
QWidget* parent;
+ QAction* actionShowIsomers;
+
+ QMenuBar* menuBar;
+ QMenu* menuFile;
+ QMenu* menuFind;
+ QMenu* menuView;
+ QMenu* menuHelp;
- QToolBar* toolbarExport;
+ QToolBar* toolbarFile;
QToolBar* toolbarFind;
- QToolBar* toolbarZoom;
- QToolBar* toolbarHide;
+ QToolBar* toolbarView;
+ QToolBar* toolbarHelp;
QToolBar* toolbarMz;
QToolBar* toolbarRotation;
QToolBar* toolbarTrotation;
QAction* actionExportTable;
QAction* actionExportSpectrum;
+ QAction* actionCloseWindow;
QAction* actionFind;
QAction* actionPrevious;
QAction* actionNext;
QAction* actionZoomIn;
QAction* actionZoomOut;
QAction* actionZoomReset;
+ QAction* actionAbsoluteIntensity;
QAction* actionHideMatched;
QAction* actionHideUnmatched;
QAction* actionHideScrambled;
QAction* actionMouseMzSelection;
-
+ QAction* actionHTMLDocumentation;
QSplitter* hsplitter1;
QSplitter* hsplitter2;
QSplitter* vsplitter;
@@ -219,6 +234,7 @@ class cSpectrumDetailWidget : public QMainWindow
QHBoxLayout* hboxmz;
QLabel* labelmz;
QDoubleSpinBox* minmz;
+ QLabel* labelseparator;
QDoubleSpinBox* maxmz;
QPushButton* setmzinterval;
QPushButton* resetmzinterval;
@@ -257,6 +273,7 @@ class cSpectrumDetailWidget : public QMainWindow
cExportDialog* exportdialog;
int currentfinditem;
+ bool reportisomers;
void preparePeaksTable();
@@ -265,6 +282,7 @@ class cSpectrumDetailWidget : public QMainWindow
signals:
+
/**
\brief The signal is emitted when the range of m/z ratios has been changed.
\param minmz a minimum threshold of m/z ratio
@@ -275,34 +293,57 @@ class cSpectrumDetailWidget : public QMainWindow
private slots:
+
void updateMZInterval(double minmz, double maxmz);
+
void setMZInterval();
+
void exportSpectrum();
+
void exportPeptide();
+
void openFindDialog();
+
void openExportImageDialog();
+
void exportTableToCSV();
+
void movePrevious();
+
void moveNext();
- void headerItemClicked(int);
+
+ void headerItemClicked(int index);
+
void filterPeaksTable();
+
void hideMatchedPeaks(bool hide);
+
void hideUnmatchedPeaks(bool hide);
+
void hideScrambledPeaks(bool hide);
+
+ void showIsomersStateChanged();
+
+
+ void showHTMLDocumentation();
+
+
+ void closeWindow();
+
};
#endif
diff --git a/CycloBranch/gui/cSpectrumSceneWidget.cpp b/CycloBranch/gui/cSpectrumSceneWidget.cpp
index f0d55b7..6ecc93f 100644
--- a/CycloBranch/gui/cSpectrumSceneWidget.cpp
+++ b/CycloBranch/gui/cSpectrumSceneWidget.cpp
@@ -25,6 +25,7 @@ cSpectrumSceneWidget::cSpectrumSceneWidget(QWidget* parent) {
origwidth = 500;
origheight = 200;
currentscale = 1;
+ absoluteintensity = false;
hideunmatched = false;
hidematched = false;
hidescrambled = false;
@@ -309,7 +310,8 @@ void cSpectrumSceneWidget::showEvent(QShowEvent *event) {
double cSpectrumSceneWidget::getMZRatioFromXPosition(int x, int w) {
- return (double)(x - leftmargin)/(double)(w - leftmargin - rightmargin)*(maxmzratio - minmzratio) + minmzratio;
+ double mz = (double)(x - leftmargin)/(double)(w - leftmargin - rightmargin)*(maxmzratio - minmzratio) + minmzratio;
+ return max(0.0, mz);
}
@@ -333,8 +335,10 @@ void cSpectrumSceneWidget::redrawScene() {
char tmpbuf[30];
string s;
+ int xstep, ystep;
int w = origwidth;
int h = origheight;
+ int rulergranularity = 10;
cPeaksList visiblepeaks;
visiblepeaks.clear();
@@ -342,47 +346,103 @@ void cSpectrumSceneWidget::redrawScene() {
QList hiddenitems;
vector hits;
+ set experimentalmatches;
QFont myFont("Arial", 8);
QFontMetrics fm(myFont);
+
// maximum intensity in the interval
- double maxintensity = theoreticalspectrum->getExperimentalSpectrum().getMaximumIntensityFromMZInterval(minmzratio, maxmzratio, hidematched, hideunmatched, parameters->peptidetype, hidescrambled);
+ double maxintensity;
+ if (absoluteintensity) {
+ maxintensity = theoreticalspectrum->getExperimentalSpectrum().getMaximumAbsoluteIntensityFromMZInterval(minmzratio, maxmzratio, hidematched, hideunmatched, parameters->peptidetype, hidescrambled);
+ }
+ else {
+ maxintensity = theoreticalspectrum->getExperimentalSpectrum().getMaximumRelativeIntensityFromMZInterval(minmzratio, maxmzratio, hidematched, hideunmatched, parameters->peptidetype, hidescrambled);
+ }
+
scene->removeItem(zoomgroup);
scene->clear();
zoomgroup->setVisible(false);
scene->addItem(zoomgroup);
+
// x axis
scene->addLine(leftmargin, h - bottommargin, w - rightmargin, h - bottommargin, QPen(Qt::black, 2, Qt::SolidLine));
// x axis ruler
- scene->addLine(leftmargin, h - bottommargin, leftmargin, h - bottommargin + 10, QPen(Qt::black, 2, Qt::SolidLine));
+ xstep = (w - leftmargin - rightmargin) / rulergranularity;
+ for (int i = 0; i < rulergranularity; i++) {
+ scene->addLine(leftmargin + xstep * i, h - bottommargin, leftmargin + xstep * i, h - bottommargin + 10, QPen(Qt::black, 2, Qt::SolidLine));
+ }
scene->addLine(w - rightmargin, h - bottommargin, w - rightmargin, h - bottommargin + 10, QPen(Qt::black, 2, Qt::SolidLine));
simpletext = scene->addSimpleText(QString::number(minmzratio), myFont);
- simpletext->setPos(QPointF(leftmargin - 2, h - bottommargin + 12));
+ simpletext->setPos(QPointF(leftmargin - simpletext->boundingRect().width() / 2, h - bottommargin + 12));
+
+ if (maxmzratio - minmzratio > 0.01) {
+ xstep = (w - leftmargin - rightmargin) / rulergranularity;
+ for (int i = 1; i < rulergranularity; i++) {
+ simpletext = scene->addSimpleText(QString::number(minmzratio + (maxmzratio - minmzratio) / (double)rulergranularity * (double)i), myFont);
+ simpletext->setPos(QPointF(leftmargin + xstep * i - simpletext->boundingRect().width() / 2, h - bottommargin + 12));
+ }
+ }
simpletext = scene->addSimpleText(QString::number(maxmzratio), myFont);
- simpletext->setPos(QPointF(w - rightmargin - 2, h - bottommargin + 12));
+ simpletext->setPos(QPointF(w - rightmargin - simpletext->boundingRect().width() / 2, h - bottommargin + 12));
+
// y axis
scene->addLine(leftmargin, h - bottommargin, leftmargin, h - bottommargin - std::max(h - topmargin - bottommargin, 5), QPen(Qt::black, 2, Qt::SolidLine));
// y axis ruler
+ ystep = (h - topmargin - bottommargin) / rulergranularity;
+ for (int i = 0; i < rulergranularity; i++) {
+ scene->addLine(leftmargin - 10, h - bottommargin - ystep * i, leftmargin, h - bottommargin - ystep * i, QPen(Qt::black, 2, Qt::SolidLine));
+ }
scene->addLine(leftmargin - 10, h - bottommargin - std::max(h - topmargin - bottommargin, 5), leftmargin, h - bottommargin - std::max(h - topmargin - bottommargin, 5), QPen(Qt::black, 2, Qt::SolidLine));
- scene->addLine(leftmargin - 10, h - bottommargin, leftmargin, h - bottommargin, QPen(Qt::black, 2, Qt::SolidLine));
- simpletext = scene->addSimpleText(QString::number(0), myFont);
- simpletext->setPos(QPointF(leftmargin - 25, h - bottommargin + 2));
- simpletext->setRotation(-90);
+ if (absoluteintensity) {
+ simpletext = scene->addSimpleText(QString::number(0), myFont);
+ }
+ else {
+ simpletext = scene->addSimpleText(QString::number(0) + " %", myFont);
+ }
+ simpletext->setPos(QPointF(leftmargin - 15 - simpletext->boundingRect().width(), h - bottommargin - simpletext->boundingRect().height() / 2));
+
+ ystep = (h - topmargin - bottommargin) / rulergranularity;
+ if (absoluteintensity) {
+ if (maxintensity > rulergranularity) {
+ for (int i = 1; i < rulergranularity; i++) {
+ simpletext = scene->addSimpleText(QString::number((unsigned long long)maxintensity / (unsigned long long)rulergranularity * (unsigned long long)i), myFont);
+ simpletext->setPos(QPointF(leftmargin - 15 - simpletext->boundingRect().width(), h - bottommargin - simpletext->boundingRect().height() / 2 - ystep * i));
+ }
+ }
+ }
+ else {
+ if (maxintensity > 0) {
+ for (int i = 1; i < rulergranularity; i++) {
+ simpletext = scene->addSimpleText(QString::number(maxintensity / (double)rulergranularity * (double)i) + " %", myFont);
+ simpletext->setPos(QPointF(leftmargin - 15 - simpletext->boundingRect().width(), h - bottommargin - simpletext->boundingRect().height() / 2 - ystep * i));
+ }
+ }
+ }
+
+ if (absoluteintensity) {
+ simpletext = scene->addSimpleText(QString::number((unsigned long long)maxintensity), myFont);
+ }
+ else {
+ simpletext = scene->addSimpleText(QString::number(maxintensity) + " %", myFont);
+ }
+ simpletext->setPos(QPointF(leftmargin - 15 - simpletext->boundingRect().width(), h - bottommargin - std::max(h - topmargin - bottommargin, 5) - simpletext->boundingRect().height() / 2));
- simpletext = scene->addSimpleText(QString::number(maxintensity), myFont);
- simpletext->setPos(QPointF(leftmargin - 25, h - bottommargin - std::max(h - topmargin - bottommargin, 5) + 2));
- simpletext->setRotation(-90);
+
+ cPeaksList thpeaks = *theoreticalspectrum->getTheoreticalPeaks();
+ thpeaks.sortbyOrderId();
// all experimental peaks
+ int visiblepeakscount = 0;
for (int i = 0; i < (int)theoreticalspectrum->getExperimentalSpectrum().size(); i++) {
// skip peaks which are out of range
@@ -406,38 +466,56 @@ void cSpectrumSceneWidget::redrawScene() {
}
visiblepeaks.add(theoreticalspectrum->getExperimentalSpectrum()[i]);
+ visiblepeaks[visiblepeakscount].description.clear();
+
+ experimentalmatches = theoreticalspectrum->getExperimentalMatches(i);
+ for (auto it = experimentalmatches.begin(); it != experimentalmatches.end(); ++it) {
+ if (visiblepeaks[visiblepeakscount].description.compare("") != 0) {
+ visiblepeaks[visiblepeakscount].description += "@";
+ }
+
+ if (parameters->mode == dereplication) {
+ visiblepeaks[visiblepeakscount].description += parameters->peakidtodesc[thpeaks[*it].descriptionid].substr(0, parameters->peakidtodesc[thpeaks[*it].descriptionid].rfind(':'));
+ }
+ else {
+ visiblepeaks[visiblepeakscount].description += thpeaks[*it].description.substr(0, thpeaks[*it].description.find(':'));
+ }
+ }
+
+ visiblepeakscount++;
}
visiblepeaks.sortbyRelativeIntensityDesc();
- // visible peaks only
- for (int i = 0; i < (int)visiblepeaks.size(); i++) {
- x = getXPositionFromMZRatio(visiblepeaks[i].mzratio, origwidth);
+ string coloredtrotationstring;
+ if (coloredtrotationid != -1) {
+ if (parameters->peptidetype == branched) {
+ coloredtrotationstring = " " + to_string(coloredtrotationid + 1) + "_";
+ }
+ if (parameters->peptidetype == branchcyclic) {
+ coloredtrotationstring = "_" + to_string(coloredtrotationid + 1) + "_";
+ }
+ }
- y = visiblepeaks[i].relativeintensity/maxintensity * (h - topmargin - bottommargin);
- string coloredtrotationstring;
- if (coloredtrotationid != -1) {
- if (parameters->peptidetype == branched) {
- coloredtrotationstring = " " + to_string(coloredtrotationid + 1) + "_";
- }
- if (parameters->peptidetype == branchcyclic) {
- coloredtrotationstring = "_" + to_string(coloredtrotationid + 1) + "_";
- }
- }
+ // visible peaks only
+ for (int i = 0; i < (int)visiblepeaks.size(); i++) {
- hits.clear();
+ x = getXPositionFromMZRatio(visiblepeaks[i].mzratio, origwidth);
- if ((parameters->mode == dereplication) && (visiblepeaks[i].descriptionid != -1)) {
- s = parameters->peakidtodesc[visiblepeaks[i].descriptionid];
+ if (absoluteintensity) {
+ y = visiblepeaks[i].absoluteintensity / maxintensity * (h - topmargin - bottommargin);
}
else {
- s = visiblepeaks[i].description;
+ y = visiblepeaks[i].relativeintensity / maxintensity * (h - topmargin - bottommargin);
}
- int position = (int)s.find(',');
+ hits.clear();
+
+ s = visiblepeaks[i].description;
+ int position = (int)s.find('@');
while (position != (int)string::npos) {
hits.push_back(s.substr(0, position));
s = s.substr(position + 1);
@@ -463,7 +541,7 @@ void cSpectrumSceneWidget::redrawScene() {
hits.pop_back();
}
- position = (int)s.find(',');
+ position = (int)s.find('@');
}
if (s.size() > 0) {
@@ -491,6 +569,7 @@ void cSpectrumSceneWidget::redrawScene() {
}
}
+
sprintf_s(tmpbuf,"%.5f\0",visiblepeaks[i].mzratio);
s = tmpbuf;
hits.push_back(s);
@@ -546,9 +625,12 @@ void cSpectrumSceneWidget::redrawScene() {
}
- // fix the scene rectangle
+
+ scene->removeItem(zoomgroup);
scene->setSceneRect(scene->itemsBoundingRect());
-
+ zoomgroup->setVisible(false);
+ scene->addItem(zoomgroup);
+
}
@@ -619,6 +701,12 @@ void cSpectrumSceneWidget::normalSize() {
}
+void cSpectrumSceneWidget::absoluteIntensityStateChanged(bool state) {
+ absoluteintensity = state;
+ redrawScene();
+}
+
+
void cSpectrumSceneWidget::setMZInterval(double minmz, double maxmz) {
if (maxmz < minmz) {
double tmp = maxmz;
diff --git a/CycloBranch/gui/cSpectrumSceneWidget.h b/CycloBranch/gui/cSpectrumSceneWidget.h
index 611a64b..aca5ca8 100644
--- a/CycloBranch/gui/cSpectrumSceneWidget.h
+++ b/CycloBranch/gui/cSpectrumSceneWidget.h
@@ -139,6 +139,7 @@ class cSpectrumSceneWidget : public QGraphicsView
private:
+
QWidget* parent;
QGraphicsScene* scene;
QMatrix originalmatrix;
@@ -160,6 +161,7 @@ class cSpectrumSceneWidget : public QGraphicsView
string coloredrotationstring;
int coloredtrotationid;
+ bool absoluteintensity;
bool hideunmatched;
bool hidematched;
bool hidescrambled;
@@ -184,15 +186,19 @@ class cSpectrumSceneWidget : public QGraphicsView
double getMZRatioFromXPosition(int x, int w);
+
int getXPositionFromMZRatio(double mzratio, int w);
+
void redrawScene();
+
void updateZoomGroup();
signals:
+
/**
\brief The signal is emitted when the range of m/z ratios has been changed.
\param minmz a minimum threshold of m/z ratio
@@ -200,26 +206,40 @@ class cSpectrumSceneWidget : public QGraphicsView
*/
void updateMZInterval(double minmz, double maxmz);
+
private slots:
+
void zoomIn();
+
void zoomOut();
+
void normalSize();
+
+ void absoluteIntensityStateChanged(bool state);
+
+
void setMZInterval(double minmz, double maxmz);
+
void resetMZInterval();
+
void rotationChanged(int index);
+
void trotationChanged(int index);
+
void rotationChanged(QString text);
+
void enableMouseMzSelectionTool(bool enable);
+
};
#endif
diff --git a/CycloBranch/gui/cSummaryPeaksTableProxyModel.cpp b/CycloBranch/gui/cSummaryPeaksTableProxyModel.cpp
index 8240789..498c844 100644
--- a/CycloBranch/gui/cSummaryPeaksTableProxyModel.cpp
+++ b/CycloBranch/gui/cSummaryPeaksTableProxyModel.cpp
@@ -6,13 +6,16 @@ cSummaryPeaksTableProxyModel::cSummaryPeaksTableProxyModel(QObject *parent) : QS
xmax = -1;
ymin = -1;
ymax = -1;
+ wholeword = false;
}
-void cSummaryPeaksTableProxyModel::initialize(eModeType mode, ePeakListFileFormat peaklistfileformat, bool generateisotopepattern) {
+void cSummaryPeaksTableProxyModel::initialize(eModeType mode, ePeakListFileFormat peaklistfileformat, bool generateisotopepattern, QComboBox* rowsfiltercombobox, QComboBox* rowsfiltercomparatorcombobox) {
this->mode = mode;
this->peaklistfileformat = peaklistfileformat;
this->generateisotopepattern = generateisotopepattern;
+ this->rowsfiltercombobox = rowsfiltercombobox;
+ this->rowsfiltercomparatorcombobox = rowsfiltercomparatorcombobox;
}
@@ -24,51 +27,141 @@ void cSummaryPeaksTableProxyModel::setRegion(int xmin, int xmax, int ymin, int y
}
+void cSummaryPeaksTableProxyModel::setWholeWord(bool wholeword) {
+ this->wholeword = wholeword;
+}
+
+
bool cSummaryPeaksTableProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
- int size, x, y;
-
- if (mode == dereplication) {
- if ((peaklistfileformat == mis) || (peaklistfileformat == imzML)) {
- if (generateisotopepattern) {
- size = 12;
- }
- else {
- size = 11;
- }
- }
- else {
- if (generateisotopepattern) {
- size = 10;
- }
- else {
- size = 9;
- }
- }
- }
- else if (mode == denovoengine) {
- size = 9;
- }
- else {
- size = 8;
- }
+ bool checkrow = false;
+ int x, y;
if ((mode == dereplication) && ((peaklistfileformat == mis) || (peaklistfileformat == imzML))) {
x = sourceModel()->data(sourceModel()->index(sourceRow, 1)).toInt();
y = sourceModel()->data(sourceModel()->index(sourceRow, 2)).toInt();
if (((xmin == -1) && (xmax == -1) && (ymin == -1) && (ymax == -1)) || ((x >= xmin) && (x <= xmax) && (y >= ymin) && (y <= ymax))) {
- for (int i = 0; i < size; i++) {
- if (sourceModel()->data(sourceModel()->index(sourceRow, i, sourceParent)).toString().contains(filterRegExp())) {
+ checkrow = true;
+ }
+ }
+ else {
+ checkrow = true;
+ }
+
+ if (!checkrow) {
+ return false;
+ }
+
+ if (filterRegExp().isEmpty()) {
+ return true;
+ }
+
+ int col = rowsfiltercombobox->currentIndex();
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::ByteArray) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() == filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() < filterRegExp().pattern().toDouble()) {
return true;
}
- }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() <= filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() > filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toDouble() >= filterRegExp().pattern().toDouble()) {
+ return true;
+ }
+ break;
+ default:
+ break;
}
}
- else {
- for (int i = 0; i < size; i++) {
- if (sourceModel()->data(sourceModel()->index(sourceRow, i, sourceParent)).toString().contains(filterRegExp())) {
- return true;
- }
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::String) {
+
+ string itemstr = sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toString().toStdString();
+ QString qstr = stripHTML(itemstr).c_str();
+
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (wholeword) {
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) == 0) {
+ return true;
+ }
+ }
+ else {
+ if (qstr.contains(filterRegExp())) {
+ return true;
+ }
+ }
+ break;
+ case 1:
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) < 0) {
+ return true;
+ }
+ break;
+ case 2:
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) <= 0) {
+ return true;
+ }
+ break;
+ case 3:
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) > 0) {
+ return true;
+ }
+ break;
+ case 4:
+ if (qstr.compare(filterRegExp().pattern(), filterCaseSensitivity()) >= 0) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).type() == QVariant::Int) {
+ switch (rowsfiltercomparatorcombobox->currentIndex()) {
+ case 0:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() == filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 1:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() < filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 2:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() <= filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 3:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() > filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ case 4:
+ if (sourceModel()->data(sourceModel()->index(sourceRow, col, sourceParent)).toInt() >= filterRegExp().pattern().toInt()) {
+ return true;
+ }
+ break;
+ default:
+ break;
}
}
@@ -80,12 +173,20 @@ bool cSummaryPeaksTableProxyModel::lessThan(const QModelIndex &left, const QMode
QVariant leftData = sourceModel()->data(left);
QVariant rightData = sourceModel()->data(right);
+ if (leftData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? false : true;
+ }
+
+ if (rightData.toString().isEmpty()) {
+ return (sortOrder() == Qt::AscendingOrder) ? true : false;
+ }
+
if (leftData.type() == QVariant::ByteArray) {
return leftData.toDouble() < rightData.toDouble();
}
if (leftData.type() == QVariant::String) {
- return leftData.toString() < rightData.toString();
+ return leftData.toString().toLower() < rightData.toString().toLower();
}
if (leftData.type() == QVariant::Int) {
diff --git a/CycloBranch/gui/cSummaryPeaksTableProxyModel.h b/CycloBranch/gui/cSummaryPeaksTableProxyModel.h
index f8450f6..3adaaef 100644
--- a/CycloBranch/gui/cSummaryPeaksTableProxyModel.h
+++ b/CycloBranch/gui/cSummaryPeaksTableProxyModel.h
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include "core/cParameters.h"
@@ -25,6 +26,9 @@ class cSummaryPeaksTableProxyModel : public QSortFilterProxyModel {
eModeType mode;
ePeakListFileFormat peaklistfileformat;
bool generateisotopepattern;
+ QComboBox* rowsfiltercombobox;
+ QComboBox* rowsfiltercomparatorcombobox;
+ bool wholeword;
public:
@@ -64,8 +68,10 @@ class cSummaryPeaksTableProxyModel : public QSortFilterProxyModel {
\param mode program mode
\param peaklistfileformat peaklist format
\param generateisotopepattern true if full isotope patterns are generated; false otherwise
+ \param rowsfiltercombobox reference to the combobox with selection of columns
+ \param rowsfiltercomparatorcombobox reference to the combobox with selection of comparator
*/
- void initialize(eModeType mode, ePeakListFileFormat peaklistfileformat, bool generateisotopepattern);
+ void initialize(eModeType mode, ePeakListFileFormat peaklistfileformat, bool generateisotopepattern, QComboBox* rowsfiltercombobox, QComboBox* rowsfiltercomparatorcombobox);
/**
@@ -78,6 +84,13 @@ class cSummaryPeaksTableProxyModel : public QSortFilterProxyModel {
void setRegion(int xmin, int xmax, int ymin, int ymax);
+ /**
+ \brief Set whole word option.
+ \param wholeword true if whole words are matched, false otherwise
+ */
+ void setWholeWord(bool wholeword);
+
+
protected:
@@ -98,7 +111,7 @@ class cSummaryPeaksTableProxyModel : public QSortFilterProxyModel {
*/
bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
-
+
};
diff --git a/CycloBranch/gui/cSummaryPeaksTableWidget.cpp b/CycloBranch/gui/cSummaryPeaksTableWidget.cpp
index 84ce54d..2d7a91c 100644
--- a/CycloBranch/gui/cSummaryPeaksTableWidget.cpp
+++ b/CycloBranch/gui/cSummaryPeaksTableWidget.cpp
@@ -31,34 +31,55 @@ cSummaryPeaksTableWidget::cSummaryPeaksTableWidget(QWidget* parent) {
menuFile = new QMenu(tr("&File"), this);
menuHelp = new QMenu(tr("&Help"), this);
+ rowsfiltercombobox = new QComboBox();
+ rowsfiltercombobox->setToolTip("Column to be Searched");
+ rowsfiltercombobox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
+ rowsfiltercomparatorcombobox = new QComboBox();
+ rowsfiltercomparatorcombobox->setToolTip("Type of Comparison");
+ rowsfiltercomparatorcombobox->addItem("=");
+ rowsfiltercomparatorcombobox->addItem("<");
+ rowsfiltercomparatorcombobox->addItem("<=");
+ rowsfiltercomparatorcombobox->addItem(">");
+ rowsfiltercomparatorcombobox->addItem(">=");
+ rowsfiltercomparatorcombobox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
rowsfilterline = new QLineEdit();
- rowsfilterline->setMinimumWidth(250);
+ rowsfilterline->setMinimumWidth(300);
rowsfilterline->setToolTip("Text to Find");
rowsfiltercasesensitive = new QCheckBox();
rowsfiltercasesensitive->setToolTip("Case Sensitive");
+ rowsfilterwholeword = new QCheckBox();
+ rowsfilterwholeword->setToolTip("Whole Words Only");
+
rowsfilterbutton = new QPushButton("Filter");
rowsfilterbutton->setToolTip("Filter Search Results");
- rowsfilterbutton->setMinimumWidth(50);
+ rowsfilterbutton->setMinimumWidth(75);
rowsfilterclearbutton = new QPushButton("Reset");
rowsfilterclearbutton->setToolTip("Reset Search Results");
- rowsfilterclearbutton->setMinimumWidth(50);
+ rowsfilterclearbutton->setMinimumWidth(75);
rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
rowsfilterhbox = new QHBoxLayout();
+ rowsfilterhbox->addWidget(rowsfiltercombobox);
+ rowsfilterhbox->addSpacing(10);
+ rowsfilterhbox->addWidget(rowsfiltercomparatorcombobox);
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterline);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfiltercasesensitive);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
+ rowsfilterhbox->addWidget(rowsfilterwholeword);
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterbutton);
- rowsfilterhbox->addStretch();
+ rowsfilterhbox->addSpacing(10);
rowsfilterhbox->addWidget(rowsfilterclearbutton);
rowsfilterwidget = new QWidget();
rowsfilterwidget->setLayout(rowsfilterhbox);
- rowsfilterwidget->setMaximumWidth(420);
database = new QTableView(this);
databasemodel = new QStandardItemModel(0, 0, this);
@@ -67,10 +88,13 @@ cSummaryPeaksTableWidget::cSummaryPeaksTableWidget(QWidget* parent) {
proxymodel->setDynamicSortFilter(false);
database->setModel(proxymodel);
database->setSortingEnabled(true);
+ database->setSelectionBehavior(QAbstractItemView::SelectItems);
+ database->setSelectionMode(QAbstractItemView::ContiguousSelection);
database->setEditTriggers(QAbstractItemView::NoEditTriggers);
database->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
database->horizontalHeader()->setSectionsMovable(true);
- database->verticalHeader()->setDefaultSectionSize(25);
+ //database->verticalHeader()->setDefaultSectionSize(30);
+ connect(database, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(rowDoubleClicked(const QModelIndex&)));
toolbarFile = addToolBar(tr("File"));
@@ -132,15 +156,17 @@ cSummaryPeaksTableWidget::cSummaryPeaksTableWidget(QWidget* parent) {
lastdirexportstatisticstocsv = "./";
coordinates.clear();
- coordinates_orig.clear();
}
cSummaryPeaksTableWidget::~cSummaryPeaksTableWidget() {
deleteTable();
+ delete rowsfiltercombobox;
+ delete rowsfiltercomparatorcombobox;
delete rowsfilterline;
delete rowsfiltercasesensitive;
+ delete rowsfilterwholeword;
delete rowsfilterbutton;
delete rowsfilterclearbutton;
delete rowsfilterhbox;
@@ -170,7 +196,7 @@ void cSummaryPeaksTableWidget::closeEvent(QCloseEvent *event) {
}
-bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandardmodel, cMainWindowProxyModel* resultsproxymodel, cParameters* parameters, cTheoreticalSpectrumList* spectralist) {
+bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandardmodel, cMainWindowProxyModel* resultsproxymodel, cParameters* parameters, cTheoreticalSpectrumList* spectralist, bool showisomers) {
if (!parameters || !spectralist || (resultsstandardmodel->rowCount() != spectralist->size())) {
return false;
}
@@ -178,6 +204,7 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
int spectracount = spectralist->size();
int thpeakscount = 0;
int spectrumindex;
+ int iontypecol;
cPeak* peak;
for (int i = 0; i < spectracount; i++) {
@@ -213,16 +240,15 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
resetFilter();
deleteTable();
- proxymodel->initialize(parameters->mode, parameters->peaklistfileformat, parameters->generateisotopepattern);
+ proxymodel->initialize(parameters->mode, parameters->peaklistfileformat, parameters->generateisotopepattern, rowsfiltercombobox, rowsfiltercomparatorcombobox);
coordinates.clear();
- coordinates_orig.clear();
// prepare the header
if (parameters->mode == dereplication) {
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
if (parameters->generateisotopepattern) {
- databasemodel->setColumnCount(13);
+ databasemodel->setColumnCount(15);
}
else {
databasemodel->setColumnCount(12);
@@ -230,7 +256,7 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
}
else {
if (parameters->generateisotopepattern) {
- databasemodel->setColumnCount(11);
+ databasemodel->setColumnCount(13);
}
else {
databasemodel->setColumnCount(10);
@@ -251,6 +277,8 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
int currentcolumn = 1;
if (parameters->mode == dereplication) {
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
+ iontypecol = 3;
+
databasemodel->setHorizontalHeaderItem(currentcolumn, new QStandardItem());
databasemodel->horizontalHeaderItem(currentcolumn)->setText("Coordinate X");
database->setItemDelegateForColumn(currentcolumn, new QItemDelegate());
@@ -261,8 +289,14 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
database->setItemDelegateForColumn(currentcolumn, new QItemDelegate());
currentcolumn++;
}
+
databasemodel->setHorizontalHeaderItem(currentcolumn, new QStandardItem());
- databasemodel->horizontalHeaderItem(currentcolumn)->setText("Ion Type");
+ if (parameters->generateisotopepattern) {
+ databasemodel->horizontalHeaderItem(currentcolumn)->setText("Pattern Type");
+ }
+ else {
+ databasemodel->horizontalHeaderItem(currentcolumn)->setText("Ion Type");
+ }
database->setItemDelegateForColumn(currentcolumn, new QItemDelegate());
currentcolumn++;
}
@@ -314,6 +348,18 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
currentcolumn++;
if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ databasemodel->setHorizontalHeaderItem(currentcolumn, new QStandardItem());
+ databasemodel->horizontalHeaderItem(currentcolumn)->setText("Score");
+ database->setItemDelegateForColumn(currentcolumn, new QItemDelegate());
+ currentcolumn++;
+
+ databasemodel->setHorizontalHeaderItem(currentcolumn, new QStandardItem());
+ databasemodel->horizontalHeaderItem(currentcolumn)->setText("FDR");
+ database->setItemDelegateForColumn(currentcolumn, new QItemDelegate());
+ currentcolumn++;
+ }
+
databasemodel->setHorizontalHeaderItem(currentcolumn, new QStandardItem());
databasemodel->horizontalHeaderItem(currentcolumn)->setText("Summary Formula");
if (parameters->generateisotopepattern) {
@@ -341,8 +387,12 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
currentcolumn++;
}
+ rowsfiltercombobox->clear();
for (int i = 0; i < databasemodel->columnCount(); i++) {
database->resizeColumnToContents(i);
+ if ((parameters->mode != dereplication) || ((parameters->mode == dereplication) && (i < databasemodel->columnCount() - 1))) {
+ rowsfiltercombobox->addItem(databasemodel->horizontalHeaderItem(i)->text());
+ }
}
@@ -354,7 +404,7 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
progress->setMinimumWidth(250);
progress->installEventFilter(&filter);
progress->setMinimumDuration(0);
- progress->setWindowModality(Qt::WindowModal);
+ progress->setWindowModality(Qt::ApplicationModal);
progress->setValue(0);
database->setModel(0);
@@ -363,20 +413,33 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
int secondspace, langle, rangle, tmp;
cPeaksList* thpeaks;
- string stmp;
+ string stmp, fragmentname;
int currentrow;
+ cPeaksList eicchromatogram;
+ eicchromatogram.clear();
+
QBrush brush;
brush.setColor(QColor(0, 0, 0));
for (int i = 0; i < spectracount; i++) {
if (!resultsproxymodel->mapFromSource(resultsstandardmodel->index(i, 0)).isValid()) {
+ if ((parameters->mode == dereplication) && (parameters->peaklistfileformat != mis) && (parameters->peaklistfileformat != imzML)) {
+ cPeak emptypeak;
+ emptypeak.mzratio = (double)(eicchromatogram.size() + 1);
+ emptypeak.absoluteintensity = 0;
+ eicchromatogram.add(emptypeak);
+ }
continue;
}
spectrumindex = resultsstandardmodel->item(i, 1)->data(Qt::DisplayRole).toInt() - 1;
+ if ((parameters->mode == dereplication) && (parameters->peaklistfileformat != mis) && (parameters->peaklistfileformat != imzML)) {
+ addEICPeak(eicchromatogram, (*spectralist)[spectrumindex].getExperimentalSpectrum());
+ }
+
if ((*spectralist)[spectrumindex].getNumberOfMatchedPeaks() == 0) {
progress->setValue(i);
continue;
@@ -474,6 +537,18 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
currentcolumn++;
if (parameters->mode == dereplication) {
+ if (parameters->generateisotopepattern) {
+ databasemodel->setItem(currentrow, currentcolumn, new QStandardItem());
+ databasemodel->item(currentrow, currentcolumn)->setForeground(brush);
+ databasemodel->item(currentrow, currentcolumn)->setData(QVariant::fromValue(cropPrecisionToSixDecimalsByteArray((*spectralist)[spectrumindex].getTargetPatternScore(peak->groupid))), Qt::DisplayRole);
+ currentcolumn++;
+
+ databasemodel->setItem(currentrow, currentcolumn, new QStandardItem());
+ databasemodel->item(currentrow, currentcolumn)->setForeground(brush);
+ databasemodel->item(currentrow, currentcolumn)->setData(QVariant::fromValue(cropPrecisionToSixDecimalsByteArray((*spectralist)[spectrumindex].getTargetPatternFDR(peak->groupid))), Qt::DisplayRole);
+ currentcolumn++;
+ }
+
databasemodel->setItem(currentrow, currentcolumn, new QStandardItem());
databasemodel->item(currentrow, currentcolumn)->setForeground(brush);
databasemodel->item(currentrow, currentcolumn)->setText(peak->description.substr(peak->description.rfind('(') + 1, peak->description.rfind(')') - peak->description.rfind('(') - 1).c_str());
@@ -486,11 +561,12 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
databasemodel->item(currentrow, currentcolumn)->setForeground(brush);
databasemodel->item(currentrow, currentcolumn)->setText(peak->description.substr(rangle + 1, langle - rangle - 1).c_str());
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
+ coordinates.back().name = databasemodel->item(currentrow, iontypecol)->text().toStdString() + " ";
if (databasemodel->item(currentrow, currentcolumn)->text().length() > 40) {
- coordinates.back().name = databasemodel->item(currentrow, currentcolumn)->text().toStdString().substr(0, 37) + "...";
+ coordinates.back().name += databasemodel->item(currentrow, currentcolumn)->text().toStdString().substr(0, 37) + "...";
}
else {
- coordinates.back().name = databasemodel->item(currentrow, currentcolumn)->text().toStdString();
+ coordinates.back().name += databasemodel->item(currentrow, currentcolumn)->text().toStdString();
}
}
currentcolumn++;
@@ -510,11 +586,12 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
databasemodel->item(currentrow, currentcolumn)->setForeground(brush);
databasemodel->item(currentrow, currentcolumn)->setText(peak->description.substr(secondspace + 1, peak->description.rfind('(') - secondspace - 2).c_str());
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
+ coordinates.back().name = databasemodel->item(currentrow, iontypecol)->text().toStdString() + " ";
if (databasemodel->item(currentrow, currentcolumn)->text().length() > 40) {
- coordinates.back().name = databasemodel->item(currentrow, currentcolumn)->text().toStdString().substr(0, 37) + "...";
+ coordinates.back().name += databasemodel->item(currentrow, currentcolumn)->text().toStdString().substr(0, 37) + "...";
}
else {
- coordinates.back().name = databasemodel->item(currentrow, currentcolumn)->text().toStdString();
+ coordinates.back().name += databasemodel->item(currentrow, currentcolumn)->text().toStdString();
}
}
currentcolumn++;
@@ -530,13 +607,17 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
databasemodel->item(currentrow, currentcolumn)->setForeground(brush);
databasemodel->item(currentrow, currentcolumn)->setText("");
if (peak->description.find(':') + 2 < peak->description.size()) {
- databasemodel->item(currentrow, currentcolumn)->setText(peak->description.substr(peak->description.find(':') + 2).c_str());
+ fragmentname = peak->description.substr(peak->description.find(':') + 2);
+ if (!showisomers) {
+ stripIsomers(fragmentname);
+ }
+ databasemodel->item(currentrow, currentcolumn)->setText(fragmentname.c_str());
}
currentcolumn++;
}
}
-
+
progress->setValue(i);
if (progress->wasCanceled()) {
deleteTable();
@@ -548,8 +629,8 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
proxymodel->setSourceModel(databasemodel);
database->setModel(proxymodel);
- proxymodel->setSortRole(Qt::InitialSortOrderRole);
database->setSortingEnabled(true);
+ proxymodel->sort(-1);
if (!progress->wasCanceled()) {
for (int i = 0; i < databasemodel->columnCount(); i++) {
@@ -560,19 +641,22 @@ bool cSummaryPeaksTableWidget::prepareToShow(QStandardItemModel* resultsstandard
if ((parameters->mode == dereplication) && !progress->wasCanceled()) {
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
emit resetRegion();
- emit sendFilterOptions(coordinates, rowsfilterline->text().toStdString(), rowsfiltercasesensitive->isChecked());
- coordinates_orig = coordinates;
+ emit sendFilterOptionsToImageWindow(coordinates, rowsfiltercombobox->currentText().toStdString(), rowsfiltercomparatorcombobox->currentText().toStdString(), rowsfilterline->text().toStdString(), rowsfiltercasesensitive->isChecked(), rowsfilterwholeword->isChecked());
if (parameters->generateisotopepattern) {
- database->setColumnWidth(10, min(400, database->columnWidth(10)));
+ database->setColumnWidth(12, min(400, database->columnWidth(12)));
}
else {
database->setColumnWidth(9, min(400, database->columnWidth(9)));
}
}
else {
+ eicchromatogram.normalizeIntenzity();
+ origeicchromatogram = eicchromatogram;
+ emit sendFilterOptionsToChromatogram(eicchromatogram);
+
if (parameters->generateisotopepattern) {
- database->setColumnWidth(8, min(400, database->columnWidth(8)));
+ database->setColumnWidth(10, min(400, database->columnWidth(10)));
}
else {
database->setColumnWidth(7, min(400, database->columnWidth(7)));
@@ -603,11 +687,34 @@ void cSummaryPeaksTableWidget::updateFilterBySelectedRegion(int xmin, int xmax,
}
+void cSummaryPeaksTableWidget::addEICPeak(cPeaksList& eicchromatogram, cPeaksList& experimentalspectrum) {
+ unsigned long long intensity = 0;
+ cPeak peak;
+
+ int size = experimentalspectrum.size();
+ for (int i = 0; i < size; i++) {
+ if (experimentalspectrum[i].matched == 0) {
+ continue;
+ }
+ intensity += experimentalspectrum[i].absoluteintensity;
+ }
+ peak.clear();
+ peak.mzratio = (double)(eicchromatogram.size() + 1);
+ peak.absoluteintensity = intensity;
+ eicchromatogram.add(peak);
+}
+
+
void cSummaryPeaksTableWidget::keyPressEvent(QKeyEvent *event) {
if ((event->key() == Qt::Key_Enter) || (event->key() == Qt::Key_Return)) {
if (rowsfilterline->hasFocus()) {
filterRows();
}
+ else {
+ if (database->selectionModel()->selectedIndexes().count() > 0) {
+ rowDoubleClicked(database->selectionModel()->selectedIndexes()[0]);
+ }
+ }
}
if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_F)) {
@@ -618,6 +725,10 @@ void cSummaryPeaksTableWidget::keyPressEvent(QKeyEvent *event) {
rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked());
}
+ if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_W)) {
+ rowsfilterwholeword->setChecked(!rowsfilterwholeword->isChecked());
+ }
+
event->accept();
}
@@ -630,11 +741,12 @@ void cSummaryPeaksTableWidget::closeWindow() {
void cSummaryPeaksTableWidget::filterRows() {
Qt::CaseSensitivity casesensitive = rowsfiltercasesensitive->isChecked()?Qt::CaseSensitive:Qt::CaseInsensitive;
QString str = rowsfilterline->text();
- int rowcount = databasemodel->rowCount();
- bool match;
- int i, j, x, y;
+ int i, id, x, y;
int iontypecol, mzcol, relintcol, absintcol, namecol;
+ cPeaksList eicchromatogram;
+ eicchromatogram.clear();
+
if (parameters->mode == dereplication) {
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
iontypecol = 3;
@@ -642,7 +754,7 @@ void cSummaryPeaksTableWidget::filterRows() {
mzcol = 6;
relintcol = 7;
absintcol = 8;
- namecol = 11;
+ namecol = 13;
}
else {
mzcol = 5;
@@ -651,91 +763,97 @@ void cSummaryPeaksTableWidget::filterRows() {
namecol = 10;
}
}
+ else {
+ if (parameters->generateisotopepattern) {
+ absintcol = 6;
+ }
+ else {
+ absintcol = 5;
+ }
+
+ eicchromatogram = origeicchromatogram;
+ for (i = 0; i < eicchromatogram.size(); i++) {
+ eicchromatogram[i].absoluteintensity = 0;
+ eicchromatogram[i].relativeintensity = 0;
+ }
+ }
}
- QProgressDialog progress("Updating...", "Cancel", 0, rowcount, this);
+ QProgressDialog progress("Updating...", "Cancel", 0, databasemodel->rowCount(), this);
progress.setMinimumWidth(250);
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
- coordinates.clear();
+ // filter table
+ proxymodel->setWholeWord(rowsfilterwholeword->isChecked());
+ proxymodel->setFilterKeyColumn(-1);
+ proxymodel->setFilterCaseSensitivity(casesensitive);
+ proxymodel->setFilterFixedString(str);
- for (i = 0; i < rowcount; i++) {
- x = databasemodel->item(i, 1)->data(Qt::DisplayRole).toInt();
- y = databasemodel->item(i, 2)->data(Qt::DisplayRole).toInt();
+ // prepare data for visualization
+ coordinates.clear();
+ if (parameters->mode == dereplication) {
+ if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
+ int proxymodelrowcount = proxymodel->rowCount();
+ for (i = 0; i < proxymodelrowcount; i++) {
+ x = databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, 1)))->data(Qt::DisplayRole).toInt();
+ y = databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, 2)))->data(Qt::DisplayRole).toInt();
- match = false;
- for (j = 0; j < databasemodel->columnCount(); j++) {
- // ignore non-text fields
- if (parameters->mode == dereplication) {
- if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
- if (parameters->generateisotopepattern) {
- if (j == 12) {
- continue;
- }
- }
- else {
- if (j == 11) {
- continue;
- }
- }
- }
- else {
- if (parameters->generateisotopepattern) {
- if (j == 10) {
- continue;
- }
+ if (((proxymodel->xmin == -1) && (proxymodel->xmax == -1) && (proxymodel->ymin == -1) && (proxymodel->ymax == -1)) || ((x >= proxymodel->xmin) && (x <= proxymodel->xmax) && (y >= proxymodel->ymin) && (y <= proxymodel->ymax))) {
+ coordinates.push_back(cCoordinates(
+ x,
+ y,
+ databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, 0)))->text().toInt(),
+ databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, mzcol)))->data(Qt::DisplayRole).toDouble(),
+ databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, relintcol)))->data(Qt::DisplayRole).toDouble(),
+ databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, absintcol)))->data(Qt::DisplayRole).toDouble()
+ ));
+ coordinates.back().name = databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, iontypecol)))->text().toStdString() + " ";
+ if (databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, namecol)))->text().length() > 40) {
+ coordinates.back().name += databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, namecol)))->text().toStdString().substr(0, 37) + "...";
}
else {
- if (j == 9) {
- continue;
- }
+ coordinates.back().name += databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, namecol)))->text().toStdString();
}
}
- }
- if (databasemodel->item(i, j) && databasemodel->item(i, j)->text().contains(str, casesensitive)) {
- if (parameters->mode == dereplication) {
- if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
- if (((proxymodel->xmin == -1) && (proxymodel->xmax == -1) && (proxymodel->ymin == -1) && (proxymodel->ymax == -1)) || ((x >= proxymodel->xmin) && (x <= proxymodel->xmax) && (y >= proxymodel->ymin) && (y <= proxymodel->ymax))) {
- coordinates.push_back(cCoordinates(databasemodel->item(i, 1)->text().toInt(), databasemodel->item(i, 2)->text().toInt(), databasemodel->item(i, 0)->text().toInt(), databasemodel->item(i, mzcol)->data(Qt::DisplayRole).toDouble(), databasemodel->item(i, relintcol)->data(Qt::DisplayRole).toDouble(), databasemodel->item(i, absintcol)->data(Qt::DisplayRole).toDouble()));
- coordinates.back().name = databasemodel->item(i, iontypecol)->text().toStdString() + " ";
- if (databasemodel->item(i, namecol)->text().length() > 40) {
- coordinates.back().name += databasemodel->item(i, namecol)->text().toStdString().substr(0, 37) + "...";
- }
- else {
- coordinates.back().name += databasemodel->item(i, namecol)->text().toStdString();
- }
- }
- }
- }
+ progress.setValue(i);
- match = true;
- break;
+ if (progress.wasCanceled()) {
+ resetFilter();
+ break;
+ }
}
}
- progress.setValue(i);
+ else {
+ int proxymodelrowcount = proxymodel->rowCount();
+ for (i = 0; i < proxymodelrowcount; i++) {
+ id = databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, 0)))->data(Qt::DisplayRole).toInt() - 1;
+ eicchromatogram[id].absoluteintensity += databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(i, absintcol)))->data(Qt::DisplayRole).toDouble();
- if (progress.wasCanceled()) {
- resetFilter();
- break;
- }
+ progress.setValue(i);
+ if (progress.wasCanceled()) {
+ resetFilter();
+ break;
+ }
+ }
+ }
}
if ((parameters->mode == dereplication) && !progress.wasCanceled()) {
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
- emit sendFilterOptions(coordinates, rowsfilterline->text().toStdString(), rowsfiltercasesensitive->isChecked());
+ emit sendFilterOptionsToImageWindow(coordinates, rowsfiltercombobox->currentText().toStdString(), rowsfiltercomparatorcombobox->currentText().toStdString(), rowsfilterline->text().toStdString(), rowsfiltercasesensitive->isChecked(), rowsfilterwholeword->isChecked());
+ }
+ else {
+ eicchromatogram.normalizeIntenzity();
+ emit sendFilterOptionsToChromatogram(eicchromatogram);
}
}
- proxymodel->setFilterKeyColumn(-1);
- proxymodel->setFilterCaseSensitivity(casesensitive);
- proxymodel->setFilterFixedString(str);
-
- progress.setValue(rowcount);
+ progress.setValue(databasemodel->rowCount());
}
@@ -746,6 +864,9 @@ void cSummaryPeaksTableWidget::resetFilter() {
int i, x, y;
int iontypecol, mzcol, relintcol, absintcol, namecol;
+ cPeaksList eicchromatogram;
+ eicchromatogram.clear();
+
if (parameters->mode == dereplication) {
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
iontypecol = 3;
@@ -753,7 +874,7 @@ void cSummaryPeaksTableWidget::resetFilter() {
mzcol = 6;
relintcol = 7;
absintcol = 8;
- namecol = 11;
+ namecol = 13;
}
else {
mzcol = 5;
@@ -769,17 +890,24 @@ void cSummaryPeaksTableWidget::resetFilter() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
+ coordinates.clear();
if (parameters->mode == dereplication) {
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
- coordinates.clear();
for (i = 0; i < rowcount; i++) {
x = databasemodel->item(i, 1)->data(Qt::DisplayRole).toInt();
y = databasemodel->item(i, 2)->data(Qt::DisplayRole).toInt();
if (((proxymodel->xmin == -1) && (proxymodel->xmax == -1) && (proxymodel->ymin == -1) && (proxymodel->ymax == -1)) || ((x >= proxymodel->xmin) && (x <= proxymodel->xmax) && (y >= proxymodel->ymin) && (y <= proxymodel->ymax))) {
- coordinates.push_back(cCoordinates(x, y, databasemodel->item(i, 0)->text().toInt(), databasemodel->item(i, mzcol)->data(Qt::DisplayRole).toDouble(), databasemodel->item(i, relintcol)->data(Qt::DisplayRole).toDouble(), databasemodel->item(i, absintcol)->data(Qt::DisplayRole).toDouble()));
+ coordinates.push_back(cCoordinates(
+ x,
+ y,
+ databasemodel->item(i, 0)->text().toInt(),
+ databasemodel->item(i, mzcol)->data(Qt::DisplayRole).toDouble(),
+ databasemodel->item(i, relintcol)->data(Qt::DisplayRole).toDouble(),
+ databasemodel->item(i, absintcol)->data(Qt::DisplayRole).toDouble()
+ ));
coordinates.back().name = databasemodel->item(i, iontypecol)->text().toStdString() + " ";
if (databasemodel->item(i, namecol)->text().length() > 40) {
coordinates.back().name += databasemodel->item(i, namecol)->text().toStdString().substr(0, 37) + "...";
@@ -791,13 +919,18 @@ void cSummaryPeaksTableWidget::resetFilter() {
progress.setValue(i);
}
- emit sendFilterOptions(coordinates, rowsfilterline->text().toStdString(), rowsfiltercasesensitive->isChecked());
+ emit sendFilterOptionsToImageWindow(coordinates, rowsfiltercombobox->currentText().toStdString(), rowsfiltercomparatorcombobox->currentText().toStdString(), rowsfilterline->text().toStdString(), rowsfiltercasesensitive->isChecked(), rowsfilterwholeword->isChecked());
+ }
+ else {
+ eicchromatogram = origeicchromatogram;
+ emit sendFilterOptionsToChromatogram(eicchromatogram);
}
}
database->horizontalHeader()->setSortIndicator(-1, Qt::AscendingOrder);
proxymodel->sort(-1);
+ proxymodel->setWholeWord(false);
proxymodel->setFilterKeyColumn(-1);
proxymodel->setFilterFixedString("");
@@ -816,7 +949,7 @@ void cSummaryPeaksTableWidget::exportToCsv() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
bool removefile = false;
QFile file(filename);
@@ -890,7 +1023,7 @@ void cSummaryPeaksTableWidget::exportStatistics() {
cEventFilter filter;
progress.installEventFilter(&filter);
progress.setMinimumDuration(0);
- progress.setWindowModality(Qt::WindowModal);
+ progress.setWindowModality(Qt::ApplicationModal);
bool removefile = false;
QFile file(filename);
@@ -909,6 +1042,7 @@ void cSummaryPeaksTableWidget::exportStatistics() {
int idcol;
int xcol, ycol;
int relintcol, absintcol;
+ int scorecol, qvaluecol;
int experimentalmzcol;
int ppmcol;
@@ -919,10 +1053,11 @@ void cSummaryPeaksTableWidget::exportStatistics() {
if (parameters->generateisotopepattern) {
iontypecol = 3;
theoreticalmzcol = 4;
- summaryformulacol = 10;
- namecol = 11;
- referencecol = 12;
-
+ summaryformulacol = 12;
+ namecol = 13;
+ referencecol = 14;
+ scorecol = 10;
+ qvaluecol = 11;
idcol = 0;
xcol = 1;
ycol = 2;
@@ -935,7 +1070,6 @@ void cSummaryPeaksTableWidget::exportStatistics() {
summaryformulacol = 9;
namecol = 10;
referencecol = 11;
-
idcol = 0;
xcol = 1;
ycol = 2;
@@ -947,10 +1081,11 @@ void cSummaryPeaksTableWidget::exportStatistics() {
if (parameters->generateisotopepattern) {
iontypecol = 1;
theoreticalmzcol = 2;
- summaryformulacol = 8;
- namecol = 9;
- referencecol = 10;
-
+ summaryformulacol = 10;
+ namecol = 11;
+ referencecol = 12;
+ scorecol = 8;
+ qvaluecol = 9;
idcol = 0;
relintcol = 5;
absintcol = 6;
@@ -961,7 +1096,6 @@ void cSummaryPeaksTableWidget::exportStatistics() {
summaryformulacol = 7;
namecol = 8;
referencecol = 9;
-
idcol = 0;
relintcol = 4;
absintcol = 5;
@@ -984,7 +1118,8 @@ void cSummaryPeaksTableWidget::exportStatistics() {
ppmcol = 6;
}
- map, cSummaryTableKeyMS_comp> mapms;
+ map, cIonSummaryTableKeyMS_comp> ionmapms;
+ map, cEnvelopeSummaryTableKeyMS_comp> envelopemapms;
cSummaryTableKeyMS keyms;
map, cSummaryTableKeyMSMS_comp> mapmsms;
@@ -1018,14 +1153,26 @@ void cSummaryPeaksTableWidget::exportStatistics() {
keyms.reference = item->text().toStdString();
}
- auto obj = mapms.find(keyms);
- if (obj != mapms.end()) {
+ auto obj = ionmapms.find(keyms);
+ if (obj != ionmapms.end()) {
obj->second.push_back(i);
}
else {
vector v;
v.push_back(i);
- mapms.insert(std::pair< cSummaryTableKeyMS, vector >(keyms, v));
+ ionmapms.insert(std::pair< cSummaryTableKeyMS, vector >(keyms, v));
+ }
+
+ if (parameters->generateisotopepattern) {
+ obj = envelopemapms.find(keyms);
+ if (obj != envelopemapms.end()) {
+ obj->second.push_back(i);
+ }
+ else {
+ vector v;
+ v.push_back(i);
+ envelopemapms.insert(std::pair< cSummaryTableKeyMS, vector >(keyms, v));
+ }
}
}
@@ -1078,31 +1225,148 @@ void cSummaryPeaksTableWidget::exportStatistics() {
int xmin, xmax, ymin, ymax;
double relintmax, relintavg, relintmed, relintcur;
double absintmax, absintavg, absintmed, absintcur;
+ double scoremin, scoreavg, scoremed, scoremax, scorecur;
+ double qvaluemin, qvalueavg, qvaluemed, qvaluemax, qvaluecur;
vector relintmedianvector;
vector absintmedianvector;
+ vector scoremedianvector;
+ vector qvaluemedianvector;
if (parameters->mode == dereplication) {
- out << "Number of Points, ID (min), ID (max), ";
+ auto cmpms = [](pair > const &a, pair > const &b) {
+ if (a.first.name < b.first.name) {
+ return true;
+ }
+
+ if (a.first.name > b.first.name) {
+ return false;
+ }
+
+ if (a.first.iontype < b.first.iontype) {
+ return true;
+ }
+
+ if (a.first.iontype > b.first.iontype) {
+ return false;
+ }
+
+ if (a.first.theoreticalmz < b.first.theoreticalmz) {
+ return true;
+ }
+
+ if (a.first.theoreticalmz > b.first.theoreticalmz) {
+ return false;
+ }
+
+ return true;
+ };
+
+ if (parameters->generateisotopepattern) {
+
+ vector< pair > > envelopestatisticsms;
+
+ for (auto it = envelopemapms.begin(); it != envelopemapms.end(); ++it) {
+ envelopestatisticsms.push_back(*it);
+ }
+
+ sort(envelopestatisticsms.begin(), envelopestatisticsms.end(), cmpms);
+
+ out << "\"Whole Pattern Statistics\"" << endl << endl;
+
+ out << "\"Name\",\"Pattern Type\",";
+ out << "\"Minimum Score\",\"Average Score\",\"Median Score\",\"Maximum Score\",";
+ out << "\"Minimum FDR\",\"Average FDR\",\"Median FDR\",\"Maximum FDR\",";
+ out << "\"Reference\"" << endl;
+
+ for (auto it = envelopestatisticsms.begin(); it != envelopestatisticsms.end(); ++it) {
+
+ scoremin = DBL_MAX;
+ scoremax = 0;
+ scoreavg = 0;
+ scoremedianvector.clear();
+
+ qvaluemin = DBL_MAX;
+ qvaluemax = 0;
+ qvalueavg = 0;
+ qvaluemedianvector.clear();
+
+ for (auto it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
+ item = databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(*it2, scorecol)));
+ if (item) {
+ scorecur = item->data(Qt::DisplayRole).toDouble();
+ if (scorecur > scoremax) {
+ scoremax = scorecur;
+ }
+ if (scorecur < scoremin) {
+ scoremin = scorecur;
+ }
+ scoreavg += scorecur;
+ scoremedianvector.push_back(scorecur);
+ }
+
+ item = databasemodel->itemFromIndex(proxymodel->mapToSource(proxymodel->index(*it2, qvaluecol)));
+ if (item) {
+ qvaluecur = item->data(Qt::DisplayRole).toDouble();
+ if (qvaluecur > qvaluemax) {
+ qvaluemax = qvaluecur;
+ }
+ if (qvaluecur < qvaluemin) {
+ qvaluemin = qvaluecur;
+ }
+ qvalueavg += qvaluecur;
+ qvaluemedianvector.push_back(qvaluecur);
+ }
+ }
+
+ scoreavg /= (double)it->second.size();
+ qvalueavg /= (double)it->second.size();
+
+ scoremed = median(scoremedianvector);
+ qvaluemed = median(qvaluemedianvector);
+
+ out << "\"" << it->first.name.c_str() << "\",\"" << it->first.iontype.c_str() << "\",\"";
+
+ stringstream ss;
+ ss << std::fixed << std::setprecision(6) << scoremin << "\",\"" << scoreavg << "\",\"" << scoremed << "\",\"" << scoremax << "\",\"";
+ ss << std::fixed << std::setprecision(6) << qvaluemin << "\",\"" << qvalueavg << "\",\"" << qvaluemed << "\",\"" << qvaluemax << "\",\"";
+ out << ss.str().c_str();
+
+ out << it->first.reference.c_str() << "\"" << endl;
+
+ }
+
+ out << endl << endl;
+
+ }
+
+ out << "\"Single Peak Statistics\"" << endl << endl;
+
+ out << "\"Name\",";
+ if (parameters->generateisotopepattern) {
+ out << "\"Pattern Type\",";
+ }
+ else {
+ out << "\"Ion Type\",";
+ }
+ out << "\"Number of Spectra\",\"Theoretical m/z\",";
+ out << "\"Average Relative Intensity [%]\",\"Median Relative Intensity [%]\",\"Maximum Relative Intensity [%]\",";
+ out << "\"Average Absolute Intensity\",\"Median Absolute Intensity\",\"Maximum Absolute Intensity\",";
+ out << "\"ID (min)\",\"ID (max)\",";
if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
- out << "Coordinate X (min), Coordinate X (max), Coordinate Y (min), Coordinate Y (max), ";
+ out << "\"Coordinate X (min)\",\"Coordinate X (max)\",\"Coordinate Y (min)\",\"Coordinate Y (max)\",";
}
- out << "Ion Type, Theoretical m/z, Average Relative Intensity [%], Median Relative Intensity [%], Maximum Relative Intensity [%], ";
- out << "Average Absolute Intensity, Median Absolute Intensity, Maximum Absolute Intensity, ";
- out << "Summary Formula, Name, Reference" << endl;
+ out << "\"Summary Formula\"" << endl;
- vector< pair > > statisticsms;
+ vector< pair > > ionstatisticsms;
- for (auto it = mapms.begin(); it != mapms.end(); ++it) {
- statisticsms.push_back(*it);
+ for (auto it = ionmapms.begin(); it != ionmapms.end(); ++it) {
+ ionstatisticsms.push_back(*it);
}
- auto cmpms = [](pair > const &a, pair > const &b) {
- return a.second.size() > b.second.size();
- };
- sort(statisticsms.begin(), statisticsms.end(), cmpms);
+ sort(ionstatisticsms.begin(), ionstatisticsms.end(), cmpms);
- for (auto it = statisticsms.begin(); it != statisticsms.end(); ++it) {
+ for (auto it = ionstatisticsms.begin(); it != ionstatisticsms.end(); ++it) {
idmin = INT32_MAX;
idmax = 0;
@@ -1183,25 +1447,26 @@ void cSummaryPeaksTableWidget::exportStatistics() {
relintmed = median(relintmedianvector);
absintmed = median(absintmedianvector);
- out << it->second.size() << ", " << idmin << ", " << idmax << ", ";
- if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
- out << xmin << ", " << xmax << ", " << ymin << ", " << ymax << ", ";
- }
- out << it->first.iontype.c_str() << ", " << it->first.theoreticalmz.c_str() << ", ";
+ out << "\"" << it->first.name.c_str() << "\",\"" << it->first.iontype.c_str() << "\",\"" << it->second.size() << "\",\"" << it->first.theoreticalmz.c_str() << "\",\"";
stringstream ss;
- ss << std::fixed << std::setprecision(2) << relintavg << ", " << relintmed << ", " << relintmax << ", ";
- ss << std::fixed << std::setprecision(0) << absintavg << ", " << absintmed << ", " << absintmax << ", ";
+ ss << std::fixed << std::setprecision(2) << relintavg << "\",\"" << relintmed << "\",\"" << relintmax << "\",\"";
+ ss << std::fixed << std::setprecision(0) << absintavg << "\",\"" << absintmed << "\",\"" << absintmax << "\",\"";
out << ss.str().c_str();
- out << stripHTML(it->first.summaryformula).c_str() << ", " << it->first.name.c_str() << ", " << it->first.reference.c_str() << endl;
+ out << idmin << "\",\"" << idmax << "\",\"";
+ if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
+ out << xmin << "\",\"" << xmax << "\",\"" << ymin << "\",\"" << ymax << "\",\"";
+ }
+
+ out << stripHTML(it->first.summaryformula).c_str() << "\"" << endl;
}
}
else {
- out << "Number of Matches, Theoretical m/z, Experimental m/z, Relative Intensity [%], Absolute Intensity, Error [ppm]" << endl;
+ out << "\"Number of Matches\",\"Theoretical m/z\",\"Experimental m/z\",\"Relative Intensity [%]\",\"Absolute Intensity\",\"Error [ppm]\"" << endl;
vector< pair > > statisticsmsms;
@@ -1215,7 +1480,7 @@ void cSummaryPeaksTableWidget::exportStatistics() {
sort(statisticsmsms.begin(), statisticsmsms.end(), cmpmsms);
for (auto it = statisticsmsms.begin(); it != statisticsmsms.end(); ++it) {
- out << it->second.size() << ", " << it->first.theoreticalmz.c_str() << ", " << it->first.experimentalmz.c_str() << ", " << it->first.relint.c_str() << ", " << it->first.absint.c_str() << ", " << it->first.ppmerror.c_str() << endl;
+ out << "\"" << it->second.size() << "\",\"" << it->first.theoreticalmz.c_str() << "\",\"" << it->first.experimentalmz.c_str() << "\",\"" << it->first.relint.c_str() << "\",\"" << it->first.absint.c_str() << "\",\"" << it->first.ppmerror.c_str() << "\"" << endl;
}
}
@@ -1239,3 +1504,40 @@ void cSummaryPeaksTableWidget::showHTMLDocumentation() {
#endif
}
+
+void cSummaryPeaksTableWidget::rowDoubleClicked(const QModelIndex& item) {
+ int size;
+
+ if (parameters->mode == dereplication) {
+ if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) {
+ if (parameters->generateisotopepattern) {
+ size = 14;
+ }
+ else {
+ size = 11;
+ }
+ }
+ else {
+ if (parameters->generateisotopepattern) {
+ size = 12;
+ }
+ else {
+ size = 9;
+ }
+ }
+ }
+ else if (parameters->mode == denovoengine) {
+ size = 9;
+ }
+ else {
+ size = 8;
+ }
+
+ int row = proxymodel->mapToSource(item).row();
+ int column = proxymodel->mapToSource(item).column();
+
+ if (column < size) {
+ emit summaryPeaksTableRowDoubleClicked(databasemodel->item(row, 0)->data(Qt::DisplayRole).toInt() - 1);
+ }
+}
+
diff --git a/CycloBranch/gui/cSummaryPeaksTableWidget.h b/CycloBranch/gui/cSummaryPeaksTableWidget.h
index de11772..b9e7bfc 100644
--- a/CycloBranch/gui/cSummaryPeaksTableWidget.h
+++ b/CycloBranch/gui/cSummaryPeaksTableWidget.h
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
#include