diff --git a/CycloBranch/CycloBranch-Linux.pro b/CycloBranch/CycloBranch-Linux.pro index 996dcea..20323f5 100644 --- a/CycloBranch/CycloBranch-Linux.pro +++ b/CycloBranch/CycloBranch-Linux.pro @@ -7,7 +7,7 @@ TARGET = CycloBranch QT += core gui widgets printsupport svg INCLUDEPATH += . core gui parallel QMAKE_CXXFLAGS += -std=c++0x -DLINUX -m64 -QMAKE_LIBS += -lboost_regex +QMAKE_LIBS += -lboost_regex -lxerces-c OBJECTS_DIR = build/ MOC_DIR = moc/ @@ -21,8 +21,10 @@ HEADERS += core/cAllocator.h \ core/cDeNovoGraph.h \ core/cDeNovoGraphNode.h \ core/cFragmentIons.h \ + core/cImzML.h \ core/cParameters.h \ core/cPeak.h \ + core/cPeakListSeries.h \ core/cPeaksList.h \ core/cSequence.h \ core/cSequenceDatabase.h \ @@ -31,16 +33,18 @@ HEADERS += core/cAllocator.h \ core/cTheoreticalSpectrumList.h \ core/utilities.h \ gui/cAboutWidget.h \ + gui/cBranchCyclicWidget.h \ gui/cBranchedWidget.h \ gui/cBricksDatabaseWidget.h \ gui/cCyclicWidget.h \ + gui/cDelegate.h \ gui/cDrawPeptideWidget.h \ gui/cEventFilter.h \ gui/cExportDialog.h \ gui/cFindDialog.h \ gui/cFragmentIonsListWidget.h \ gui/cGraphWidget.h \ - gui/cLassoWidget.h \ + gui/cHTMLExportDialog.h \ gui/cLinearWidget.h \ gui/cMainThread.h \ gui/cMainWindow.h \ @@ -58,8 +62,10 @@ SOURCES += core/cBrick.cpp \ core/cDeNovoGraph.cpp \ core/cDeNovoGraphNode.cpp \ core/cFragmentIons.cpp \ + core/cImzML.cpp \ core/cParameters.cpp \ core/cPeak.cpp \ + core/cPeakListSeries.cpp \ core/cPeaksList.cpp \ core/cSequence.cpp \ core/cSequenceDatabase.cpp \ @@ -68,16 +74,18 @@ SOURCES += core/cBrick.cpp \ core/cTheoreticalSpectrumList.cpp \ core/utilities.cpp \ gui/cAboutWidget.cpp \ + gui/cBranchCyclicWidget.cpp \ gui/cBranchedWidget.cpp \ gui/cBricksDatabaseWidget.cpp \ gui/cCyclicWidget.cpp \ + gui/cDelegate.cpp \ gui/cDrawPeptideWidget.cpp \ gui/cEventFilter.cpp \ gui/cExportDialog.cpp \ gui/cFindDialog.cpp \ gui/cFragmentIonsListWidget.cpp \ gui/cGraphWidget.cpp \ - gui/cLassoWidget.cpp \ + gui/cHTMLExportDialog.cpp \ gui/cLinearWidget.cpp \ gui/cMainThread.cpp \ gui/cMainWindow.cpp \ diff --git a/CycloBranch/CycloBranch-MacOSX.pro b/CycloBranch/CycloBranch-MacOSX.pro index 822b6d9..7014a69 100644 --- a/CycloBranch/CycloBranch-MacOSX.pro +++ b/CycloBranch/CycloBranch-MacOSX.pro @@ -5,10 +5,10 @@ TEMPLATE = app TARGET = CycloBranch QT += core gui widgets printsupport svg -INCLUDEPATH += . core gui parallel /usr/local/Cellar/boost/1.57.0/include +INCLUDEPATH += . core gui parallel /usr/local/Cellar/boost/1.57.0/include /usr/local/Cellar/xerces-c/3.1.1/include QMAKE_CXXFLAGS += -std=c++0x -DMACOSX -m64 -QMAKE_LIBS += -lboost_regex -QMAKE_LIBDIR = /usr/local/Cellar/boost/1.57.0/lib +QMAKE_LIBS += -lboost_regex -lxerces-c +QMAKE_LIBDIR = /usr/local/Cellar/boost/1.57.0/lib /usr/local/Cellar/xerces-c/3.1.1/lib OBJECTS_DIR = build/ MOC_DIR = moc/ ICON = images/cb.icns @@ -29,8 +29,10 @@ HEADERS += core/cAllocator.h \ core/cDeNovoGraph.h \ core/cDeNovoGraphNode.h \ core/cFragmentIons.h \ + core/cImzML.h \ core/cParameters.h \ core/cPeak.h \ + core/cPeakListSeries.h \ core/cPeaksList.h \ core/cSequence.h \ core/cSequenceDatabase.h \ @@ -39,16 +41,18 @@ HEADERS += core/cAllocator.h \ core/cTheoreticalSpectrumList.h \ core/utilities.h \ gui/cAboutWidget.h \ + gui/cBranchCyclicWidget.h \ gui/cBranchedWidget.h \ gui/cBricksDatabaseWidget.h \ gui/cCyclicWidget.h \ + gui/cDelegate.h \ gui/cDrawPeptideWidget.h \ gui/cEventFilter.h \ gui/cExportDialog.h \ gui/cFindDialog.h \ gui/cFragmentIonsListWidget.h \ gui/cGraphWidget.h \ - gui/cLassoWidget.h \ + gui/cHTMLExportDialog.h \ gui/cLinearWidget.h \ gui/cMainThread.h \ gui/cMainWindow.h \ @@ -66,8 +70,10 @@ SOURCES += core/cBrick.cpp \ core/cDeNovoGraph.cpp \ core/cDeNovoGraphNode.cpp \ core/cFragmentIons.cpp \ + core/cImzML.cpp \ core/cParameters.cpp \ core/cPeak.cpp \ + core/cPeakListSeries.cpp \ core/cPeaksList.cpp \ core/cSequence.cpp \ core/cSequenceDatabase.cpp \ @@ -76,16 +82,18 @@ SOURCES += core/cBrick.cpp \ core/cTheoreticalSpectrumList.cpp \ core/utilities.cpp \ gui/cAboutWidget.cpp \ + gui/cBranchCyclicWidget.cpp \ gui/cBranchedWidget.cpp \ gui/cBricksDatabaseWidget.cpp \ gui/cCyclicWidget.cpp \ + gui/cDelegate.cpp \ gui/cDrawPeptideWidget.cpp \ gui/cEventFilter.cpp \ gui/cExportDialog.cpp \ gui/cFindDialog.cpp \ gui/cFragmentIonsListWidget.cpp \ gui/cGraphWidget.cpp \ - gui/cLassoWidget.cpp \ + gui/cHTMLExportDialog.cpp \ gui/cLinearWidget.cpp \ gui/cMainThread.cpp \ gui/cMainWindow.cpp \ diff --git a/CycloBranch/CycloBranch.vcxproj b/CycloBranch/CycloBranch.vcxproj index 3431970..714f7a1 100644 --- a/CycloBranch/CycloBranch.vcxproj +++ b/CycloBranch/CycloBranch.vcxproj @@ -125,7 +125,7 @@ UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_PRINTSUPPORT_LIB;QT_SVG_LIB;%(PreprocessorDefinitions) - .;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtPrintSupport;C:\boost_1_57_0\;C:\boost_1_57_0\boost;%(AdditionalIncludeDirectories) + .;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtPrintSupport;C:\boost_1_57_0\;C:\xerces-c-3.1.1\include;%(AdditionalIncludeDirectories) ProgramDatabase MultiThreadedDLL true @@ -138,9 +138,9 @@ Windows $(OutDir)\$(ProjectName).exe - $(QTDIR)\lib;C:\boost_1_57_0\lib64-msvc-11.0;%(AdditionalLibraryDirectories) + $(QTDIR)\lib;C:\boost_1_57_0\lib64-msvc-11.0;C:\xerces-c-3.1.1\lib;%(AdditionalLibraryDirectories) false - qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;Qt5Svg.lib;Qt5PrintSupport.lib;libboost_regex-vc110-mt-1_57.lib;%(AdditionalDependencies) + qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;Qt5Svg.lib;Qt5PrintSupport.lib;libboost_regex-vc110-mt-1_57.lib;xerces-c_3.lib;%(AdditionalDependencies) true true UseLinkTimeCodeGeneration @@ -154,8 +154,10 @@ + + @@ -167,6 +169,10 @@ true true + + true + true + true true @@ -179,6 +185,10 @@ true true + + true + true + true true @@ -207,7 +217,7 @@ true true - + true true @@ -261,6 +271,10 @@ true true + + true + true + true true @@ -273,6 +287,10 @@ true true + + true + true + true true @@ -301,7 +319,7 @@ true true - + true true @@ -342,16 +360,18 @@ true + + - + @@ -373,13 +393,69 @@ + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cHTMLExportDialog.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cHTMLExportDialog.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cHTMLExportDialog.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cHTMLExportDialog.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cBranchCyclicWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cBranchCyclicWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cBranchCyclicWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cBranchCyclicWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cDelegate.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cDelegate.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cDelegate.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cDelegate.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" + $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cExportDialog.h... @@ -396,7 +472,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cExportDialog.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -414,7 +490,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cFindDialog.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -432,7 +508,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cSpectrumSceneWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -450,7 +526,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cEventFilter.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" @@ -494,7 +570,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cDrawPeptideWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -512,7 +588,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cModificationsWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -530,7 +606,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cSequenceDatabaseWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -548,25 +624,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cBricksDatabaseWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" - - - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing cLassoWidget.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing cLassoWidget.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing cLassoWidget.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing cLassoWidget.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -584,7 +642,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cLinearWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -602,7 +660,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cCyclicWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -620,7 +678,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cBranchedWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -638,7 +696,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cFragmentIonsListWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -656,7 +714,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cGraphReaderThread.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" Moc%27ing cSpectrumComparatorThread.h... @@ -670,7 +728,7 @@ "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" Moc%27ing cSpectrumComparatorThread.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) $(QTDIR)\bin\moc.exe;%(FullPath) $(QTDIR)\bin\moc.exe;%(FullPath) @@ -692,7 +750,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cSpectrumDetailWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" @@ -736,7 +794,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cMainWindow.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -754,7 +812,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cMainThread.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -772,7 +830,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cParametersWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -790,7 +848,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cGraphWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" $(QTDIR)\bin\moc.exe;%(FullPath) @@ -808,7 +866,7 @@ $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cAboutWidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-IC:\boost_1_57_0" "-IC:\boost_1_57_0\boost" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" diff --git a/CycloBranch/CycloBranch.vcxproj.filters b/CycloBranch/CycloBranch.vcxproj.filters index aa5e87e..aaef3c0 100644 --- a/CycloBranch/CycloBranch.vcxproj.filters +++ b/CycloBranch/CycloBranch.vcxproj.filters @@ -194,15 +194,6 @@ Source Files\gui - - Generated Files\Debug - - - Generated Files\Release - - - Source Files\gui - Source Files\core @@ -290,6 +281,39 @@ Source Files\gui + + Generated Files\Debug + + + Generated Files\Release + + + Source Files\gui + + + Source Files\core + + + Source Files\gui + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files\gui + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files\core + @@ -331,9 +355,6 @@ Header Files\gui - - Header Files\gui - Header Files\gui @@ -364,6 +385,15 @@ Header Files\gui + + Header Files\gui + + + Header Files\gui + + + Header Files\gui + @@ -411,6 +441,12 @@ Header Files\core + + Header Files\core + + + Header Files\core + diff --git a/CycloBranch/core/cBrick.cpp b/CycloBranch/core/cBrick.cpp index 3737504..8c488b2 100644 --- a/CycloBranch/core/cBrick.cpp +++ b/CycloBranch/core/cBrick.cpp @@ -50,6 +50,7 @@ void cBrick::clear() { mass = 0; composition = ""; artificial = false; + residuelosstype = water; } @@ -365,6 +366,16 @@ bool cBrick::isArtificial() { } +void cBrick::setResidueLossType(eResidueLossType residuelosstype) { + this->residuelosstype = residuelosstype; +} + + +eResidueLossType cBrick::getResidueLossType() { + return residuelosstype; +} + + void cBrick::store(ofstream& os) { storeString(name, os); storeStringVector(acronyms, os); @@ -373,6 +384,7 @@ void cBrick::store(ofstream& os) { os.write((char *)&mass, sizeof(double)); storeString(composition, os); os.write((char *)&artificial, sizeof(bool)); + os.write((char *)&residuelosstype, sizeof(eResidueLossType)); } @@ -384,5 +396,6 @@ void cBrick::load(ifstream& is) { is.read((char *)&mass, sizeof(double)); loadString(composition, is); is.read((char *)&artificial, sizeof(bool)); + is.read((char *)&residuelosstype, sizeof(eResidueLossType)); } diff --git a/CycloBranch/core/cBrick.h b/CycloBranch/core/cBrick.h index 5a717be..4711641 100644 --- a/CycloBranch/core/cBrick.h +++ b/CycloBranch/core/cBrick.h @@ -17,6 +17,16 @@ using namespace std; +/** + \brief Residue loss types. +*/ +enum eResidueLossType { + water = 0, + h2, + h2o2 +}; + + /** \brief Get the number of bricks in a composition. \param composition string containing ids of bricks separated by '-' @@ -44,6 +54,7 @@ class cBrick { double mass; string composition; bool artificial; + eResidueLossType residuelosstype; public: @@ -220,6 +231,20 @@ class cBrick { bool isArtificial(); + /** + \brief Set the residue loss type. + \param residuelosstype the residue loss type. + */ + void setResidueLossType(eResidueLossType residuelosstype); + + + /** + \brief Get the residue loss type. + \retval eResidueLossType the residue loss type. + */ + eResidueLossType getResidueLossType(); + + /** \brief Store the structure into an output stream. \param os an output stream diff --git a/CycloBranch/core/cBricksDatabase.cpp b/CycloBranch/core/cBricksDatabase.cpp index e1693b7..6c43754 100644 --- a/CycloBranch/core/cBricksDatabase.cpp +++ b/CycloBranch/core/cBricksDatabase.cpp @@ -128,6 +128,11 @@ int cBricksDatabase::loadFromPlainTextStream(ifstream &stream, string& errormess size_t pos; double mass; +#if POLYKETIDE_SIDEROPHORES == 1 + regex rx; + string name; +#endif + bool error = false; errormessage = ""; cSummaryFormula formula; @@ -160,6 +165,20 @@ int cBricksDatabase::loadFromPlainTextStream(ifstream &stream, string& errormess break; } +#if POLYKETIDE_SIDEROPHORES == 1 + name = b.getName(); + + rx = "^\\(-2H\\) "; + if (regex_search(name, rx)) { + b.setResidueLossType(h2); + } + + rx = "^\\(-2OH\\) "; + if (regex_search(name, rx)) { + b.setResidueLossType(h2o2); + } +#endif + // load acronyms pos = s.find('\t'); if (pos != string::npos) { @@ -534,3 +553,35 @@ void cBricksDatabase::load(ifstream& is) { } } + +#if POLYKETIDE_SIDEROPHORES == 1 + + +bool cBricksDatabase::checkPolyketideBlocks(cBrick& brickseries) { + vector intcomposition; + brickseries.explodeToIntComposition(intcomposition); + + if (intcomposition.size() == 0) { + return false; + } + + int hydrogens = 0; + int hydroxyls = 0; + for (int i = 0; i < (int)intcomposition.size(); i++) { + if (bricks[intcomposition[i] - 1].getResidueLossType() == h2) { + hydrogens++; + } + if (bricks[intcomposition[i] - 1].getResidueLossType() == h2o2) { + hydroxyls++; + } + } + + if ((hydrogens == hydroxyls) || (hydrogens == hydroxyls + 1) || (hydrogens + 1 == hydroxyls)) { + return true; + } + + return false; +} + + +#endif \ No newline at end of file diff --git a/CycloBranch/core/cBricksDatabase.h b/CycloBranch/core/cBricksDatabase.h index ff62d24..3a236c8 100644 --- a/CycloBranch/core/cBricksDatabase.h +++ b/CycloBranch/core/cBricksDatabase.h @@ -222,6 +222,21 @@ class cBricksDatabase { */ void load(ifstream& is); + +#if POLYKETIDE_SIDEROPHORES == 1 + + + /** + \brief Check if the numbers of hydrogen and hydroxyl blocks are correct. + \param brickseries a tested combination of building blocks + \retval bool true when the numbers of blocks are correct + */ + bool checkPolyketideBlocks(cBrick& brickseries); + + +#endif + + }; diff --git a/CycloBranch/core/cCandidate.cpp b/CycloBranch/core/cCandidate.cpp index c784205..cca1343 100644 --- a/CycloBranch/core/cCandidate.cpp +++ b/CycloBranch/core/cCandidate.cpp @@ -47,7 +47,7 @@ void cCandidate::getPermutationsIter(cCandidateSet& permutations, vector } -void cCandidate::attachSubBranchCandidates(cCandidate& candidate, cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation) { +void cCandidate::attachSubBranchCandidates(cCandidate& candidate, cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation) { if (*terminatecomputation) { return; } @@ -81,7 +81,7 @@ void cCandidate::attachSubBranchCandidates(cCandidate& candidate, cCandidateSet& } -void cCandidate::attachAllBranches(cCandidate& candidate, cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation) { +void cCandidate::attachAllBranches(cCandidate& candidate, cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation) { cCandidate c; int start, end; int cumsize = 0; @@ -135,7 +135,7 @@ void cCandidate::getPartialRotations(const string& composition, vector& } -void cCandidate::getPartialLassoRotations(const string& composition, vector& lassorotations, int branchstart, int branchend) { +void cCandidate::getPartialBranchCyclicRotations(const string& composition, vector& branchcyclicrotations, int branchstart, int branchend) { cBrick b; string s; bool leftbracketput; @@ -176,7 +176,7 @@ void cCandidate::getPartialLassoRotations(const string& composition, vector ne; v.push_back(s); cCandidate c(v, ne, startmodifID, endmodifID, middlemodifID, (branchstart + count - i) % count, (branchend + count - i) % count); - lassorotations.push_back(c); + branchcyclicrotations.push_back(c); //cout << s << endl; } } @@ -298,14 +298,14 @@ void cCandidate::revertComposition() { } -void cCandidate::prepareBranchedCandidates(cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation) { +void cCandidate::prepareBranchedCandidates(cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation) { cCandidate c; result.getSet().clear(); - if (peptidetype == lasso) { + if (peptidetype == branchcyclic) { // just one from startmodifid and middlemodifid may be > 0 (checked in getCandidatesIter) - // endmodifid is always 0 because precursor_ion is not used in initializeFragmentIonsForDeNovoGraphOfLassoPeptides + // endmodifid is always 0 because precursor_ion is not used in initializeFragmentIonsForDeNovoGraphOfBranchCyclicPeptides // startmodifid is always N-terminal because only b-ions are used in the de novo graph if ((startmodifID > 0) && (composition.size() > 0)) { @@ -751,9 +751,32 @@ double cCandidate::getPrecursorMass(cBricksDatabase& brickdatabasewithcombinatio case branched: mass = parameters->fragmentdefinitions[precursor_ion].massdifference + parameters->searchedmodifications[startmodifID].massdifference + parameters->searchedmodifications[endmodifID].massdifference + parameters->searchedmodifications[middlemodifID].massdifference; break; - case lasso: + case branchcyclic: mass = parameters->fragmentdefinitions[cyclic_precursor_ion].massdifference + parameters->searchedmodifications[middlemodifID].massdifference; break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + switch (getResidueLossType(brickdatabasewithcombinations)) + { + case water: + mass = parameters->fragmentdefinitions[linear_polyketide_precursor_ion_h_oh].massdifference; + break; + case h2: + mass = parameters->fragmentdefinitions[linear_polyketide_precursor_ion_h_h].massdifference; + break; + case h2o2: + mass = parameters->fragmentdefinitions[linear_polyketide_precursor_ion_oh_oh].massdifference; + break; + default: + mass = 0; + break; + } + mass += parameters->searchedmodifications[startmodifID].massdifference + parameters->searchedmodifications[endmodifID].massdifference; + break; + case cyclicpolyketide: + mass = parameters->fragmentdefinitions[cyclic_polyketide_precursor_ion].massdifference; + break; +#endif case other: break; default: @@ -909,6 +932,18 @@ bool cCandidate::hasOnlyArtificialBricks(cBricksDatabase& brickdatabasewithcombi } +bool cCandidate::hasFirstBrickArtificial(cBricksDatabase& brickdatabasewithcombinations) { + cBrick b; + vector intcomposition; + b.setComposition(internalcomposition, false); + b.explodeToIntComposition(intcomposition); + if ((intcomposition.size() > 0) && brickdatabasewithcombinations[intcomposition[0] - 1].isArtificial()) { + return true; + } + return false; +} + + bool cCandidate::hasLastBrickArtificial(cBricksDatabase& brickdatabasewithcombinations) { cBrick b; vector intcomposition; @@ -921,6 +956,18 @@ bool cCandidate::hasLastBrickArtificial(cBricksDatabase& brickdatabasewithcombin } +bool cCandidate::hasLastBrickInvalid(cBricksDatabase& brickdatabasewithcombinations) { + cBrick b; + vector intcomposition; + b.setComposition(internalcomposition, false); + b.explodeToIntComposition(intcomposition); + if ((intcomposition.size() > 0) && brickdatabasewithcombinations[intcomposition.back() - 1].isArtificial() && (brickdatabasewithcombinations[intcomposition.back() - 1].getMass() <= 0)) { + return true; + } + return false; +} + + void cCandidate::getRotations(vector& rotations, bool includerevertedrotations) { rotations.clear(); //rotations.push_back(composition); @@ -935,16 +982,16 @@ void cCandidate::getRotations(vector& rotations, bool includerevertedrot } -void cCandidate::getLassoRotations(vector& lassorotations, bool includerevertedrotations) { - lassorotations.clear(); - getPartialLassoRotations(internalcomposition, lassorotations, branchstart, branchend); +void cCandidate::getBranchCyclicRotations(vector& branchcyclicrotations, bool includerevertedrotations) { + branchcyclicrotations.clear(); + getPartialBranchCyclicRotations(internalcomposition, branchcyclicrotations, branchstart, branchend); if (includerevertedrotations) { - getPartialLassoRotations(getRevertedTComposition(false), lassorotations, numberofinternalbricks - branchend - 1, numberofinternalbricks - branchstart - 1); + getPartialBranchCyclicRotations(getRevertedTComposition(false), branchcyclicrotations, numberofinternalbricks - branchend - 1, numberofinternalbricks - branchstart - 1); } } -cSummaryFormula cCandidate::getSummaryFormula(cParameters& parameters, peptideType peptidetype) { +cSummaryFormula cCandidate::getSummaryFormula(cParameters& parameters, ePeptideType peptidetype) { cBrick b; vector bricks; b.setComposition(internalcomposition, false); @@ -971,9 +1018,37 @@ cSummaryFormula cCandidate::getSummaryFormula(cParameters& parameters, peptideTy formula.addFormula(parameters.searchedmodifications[endmodifID].summary); formula.addFormula(parameters.searchedmodifications[middlemodifID].summary); break; - case lasso: + case branchcyclic: formula.addFormula(parameters.searchedmodifications[middlemodifID].summary); break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + switch (getResidueLossType(parameters.bricksdatabase)) + { + case water: + summary = "H2O"; + break; + case h2: + summary = "H2"; + break; + case h2o2: + summary = "H2O2"; + break; + default: + break; + } + + if (hasFirstBrickArtificial(parameters.bricksdatabase) || hasLastBrickArtificial(parameters.bricksdatabase)) { + summary = ""; + } + + formula.addFormula(summary); + formula.addFormula(parameters.searchedmodifications[startmodifID].summary); + formula.addFormula(parameters.searchedmodifications[endmodifID].summary); + break; + case cyclicpolyketide: + break; +#endif case other: break; default: @@ -1154,7 +1229,7 @@ void cCandidate::setPath(cDeNovoGraph& graph, cParameters* parameters) { stringpath += "ppm error: " + to_string(currentedge->ppmerror) + ", "; stringpath += "source charge: " + to_string(currentedge->sourcecharge) + ", "; stringpath += "target charge: " + to_string(currentedge->targetcharge); - if ((parameters->peptidetype == branched) || (parameters->peptidetype == lasso)) { + if ((parameters->peptidetype == branched) || (parameters->peptidetype == branchcyclic)) { if (currentedge->middlemodifID > 0) { stringpath += ", branch modification: " + parameters->searchedmodifications[currentedge->middlemodifID].name; } @@ -1175,16 +1250,20 @@ string& cCandidate::getPathAsString() { } -void cCandidate::setRealPeptideName(cBricksDatabase& bricksdatabase, peptideType peptidetype) { +void cCandidate::setRealPeptideName(cBricksDatabase& bricksdatabase, ePeptideType peptidetype) { switch (peptidetype) { case linear: case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + case cyclicpolyketide: +#endif case linearpolysaccharide: realpeptidename = bricksdatabase.getRealName(internalcomposition); break; case branched: - case lasso: + case branchcyclic: realpeptidename = getRealNameTComposition(bricksdatabase); break; case other: @@ -1195,16 +1274,20 @@ void cCandidate::setRealPeptideName(cBricksDatabase& bricksdatabase, peptideType } -void cCandidate::setAcronymPeptideNameWithHTMLReferences(cBricksDatabase& bricksdatabase, peptideType peptidetype) { +void cCandidate::setAcronymPeptideNameWithHTMLReferences(cBricksDatabase& bricksdatabase, ePeptideType peptidetype) { switch (peptidetype) { case linear: case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + case cyclicpolyketide: +#endif case linearpolysaccharide: acronympeptidename = bricksdatabase.getAcronymName(internalcomposition, true); break; case branched: - case lasso: + case branchcyclic: acronympeptidename = getAcronymsTComposition(bricksdatabase); break; case other: @@ -1225,6 +1308,135 @@ string& cCandidate::getAcronymPeptideNameWithHTMLReferences() { } +eResidueLossType cCandidate::getResidueLossType(cBricksDatabase& bricksdatabase) { + cBrick b; + b.setComposition(internalcomposition, false); + vector intcomposition; + b.explodeToIntComposition(intcomposition); + + int hydrogens = 0; + int hydroxyls = 0; + for (int i = 0; i < (int)intcomposition.size(); i++) { + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2) { + hydrogens++; + } + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o2) { + hydroxyls++; + } + } + + if (hydrogens == hydroxyls) { + return water; + } + + if (hydrogens > hydroxyls) { + return h2; + } + + return h2o2; +} + + +#if POLYKETIDE_SIDEROPHORES == 1 + + +bool cCandidate::checkPolyketideSequence(cBricksDatabase& bricksdatabase, ePeptideType peptidetype) { + cBrick b; + b.setComposition(internalcomposition, false); + vector intcomposition; + b.explodeToIntComposition(intcomposition); + + if (intcomposition.size() == 0) { + return false; + } + + bool hasfirstblockartificial = hasFirstBrickArtificial(bricksdatabase); + bool haslastblockartificial = hasLastBrickArtificial(bricksdatabase); + + // cyclic polyketide has always an even number of blocks + if ((peptidetype == cyclicpolyketide) && !hasfirstblockartificial && !haslastblockartificial && ((int)intcomposition.size() % 2 == 1)) { + return false; + } + + for (int i = (hasfirstblockartificial?2:1); i < (haslastblockartificial?(int)intcomposition.size()-1:(int)intcomposition.size()); i++) { + if (!(((bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2) && (bricksdatabase[intcomposition[i - 1] - 1].getResidueLossType() == h2o2)) + || ((bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o2) && (bricksdatabase[intcomposition[i - 1] - 1].getResidueLossType() == h2)))) { + return false; + } + } + + return true; +} + + +eResidueLossType cCandidate::getLeftResidueType(cBricksDatabase& bricksdatabase) { + cBrick b; + b.setComposition(internalcomposition, false); + vector intcomposition; + b.explodeToIntComposition(intcomposition); + + if (intcomposition.size() == 0) { + return water; + } + + return bricksdatabase[intcomposition[0] - 1].getResidueLossType(); +} + + +eResidueLossType cCandidate::getRightResidueType(cBricksDatabase& bricksdatabase) { + cBrick b; + b.setComposition(internalcomposition, false); + vector intcomposition; + b.explodeToIntComposition(intcomposition); + + if (intcomposition.size() == 0) { + return water; + } + + return bricksdatabase[intcomposition.back() - 1].getResidueLossType(); +} + + +bool cCandidate::checkPolyketideBlocks(cBricksDatabase& bricksdatabase, ePeptideType peptidetype) { + cBrick b; + b.setComposition(internalcomposition, false); + vector intcomposition; + b.explodeToIntComposition(intcomposition); + + if (intcomposition.size() == 0) { + return false; + } + + bool hasfirstblockartificial = hasFirstBrickArtificial(bricksdatabase); + bool haslastblockartificial = hasLastBrickArtificial(bricksdatabase); + + // cyclic polyketide has always an even number of blocks + if ((peptidetype == cyclicpolyketide) && !hasfirstblockartificial && !haslastblockartificial && ((int)intcomposition.size() % 2 == 1)) { + return false; + } + + int hydrogens = 0; + int hydroxyls = 0; + for (int i = (hasfirstblockartificial?1:0); i < (haslastblockartificial?(int)intcomposition.size()-1:(int)intcomposition.size()); i++) { + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2) { + hydrogens++; + } + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o2) { + hydroxyls++; + } + } + + if ((hydrogens == hydroxyls) || (hydrogens == hydroxyls + 1) || (hydrogens + 1 == hydroxyls)) { + return true; + } + + return false; +} + + +#endif + + bool operator == (cCandidate const& a, cCandidate const& b) { return ((cCandidate &)a).isEqualTo((cCandidate &)b); } diff --git a/CycloBranch/core/cCandidate.h b/CycloBranch/core/cCandidate.h index 6204bf1..0afa307 100644 --- a/CycloBranch/core/cCandidate.h +++ b/CycloBranch/core/cCandidate.h @@ -153,13 +153,13 @@ class cCandidate { void getPermutationsIter(cCandidateSet& permutations, vector& currentcandidate, int position, bool* terminatecomputation); - void attachSubBranchCandidates(cCandidate& candidate, cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation); + void attachSubBranchCandidates(cCandidate& candidate, cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation); - void attachAllBranches(cCandidate& candidate, cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation); + void attachAllBranches(cCandidate& candidate, cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation); void getPartialRotations(const string& composition, vector& rotations); - void getPartialLassoRotations(const string& composition, vector& lassorotations, int branchstart, int branchend); + void getPartialBranchCyclicRotations(const string& composition, vector& branchcyclicrotations, int branchstart, int branchend); public: @@ -244,7 +244,7 @@ class cCandidate { \param peptidetype a type of an analyzed peptide \param terminatecomputation pointer to a variable determining that the computation must be stopped */ - void prepareBranchedCandidates(cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation); + void prepareBranchedCandidates(cCandidateSet& result, ePeptideType peptidetype, bool* terminatecomputation); /** @@ -404,6 +404,14 @@ class cCandidate { bool hasOnlyArtificialBricks(cBricksDatabase& brickdatabasewithcombinations); + /** + \brief Check if the first brick is artificial. + \param brickdatabasewithcombinations reference to an input database of bricks with combinations of bricks + \retval bool true if the first brick is artificial, false otherwise + */ + bool hasFirstBrickArtificial(cBricksDatabase& brickdatabasewithcombinations); + + /** \brief Check if the last brick is artificial. \param brickdatabasewithcombinations reference to an input database of bricks with combinations of bricks @@ -411,7 +419,15 @@ class cCandidate { */ bool hasLastBrickArtificial(cBricksDatabase& brickdatabasewithcombinations); - + + /** + \brief Check if the last brick is invalid. + \param brickdatabasewithcombinations reference to an input database of bricks with combinations of bricks + \retval bool true if the last brick is invalid, false otherwise + */ + bool hasLastBrickInvalid(cBricksDatabase& brickdatabasewithcombinations); + + /** \brief Get rotations of a cyclic peptide sequence. \param rotations reference to an output vector containing rotations of a sequence @@ -422,10 +438,10 @@ class cCandidate { /** \brief Get branch-cyclic rotations of a branch-cyclic peptide sequence. - \param lassorotations reference to an output vector containing branch-cyclic rotations of a sequence + \param branchcyclicrotations reference to an output vector containing branch-cyclic rotations of a sequence \param includerevertedrotations if true then reverted branch-cyclic rotations are also included */ - void getLassoRotations(vector& lassorotations, bool includerevertedrotations); + void getBranchCyclicRotations(vector& branchcyclicrotations, bool includerevertedrotations); /** @@ -434,7 +450,7 @@ class cCandidate { \param peptidetype the type of peptide \retval cSummaryFormula the summary formula */ - cSummaryFormula getSummaryFormula(cParameters& parameters, peptideType peptidetype); + cSummaryFormula getSummaryFormula(cParameters& parameters, ePeptideType peptidetype); /** @@ -527,7 +543,7 @@ class cCandidate { \param bricksdatabase the database of building blocks \param peptidetype the type of peptide */ - void setRealPeptideName(cBricksDatabase& bricksdatabase, peptideType peptidetype); + void setRealPeptideName(cBricksDatabase& bricksdatabase, ePeptideType peptidetype); /** @@ -535,7 +551,7 @@ class cCandidate { \param bricksdatabase the database of building blocks \param peptidetype the type of peptide */ - void setAcronymPeptideNameWithHTMLReferences(cBricksDatabase& bricksdatabase, peptideType peptidetype); + void setAcronymPeptideNameWithHTMLReferences(cBricksDatabase& bricksdatabase, ePeptideType peptidetype); /** @@ -551,6 +567,53 @@ class cCandidate { */ string& getAcronymPeptideNameWithHTMLReferences(); + + /** + \brief Get the residue loss type. + \param bricksdatabase a database of building blocks + \retval eResidueLossType the residue loss type + */ + eResidueLossType getResidueLossType(cBricksDatabase& bricksdatabase); + + +#if POLYKETIDE_SIDEROPHORES == 1 + + /** + \brief Check if the order of blocks is correct. + \param bricksdatabase a database of building blocks + \param peptidetype the type of peptide + \retval bool true when the order of blocks is correct; false otherwise + */ + bool checkPolyketideSequence(cBricksDatabase& bricksdatabase, ePeptideType peptidetype); + + + /** + \brief Get the residue type of the left-most building block. + \param bricksdatabase a database of building blocks + \retval eResidueLossType residue loss type of the left-most building block + */ + eResidueLossType getLeftResidueType(cBricksDatabase& bricksdatabase); + + + /** + \brief Get the residue type of the right-most building block. + \param bricksdatabase a database of building blocks + \retval eResidueLossType residue loss type of the right-most building block + */ + eResidueLossType getRightResidueType(cBricksDatabase& bricksdatabase); + + + /** + \brief Check if the numbers of hydrogen and hydroxyl blocks are correct. + \param bricksdatabase a database of building blocks + \param peptidetype the type of peptide + \retval bool true when the numbers of blocks are correct + */ + bool checkPolyketideBlocks(cBricksDatabase& bricksdatabase, ePeptideType peptidetype); + + +#endif + }; diff --git a/CycloBranch/core/cDeNovoGraph.cpp b/CycloBranch/core/cDeNovoGraph.cpp index 4ae488b..e06a1db 100644 --- a/CycloBranch/core/cDeNovoGraph.cpp +++ b/CycloBranch/core/cDeNovoGraph.cpp @@ -145,7 +145,7 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { double unchargedmz; int i; - sortedpeaklist = parameters->peaklist; + sortedpeaklist = parameters->peaklistseries[0]; // insert the single charged precursor, if neccessary sortedpeaklist.sortbyMass(); sortedpeaklist.cropMaximumMZRatio(unchargedprecursormass, parameters->precursormasserrortolerance); @@ -242,7 +242,7 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { //sort(graph.begin() + 1, graph.end(), compareNodes); break; - case lasso: + case branchcyclic: node.clear(); node.setMZRatio(0); node.setIntensity(0); @@ -300,6 +300,154 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { lastsystemnode = (int)graph.size() - 1; startnode = 1; break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + node.clear(); + node.setMZRatio(0); + node.setIntensity(0); + node.addIonAnnotation(l1h_ion); + node.addIonAnnotation(l2h_ion); + node.addIonAnnotation(l1oh_ion); + node.addIonAnnotation(l2oh_ion); + graph.push_back(node); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l1h_ion].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l1h_ion); + graph.push_back(node); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l2h_ion].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l2h_ion); + graph.push_back(node); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l1oh_ion].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l1oh_ion); + graph.push_back(node); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l2oh_ion].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l2oh_ion); + graph.push_back(node); + + e.clear(); + e.composition = "0"; + e.targetnode = 1; + graph[0].insertTempEdge(e); + + e.clear(); + e.composition = "0"; + e.targetnode = 2; + graph[0].insertTempEdge(e); + + e.clear(); + e.composition = "0"; + e.targetnode = 3; + graph[0].insertTempEdge(e); + + e.clear(); + e.composition = "0"; + e.targetnode = 4; + graph[0].insertTempEdge(e); + + e.clear(); + e.composition = "0"; + e.targetnode = 4; + + for (i = 1; i < (int)parameters->searchedmodifications.size(); i++) { + + if (parameters->searchedmodifications[i].nterminal) { + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l1h_ion].massdifference + parameters->searchedmodifications[i].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l1h_ion); + graph.push_back(node); + e.targetnode++; + graph[0].insertTempEdge(e); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l2h_ion].massdifference + parameters->searchedmodifications[i].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l2h_ion); + graph.push_back(node); + e.targetnode++; + graph[0].insertTempEdge(e); + } + + if (parameters->searchedmodifications[i].cterminal) { + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l1oh_ion].massdifference + parameters->searchedmodifications[i].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l1oh_ion); + graph.push_back(node); + e.targetnode++; + graph[0].insertTempEdge(e); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l2oh_ion].massdifference + parameters->searchedmodifications[i].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l2oh_ion); + graph.push_back(node); + e.targetnode++; + graph[0].insertTempEdge(e); + } + + } + + lastsystemnode = (int)graph.size() - 1; + startnode = 1; + break; + case cyclicpolyketide: + node.clear(); + node.setMZRatio(0); + node.setIntensity(0); + node.addIonAnnotation(l0h_ion); + node.addIonAnnotation(l1h_ion); + node.addIonAnnotation(l2h_ion); + graph.push_back(node); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l0h_ion].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l0h_ion); + graph.push_back(node); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l1h_ion].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l1h_ion); + graph.push_back(node); + + node.clear(); + node.setMZRatio(parameters->fragmentdefinitions[l2h_ion].massdifference + negativeshift); + node.setIntensity(0); + node.addIonAnnotation(l2h_ion); + graph.push_back(node); + + e.clear(); + e.composition = "0"; + e.targetnode = 1; + graph[0].insertTempEdge(e); + + e.clear(); + e.composition = "0"; + e.targetnode = 2; + graph[0].insertTempEdge(e); + + e.clear(); + e.composition = "0"; + e.targetnode = 3; + graph[0].insertTempEdge(e); + + lastsystemnode = (int)graph.size() - 1; + startnode = 1; + break; +#endif case linearpolysaccharide: node.clear(); node.setMZRatio(0); @@ -435,6 +583,13 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { b.clear(); b.setMass(bricksdatabasewithcombinations.getMassOfComposition(combarray)); b.setComposition(compositionname, true); + +#if POLYKETIDE_SIDEROPHORES == 1 + if (((parameters->peptidetype == linearpolyketide) || (parameters->peptidetype == cyclicpolyketide)) && !bricksdatabasewithcombinations.checkPolyketideBlocks(b)) { + continue; + } +#endif + bricksdatabasewithcombinations.push_back(b); } @@ -467,37 +622,76 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { for (int k = 0; k < (int)parameters->fragmentionsfordenovograph.size(); k++) { - if (/*!graph[i].ionannotation[parameters->fragmentionsfordenovograph[k]] ||*/ (parameters->fragmentionsfordenovograph[k] == precursor_ion)) { + if (/*!graph[i].ionannotation[parameters->fragmentionsfordenovograph[k]] ||*/ (parameters->fragmentionsfordenovograph[k] == precursor_ion) +#if POLYKETIDE_SIDEROPHORES == 1 + || (parameters->fragmentionsfordenovograph[k] == linear_polyketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[k] == linear_polyketide_precursor_ion_h_oh) + || (parameters->fragmentionsfordenovograph[k] == linear_polyketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[k] == cyclic_polyketide_precursor_ion) +#endif + ) { continue; } for (int m = 0; m < (int)parameters->fragmentionsfordenovograph.size(); m++) { // test for incompatible ion series - if ((!((parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].nterminal == parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[m]].nterminal) && - (parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].cterminal == parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[m]].cterminal))) && (parameters->fragmentionsfordenovograph[m] != precursor_ion)) { + if ( +#if POLYKETIDE_SIDEROPHORES == 1 + ( +#endif + !((parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].nterminal == parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[m]].nterminal) && + (parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].cterminal == parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[m]].cterminal)) +#if POLYKETIDE_SIDEROPHORES == 1 + || + (((parameters->peptidetype == linearpolyketide) || (parameters->peptidetype == cyclicpolyketide)) && + !(((parameters->fragmentionsfordenovograph[k] == l0h_ion) && (parameters->fragmentionsfordenovograph[m] == l0h_ion)) || ((parameters->fragmentionsfordenovograph[k] == l1h_ion) && (parameters->fragmentionsfordenovograph[m] == l1h_ion)) || ((parameters->fragmentionsfordenovograph[k] == l2h_ion) && (parameters->fragmentionsfordenovograph[m] == l2h_ion)) + || ((parameters->fragmentionsfordenovograph[k] == l1oh_ion) && (parameters->fragmentionsfordenovograph[m] == l1oh_ion)) || ((parameters->fragmentionsfordenovograph[k] == l2oh_ion) && (parameters->fragmentionsfordenovograph[m] == l2oh_ion)))) + ) + && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_h_h) && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_h_oh) + && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_oh_oh) && (parameters->fragmentionsfordenovograph[m] != cyclic_polyketide_precursor_ion) +#endif + && (parameters->fragmentionsfordenovograph[m] != precursor_ion) + ) { continue; } // terminal modifications for (int n = 0; n < (int)parameters->searchedmodifications.size(); n++) { - if ((n > 0) && (parameters->fragmentionsfordenovograph[m] != precursor_ion)) { + if ((n > 0) && (parameters->fragmentionsfordenovograph[m] != precursor_ion) +#if POLYKETIDE_SIDEROPHORES == 1 + && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_h_h) && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_h_oh) + && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_oh_oh) && (parameters->fragmentionsfordenovograph[m] != cyclic_polyketide_precursor_ion) +#endif + ) { continue; } // middle modifications for branched and branch-cyclic peptides for (int p = 0; p < (int)parameters->searchedmodifications.size(); p++) { - if ((p > 0) && ((parameters->peptidetype == linear) || (parameters->peptidetype == cyclic) || (parameters->peptidetype == linearpolysaccharide))) { + if ((p > 0) && ((parameters->peptidetype == linear) || (parameters->peptidetype == cyclic) || (parameters->peptidetype == linearpolysaccharide) +#if POLYKETIDE_SIDEROPHORES == 1 + || (parameters->peptidetype == linearpolyketide) || (parameters->peptidetype == cyclicpolyketide) +#endif + )) { continue; } termmass = 0; +#if POLYKETIDE_SIDEROPHORES == 1 + if ((parameters->fragmentionsfordenovograph[m] == precursor_ion) + || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_h_oh) + || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[m] == cyclic_polyketide_precursor_ion)) { +#else if (parameters->fragmentionsfordenovograph[m] == precursor_ion) { +#endif - if ((parameters->peptidetype == linear) || ((parameters->peptidetype == linearpolysaccharide))) { + if ((parameters->peptidetype == linear) || (parameters->peptidetype == linearpolysaccharide) +#if POLYKETIDE_SIDEROPHORES == 1 + || (parameters->peptidetype == linearpolyketide) +#endif + ) { if ((n > 0) && ((parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].nterminal && parameters->searchedmodifications[n].nterminal) || (parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].cterminal && parameters->searchedmodifications[n].cterminal))) { continue; } @@ -527,7 +721,7 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { mass += parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[m]].massdifference; mass += termmass; - if ((parameters->peptidetype == branched) || (parameters->peptidetype == lasso)) { + if ((parameters->peptidetype == branched) || (parameters->peptidetype == branchcyclic)) { mass += parameters->searchedmodifications[p].massdifference; } @@ -572,7 +766,14 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { } // irrelevant connection with precursor +#if POLYKETIDE_SIDEROPHORES == 1 + if (((parameters->fragmentionsfordenovograph[m] == precursor_ion) + || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_h_oh) + || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[m] == cyclic_polyketide_precursor_ion)) + && (middle != (int)graph.size() - 1) && (i != (int)graph.size() - 1)) { +#else if ((parameters->fragmentionsfordenovograph[m] == precursor_ion) && (middle != (int)graph.size() - 1) && (i != (int)graph.size() - 1)) { +#endif middle++; continue; } @@ -782,11 +983,12 @@ int cDeNovoGraph::connectEdgesFormingPathsNotFinishingInPrecursor(bool& terminat graph[i].insertEdge(e); edgescreated++; - // normal brick cBrick b; + string s = "unknown"; + + // normal brick b.setName(to_string(e.massdifference)); b.setAcronyms(to_string(e.massdifference)); - string s = "unknown"; b.setReferences(s); b.setSummary(s); b.setMass(e.massdifference); @@ -794,7 +996,7 @@ int cDeNovoGraph::connectEdgesFormingPathsNotFinishingInPrecursor(bool& terminat b.setArtificial(true); bricksdatabasewithcombinations.push_back(b); - // water loss brick + // -H2O brick (1) b.setName(to_string(e.massdifference - H2O)); b.setAcronyms(to_string(e.massdifference - H2O)); b.setReferences(s); @@ -803,6 +1005,80 @@ int cDeNovoGraph::connectEdgesFormingPathsNotFinishingInPrecursor(bool& terminat b.setComposition(to_string((int)bricksdatabasewithcombinations.size() + 1), false); b.setArtificial(true); bricksdatabasewithcombinations.push_back(b); + + // +H2O brick (2) + b.setName(to_string(e.massdifference + H2O)); + b.setAcronyms(to_string(e.massdifference + H2O)); + b.setReferences(s); + b.setSummary(s); + b.setMass(e.massdifference + H2O); + b.setComposition(to_string((int)bricksdatabasewithcombinations.size() + 1), false); + b.setArtificial(true); + bricksdatabasewithcombinations.push_back(b); + +#if POLYKETIDE_SIDEROPHORES == 1 + + // -H2 brick (3) + b.setName(to_string(e.massdifference - 2*H)); + b.setAcronyms(to_string(e.massdifference - 2*H)); + b.setReferences(s); + b.setSummary(s); + b.setMass(e.massdifference - 2*H); + b.setComposition(to_string((int)bricksdatabasewithcombinations.size() + 1), false); + b.setArtificial(true); + bricksdatabasewithcombinations.push_back(b); + + // -O brick (4) + b.setName(to_string(e.massdifference - O)); + b.setAcronyms(to_string(e.massdifference - O)); + b.setReferences(s); + b.setSummary(s); + b.setMass(e.massdifference - O); + b.setComposition(to_string((int)bricksdatabasewithcombinations.size() + 1), false); + b.setArtificial(true); + bricksdatabasewithcombinations.push_back(b); + + // +O brick (5) + b.setName(to_string(e.massdifference + O)); + b.setAcronyms(to_string(e.massdifference + O)); + b.setReferences(s); + b.setSummary(s); + b.setMass(e.massdifference + O); + b.setComposition(to_string((int)bricksdatabasewithcombinations.size() + 1), false); + b.setArtificial(true); + bricksdatabasewithcombinations.push_back(b); + + // -O2 brick (6) + b.setName(to_string(e.massdifference - 2*O)); + b.setAcronyms(to_string(e.massdifference - 2*O)); + b.setReferences(s); + b.setSummary(s); + b.setMass(e.massdifference - 2*O); + b.setComposition(to_string((int)bricksdatabasewithcombinations.size() + 1), false); + b.setArtificial(true); + bricksdatabasewithcombinations.push_back(b); + + // -H2+O brick (7) + b.setName(to_string(e.massdifference - 2*H + O)); + b.setAcronyms(to_string(e.massdifference - 2*H + O)); + b.setReferences(s); + b.setSummary(s); + b.setMass(e.massdifference - 2*H + O); + b.setComposition(to_string((int)bricksdatabasewithcombinations.size() + 1), false); + b.setArtificial(true); + bricksdatabasewithcombinations.push_back(b); + + // -H2O2 brick (8) + b.setName(to_string(e.massdifference - 2*H - 2*O)); + b.setAcronyms(to_string(e.massdifference - 2*H - 2*O)); + b.setReferences(s); + b.setSummary(s); + b.setMass(e.massdifference - 2*H - 2*O); + b.setComposition(to_string((int)bricksdatabasewithcombinations.size() + 1), false); + b.setArtificial(true); + bricksdatabasewithcombinations.push_back(b); + +#endif //} } @@ -1020,7 +1296,7 @@ string cDeNovoGraph::printGraph() { g += "ppm error: " + s2 + ", "; g += "source charge: " + to_string(graph[i][j].sourcecharge) + ", "; g += "target charge: " + to_string(graph[i][j].targetcharge); - if ((parameters->peptidetype == branched) || (parameters->peptidetype == lasso)) { + if ((parameters->peptidetype == branched) || (parameters->peptidetype == branchcyclic)) { if (graph[i][j].middlemodifID > 0) { g += ", branch modification: " + parameters->searchedmodifications[graph[i][j].middlemodifID].name; } diff --git a/CycloBranch/core/cDeNovoGraph.h b/CycloBranch/core/cDeNovoGraph.h index 045fecf..90ab09b 100644 --- a/CycloBranch/core/cDeNovoGraph.h +++ b/CycloBranch/core/cDeNovoGraph.h @@ -14,7 +14,7 @@ #include "core/cParameters.h" #include "core/cDeNovoGraphNode.h" -#include "core/cPeaksList.h" +#include "core/cPeakListSeries.h" #include "core/cBricksDatabase.h" #include "core/cTheoreticalSpectrumList.h" #include "parallel/cGraphReaderThread.h" diff --git a/CycloBranch/core/cDeNovoGraphNode.cpp b/CycloBranch/core/cDeNovoGraphNode.cpp index 453b7e5..b75dd92 100644 --- a/CycloBranch/core/cDeNovoGraphNode.cpp +++ b/CycloBranch/core/cDeNovoGraphNode.cpp @@ -40,7 +40,7 @@ void cDeNovoGraphNode::clear() { for (int i = 0; i < fragmentIonTypeEnd; i++) { - ionannotation[(fragmentIonType)i] = false; + ionannotation[(eFragmentIonType)i] = false; } tempedges.clear(); @@ -117,12 +117,12 @@ void cDeNovoGraphNode::clearEdges() { } -void cDeNovoGraphNode::addIonAnnotation(fragmentIonType iontype) { +void cDeNovoGraphNode::addIonAnnotation(eFragmentIonType iontype) { ionannotation[iontype] = true; } -bool cDeNovoGraphNode::checkIonAnnotation(fragmentIonType iontype) { +bool cDeNovoGraphNode::checkIonAnnotation(eFragmentIonType iontype) { return ionannotation[iontype]; } diff --git a/CycloBranch/core/cDeNovoGraphNode.h b/CycloBranch/core/cDeNovoGraphNode.h index 4dda405..ffdf579 100644 --- a/CycloBranch/core/cDeNovoGraphNode.h +++ b/CycloBranch/core/cDeNovoGraphNode.h @@ -196,7 +196,7 @@ class cDeNovoGraphNode { unordered_set tempedges; vector edges; - map ionannotation; + map ionannotation; public: @@ -305,7 +305,7 @@ class cDeNovoGraphNode { \brief Add ion annotation. \param iontype type of fragment ion */ - void addIonAnnotation(fragmentIonType iontype); + void addIonAnnotation(eFragmentIonType iontype); /** @@ -313,7 +313,7 @@ class cDeNovoGraphNode { \param iontype type of fragment ion \retval bool true when the ion type was assigned to the node */ - bool checkIonAnnotation(fragmentIonType iontype); + bool checkIonAnnotation(eFragmentIonType iontype); }; diff --git a/CycloBranch/core/cFragmentIons.cpp b/CycloBranch/core/cFragmentIons.cpp index 9d38635..dc09253 100644 --- a/CycloBranch/core/cFragmentIons.cpp +++ b/CycloBranch/core/cFragmentIons.cpp @@ -137,9 +137,10 @@ void fragmentDescription::store(ofstream& os) { os.write((char *)&massdifference, sizeof(double)); os.write((char *)&nterminal, sizeof(bool)); os.write((char *)&cterminal, sizeof(bool)); - os.write((char *)&parent, sizeof(fragmentIonType)); + os.write((char *)&parent, sizeof(eFragmentIonType)); os.write((char *)&positive, sizeof(bool)); os.write((char *)&multiplier, sizeof(int)); + os.write((char *)&numberofisotopes, sizeof(int)); } @@ -149,9 +150,10 @@ void fragmentDescription::load(ifstream& is) { is.read((char *)&massdifference, sizeof(double)); is.read((char *)&nterminal, sizeof(bool)); is.read((char *)&cterminal, sizeof(bool)); - is.read((char *)&parent, sizeof(fragmentIonType)); + is.read((char *)&parent, sizeof(eFragmentIonType)); is.read((char *)&positive, sizeof(bool)); is.read((char *)&multiplier, sizeof(int)); + is.read((char *)&numberofisotopes, sizeof(int)); } @@ -166,7 +168,7 @@ cFragmentIons::cFragmentIons(bool cyclicnterminus, bool cycliccterminus, string& } -fragmentDescription &cFragmentIons::operator[](fragmentIonType iontype) { +fragmentDescription &cFragmentIons::operator[](eFragmentIonType iontype) { return fragmentions[iontype]; } @@ -515,6 +517,7 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_hplus].parent = ms_hplus; fragmentions[ms_hplus].positive = true; fragmentions[ms_hplus].multiplier = 1; + fragmentions[ms_hplus].numberofisotopes = 0; // initialize ion Na+ fragmentions[ms_naplus].nterminal = true; @@ -524,6 +527,7 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_naplus].parent = ms_naplus; fragmentions[ms_naplus].positive = true; fragmentions[ms_naplus].multiplier = 1; + fragmentions[ms_naplus].numberofisotopes = 0; // initialize ion K+ fragmentions[ms_kplus].nterminal = true; @@ -533,6 +537,7 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_kplus].parent = ms_kplus; fragmentions[ms_kplus].positive = true; fragmentions[ms_kplus].multiplier = 1; + fragmentions[ms_kplus].numberofisotopes = 1; // initialize ion H- fragmentions[ms_hminus].nterminal = true; @@ -542,33 +547,7 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_hminus].parent = ms_hminus; fragmentions[ms_hminus].positive = false; fragmentions[ms_hminus].multiplier = 1; - - // initialize ion [3M+2Fe-5H]+ - fragmentions[ms_3M2Fe5H].nterminal = true; - fragmentions[ms_3M2Fe5H].cterminal = true; - fragmentions[ms_3M2Fe5H].name = "[3M+2Fe-5H]+"; - fragmentions[ms_3M2Fe5H].massdifference = 2*Fe - 6*H + Hplus; - fragmentions[ms_3M2Fe5H].parent = ms_3M2Fe5H; - fragmentions[ms_3M2Fe5H].positive = true; - fragmentions[ms_3M2Fe5H].multiplier = 3; - - // initialize ion [2M+Fe-2H]+ - fragmentions[ms_2MFe2H].nterminal = true; - fragmentions[ms_2MFe2H].cterminal = true; - fragmentions[ms_2MFe2H].name = "[2M+Fe-2H]+"; - fragmentions[ms_2MFe2H].massdifference = Fe - 3*H + Hplus; - fragmentions[ms_2MFe2H].parent = ms_2MFe2H; - fragmentions[ms_2MFe2H].positive = true; - fragmentions[ms_2MFe2H].multiplier = 2; - - // initialize ion [3M+Fe-2H]+ - fragmentions[ms_3MFe2H].nterminal = true; - fragmentions[ms_3MFe2H].cterminal = true; - fragmentions[ms_3MFe2H].name = "[3M+Fe-2H]+"; - fragmentions[ms_3MFe2H].massdifference = Fe - 3*H + Hplus; - fragmentions[ms_3MFe2H].parent = ms_3MFe2H; - fragmentions[ms_3MFe2H].positive = true; - fragmentions[ms_3MFe2H].multiplier = 3; + fragmentions[ms_hminus].numberofisotopes = 0; // initialize ion [M+Fe-2H]+ fragmentions[ms_MFe2H].nterminal = true; @@ -578,15 +557,27 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_MFe2H].parent = ms_MFe2H; fragmentions[ms_MFe2H].positive = true; fragmentions[ms_MFe2H].multiplier = 1; + fragmentions[ms_MFe2H].numberofisotopes = 1; - // initialize ion [3M+2Fe-6H+Na]+ - fragmentions[ms_3M2Fe6HNa].nterminal = true; - fragmentions[ms_3M2Fe6HNa].cterminal = true; - fragmentions[ms_3M2Fe6HNa].name = "[3M+2Fe-6H+Na]+"; - fragmentions[ms_3M2Fe6HNa].massdifference = 2*Fe - 6*H + Naplus; - fragmentions[ms_3M2Fe6HNa].parent = ms_3M2Fe6HNa; - fragmentions[ms_3M2Fe6HNa].positive = true; - fragmentions[ms_3M2Fe6HNa].multiplier = 3; + // initialize ion [M+Fe-3H+Na]+ + fragmentions[ms_MFe3HNa].nterminal = true; + fragmentions[ms_MFe3HNa].cterminal = true; + fragmentions[ms_MFe3HNa].name = "[M+Fe-3H+Na]+"; + fragmentions[ms_MFe3HNa].massdifference = Fe - 3*H + Naplus; + fragmentions[ms_MFe3HNa].parent = ms_MFe3HNa; + fragmentions[ms_MFe3HNa].positive = true; + fragmentions[ms_MFe3HNa].multiplier = 1; + fragmentions[ms_MFe3HNa].numberofisotopes = 1; + + // initialize ion [2M+Fe-2H]+ + fragmentions[ms_2MFe2H].nterminal = true; + fragmentions[ms_2MFe2H].cterminal = true; + fragmentions[ms_2MFe2H].name = "[2M+Fe-2H]+"; + fragmentions[ms_2MFe2H].massdifference = Fe - 3*H + Hplus; + fragmentions[ms_2MFe2H].parent = ms_2MFe2H; + fragmentions[ms_2MFe2H].positive = true; + fragmentions[ms_2MFe2H].multiplier = 2; + fragmentions[ms_2MFe2H].numberofisotopes = 1; // initialize ion [2M+Fe-3H+Na]+ fragmentions[ms_2MFe3HNa].nterminal = true; @@ -596,6 +587,17 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_2MFe3HNa].parent = ms_2MFe3HNa; fragmentions[ms_2MFe3HNa].positive = true; fragmentions[ms_2MFe3HNa].multiplier = 2; + fragmentions[ms_2MFe3HNa].numberofisotopes = 1; + + // initialize ion [3M+Fe-2H]+ + fragmentions[ms_3MFe2H].nterminal = true; + fragmentions[ms_3MFe2H].cterminal = true; + fragmentions[ms_3MFe2H].name = "[3M+Fe-2H]+"; + fragmentions[ms_3MFe2H].massdifference = Fe - 3*H + Hplus; + fragmentions[ms_3MFe2H].parent = ms_3MFe2H; + fragmentions[ms_3MFe2H].positive = true; + fragmentions[ms_3MFe2H].multiplier = 3; + fragmentions[ms_3MFe2H].numberofisotopes = 1; // initialize ion [3M+Fe-3H+Na]+ fragmentions[ms_3MFe3HNa].nterminal = true; @@ -605,24 +607,37 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_3MFe3HNa].parent = ms_3MFe3HNa; fragmentions[ms_3MFe3HNa].positive = true; fragmentions[ms_3MFe3HNa].multiplier = 3; + fragmentions[ms_3MFe3HNa].numberofisotopes = 1; - // initialize ion [M+Fe-3H+Na]+ - fragmentions[ms_MFe3HNa].nterminal = true; - fragmentions[ms_MFe3HNa].cterminal = true; - fragmentions[ms_MFe3HNa].name = "[M+Fe-3H+Na]+"; - fragmentions[ms_MFe3HNa].massdifference = Fe - 3*H + Naplus; - fragmentions[ms_MFe3HNa].parent = ms_MFe3HNa; - fragmentions[ms_MFe3HNa].positive = true; - fragmentions[ms_MFe3HNa].multiplier = 1; + // initialize ion [3M+2Fe-5H]+ + fragmentions[ms_3M2Fe5H].nterminal = true; + fragmentions[ms_3M2Fe5H].cterminal = true; + fragmentions[ms_3M2Fe5H].name = "[3M+2Fe-5H]+"; + fragmentions[ms_3M2Fe5H].massdifference = 2*Fe - 6*H + Hplus; + fragmentions[ms_3M2Fe5H].parent = ms_3M2Fe5H; + fragmentions[ms_3M2Fe5H].positive = true; + fragmentions[ms_3M2Fe5H].multiplier = 3; + fragmentions[ms_3M2Fe5H].numberofisotopes = 1; - // initialize ion [3M+2Fe-7H]- - fragmentions[ms_3M2Fe7H].nterminal = true; - fragmentions[ms_3M2Fe7H].cterminal = true; - fragmentions[ms_3M2Fe7H].name = "[3M+2Fe-7H]-"; - fragmentions[ms_3M2Fe7H].massdifference = 2*Fe - 6*H - Hplus; - fragmentions[ms_3M2Fe7H].parent = ms_3M2Fe7H; - fragmentions[ms_3M2Fe7H].positive = false; - fragmentions[ms_3M2Fe7H].multiplier = 3; + // initialize ion [3M+2Fe-6H+Na]+ + fragmentions[ms_3M2Fe6HNa].nterminal = true; + fragmentions[ms_3M2Fe6HNa].cterminal = true; + fragmentions[ms_3M2Fe6HNa].name = "[3M+2Fe-6H+Na]+"; + fragmentions[ms_3M2Fe6HNa].massdifference = 2*Fe - 6*H + Naplus; + fragmentions[ms_3M2Fe6HNa].parent = ms_3M2Fe6HNa; + fragmentions[ms_3M2Fe6HNa].positive = true; + fragmentions[ms_3M2Fe6HNa].multiplier = 3; + fragmentions[ms_3M2Fe6HNa].numberofisotopes = 1; + + // initialize ion [M+Fe-4H]- + fragmentions[ms_MFe4H].nterminal = true; + fragmentions[ms_MFe4H].cterminal = true; + fragmentions[ms_MFe4H].name = "[M+Fe-4H]-"; + fragmentions[ms_MFe4H].massdifference = Fe - 3*H - Hplus; + fragmentions[ms_MFe4H].parent = ms_MFe4H; + fragmentions[ms_MFe4H].positive = false; + fragmentions[ms_MFe4H].multiplier = 1; + fragmentions[ms_MFe4H].numberofisotopes = 1; // initialize ion [2M+Fe-4H]- fragmentions[ms_2MFe4H].nterminal = true; @@ -632,6 +647,7 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_2MFe4H].parent = ms_2MFe4H; fragmentions[ms_2MFe4H].positive = false; fragmentions[ms_2MFe4H].multiplier = 2; + fragmentions[ms_2MFe4H].numberofisotopes = 1; // initialize ion [3M+Fe-4H]- fragmentions[ms_3MFe4H].nterminal = true; @@ -641,15 +657,1028 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_3MFe4H].parent = ms_3MFe4H; fragmentions[ms_3MFe4H].positive = false; fragmentions[ms_3MFe4H].multiplier = 3; + fragmentions[ms_3MFe4H].numberofisotopes = 1; - // initialize ion [M+Fe-4H]- - fragmentions[ms_MFe4H].nterminal = true; - fragmentions[ms_MFe4H].cterminal = true; - fragmentions[ms_MFe4H].name = "[M+Fe-4H]-"; - fragmentions[ms_MFe4H].massdifference = Fe - 3*H - Hplus; - fragmentions[ms_MFe4H].parent = ms_MFe4H; - fragmentions[ms_MFe4H].positive = false; - fragmentions[ms_MFe4H].multiplier = 1; + // initialize ion [3M+2Fe-7H]- + fragmentions[ms_3M2Fe7H].nterminal = true; + fragmentions[ms_3M2Fe7H].cterminal = true; + fragmentions[ms_3M2Fe7H].name = "[3M+2Fe-7H]-"; + fragmentions[ms_3M2Fe7H].massdifference = 2*Fe - 6*H - Hplus; + fragmentions[ms_3M2Fe7H].parent = ms_3M2Fe7H; + fragmentions[ms_3M2Fe7H].positive = false; + fragmentions[ms_3M2Fe7H].multiplier = 3; + fragmentions[ms_3M2Fe7H].numberofisotopes = 1; + + // initialize ion Li+ + fragmentions[ms_liplus].nterminal = true; + fragmentions[ms_liplus].cterminal = true; + fragmentions[ms_liplus].name = "[M+Li]+"; + fragmentions[ms_liplus].massdifference = Liplus; + fragmentions[ms_liplus].parent = ms_liplus; + fragmentions[ms_liplus].positive = true; + fragmentions[ms_liplus].multiplier = 1; + fragmentions[ms_liplus].numberofisotopes = 1; + + // initialize ion [M+Mg-H]+ + fragmentions[ms_MMgH].nterminal = true; + fragmentions[ms_MMgH].cterminal = true; + fragmentions[ms_MMgH].name = "[M+Mg-H]+"; + fragmentions[ms_MMgH].massdifference = Mg - 2*H + Hplus; + fragmentions[ms_MMgH].parent = ms_MMgH; + fragmentions[ms_MMgH].positive = true; + fragmentions[ms_MMgH].multiplier = 1; + fragmentions[ms_MMgH].numberofisotopes = 2; + + // initialize ion [M+Mg-2H+Na]+ + fragmentions[ms_MMg2HNa].nterminal = true; + fragmentions[ms_MMg2HNa].cterminal = true; + fragmentions[ms_MMg2HNa].name = "[M+Mg-2H+Na]+"; + fragmentions[ms_MMg2HNa].massdifference = Mg - 2*H + Naplus; + fragmentions[ms_MMg2HNa].parent = ms_MMg2HNa; + fragmentions[ms_MMg2HNa].positive = true; + fragmentions[ms_MMg2HNa].multiplier = 1; + fragmentions[ms_MMg2HNa].numberofisotopes = 2; + + // initialize ion [M+Mg-3H]- + fragmentions[ms_MMg3H].nterminal = true; + fragmentions[ms_MMg3H].cterminal = true; + fragmentions[ms_MMg3H].name = "[M+Mg-3H]-"; + fragmentions[ms_MMg3H].massdifference = Mg - 2*H - Hplus; + fragmentions[ms_MMg3H].parent = ms_MMg3H; + fragmentions[ms_MMg3H].positive = false; + fragmentions[ms_MMg3H].multiplier = 1; + fragmentions[ms_MMg3H].numberofisotopes = 2; + + // initialize ion [M+Al-2H]+ + fragmentions[ms_MAl2H].nterminal = true; + fragmentions[ms_MAl2H].cterminal = true; + fragmentions[ms_MAl2H].name = "[M+Al-2H]+"; + fragmentions[ms_MAl2H].massdifference = Al - 3*H + Hplus; + fragmentions[ms_MAl2H].parent = ms_MAl2H; + fragmentions[ms_MAl2H].positive = true; + fragmentions[ms_MAl2H].multiplier = 1; + fragmentions[ms_MAl2H].numberofisotopes = 0; + + // initialize ion [M+Al-3H+Na]+ + fragmentions[ms_MAl3HNa].nterminal = true; + fragmentions[ms_MAl3HNa].cterminal = true; + fragmentions[ms_MAl3HNa].name = "[M+Al-3H+Na]+"; + fragmentions[ms_MAl3HNa].massdifference = Al - 3*H + Naplus; + fragmentions[ms_MAl3HNa].parent = ms_MAl3HNa; + fragmentions[ms_MAl3HNa].positive = true; + fragmentions[ms_MAl3HNa].multiplier = 1; + fragmentions[ms_MAl3HNa].numberofisotopes = 0; + + // initialize ion [M+Al-4H]- + fragmentions[ms_MAl4H].nterminal = true; + fragmentions[ms_MAl4H].cterminal = true; + fragmentions[ms_MAl4H].name = "[M+Al-4H]-"; + fragmentions[ms_MAl4H].massdifference = Al - 3*H - Hplus; + fragmentions[ms_MAl4H].parent = ms_MAl4H; + fragmentions[ms_MAl4H].positive = false; + fragmentions[ms_MAl4H].multiplier = 1; + fragmentions[ms_MAl4H].numberofisotopes = 0; + + // initialize ion [M+Ca-H]+ + fragmentions[ms_MCaH].nterminal = true; + fragmentions[ms_MCaH].cterminal = true; + fragmentions[ms_MCaH].name = "[M+Ca-H]+"; + fragmentions[ms_MCaH].massdifference = Ca - 2*H + Hplus; + fragmentions[ms_MCaH].parent = ms_MCaH; + fragmentions[ms_MCaH].positive = true; + fragmentions[ms_MCaH].multiplier = 1; + fragmentions[ms_MCaH].numberofisotopes = 1; + + // initialize ion [M+Ca-2H+Na]+ + fragmentions[ms_MCa2HNa].nterminal = true; + fragmentions[ms_MCa2HNa].cterminal = true; + fragmentions[ms_MCa2HNa].name = "[M+Ca-2H+Na]+"; + fragmentions[ms_MCa2HNa].massdifference = Ca - 2*H + Naplus; + fragmentions[ms_MCa2HNa].parent = ms_MCa2HNa; + fragmentions[ms_MCa2HNa].positive = true; + fragmentions[ms_MCa2HNa].multiplier = 1; + fragmentions[ms_MCa2HNa].numberofisotopes = 1; + + // initialize ion [M+Ca-3H]- + fragmentions[ms_MCa3H].nterminal = true; + fragmentions[ms_MCa3H].cterminal = true; + fragmentions[ms_MCa3H].name = "[M+Ca-3H]-"; + fragmentions[ms_MCa3H].massdifference = Ca - 2*H - Hplus; + fragmentions[ms_MCa3H].parent = ms_MCa3H; + fragmentions[ms_MCa3H].positive = false; + fragmentions[ms_MCa3H].multiplier = 1; + fragmentions[ms_MCa3H].numberofisotopes = 1; + + // initialize ion [M+Mn-H]+ + fragmentions[ms_MMnH].nterminal = true; + fragmentions[ms_MMnH].cterminal = true; + fragmentions[ms_MMnH].name = "[M+Mn-H]+"; + fragmentions[ms_MMnH].massdifference = Mn - 2*H + Hplus; + fragmentions[ms_MMnH].parent = ms_MMnH; + fragmentions[ms_MMnH].positive = true; + fragmentions[ms_MMnH].multiplier = 1; + fragmentions[ms_MMnH].numberofisotopes = 0; + + // initialize ion [M+Mn-2H+Na]+ + fragmentions[ms_MMn2HNa].nterminal = true; + fragmentions[ms_MMn2HNa].cterminal = true; + fragmentions[ms_MMn2HNa].name = "[M+Mn-2H+Na]+"; + fragmentions[ms_MMn2HNa].massdifference = Mn - 2*H + Naplus; + fragmentions[ms_MMn2HNa].parent = ms_MMn2HNa; + fragmentions[ms_MMn2HNa].positive = true; + fragmentions[ms_MMn2HNa].multiplier = 1; + fragmentions[ms_MMn2HNa].numberofisotopes = 0; + + // initialize ion [M+Mn-3H]- + fragmentions[ms_MMn3H].nterminal = true; + fragmentions[ms_MMn3H].cterminal = true; + fragmentions[ms_MMn3H].name = "[M+Mn-3H]-"; + fragmentions[ms_MMn3H].massdifference = Mn - 2*H - Hplus; + fragmentions[ms_MMn3H].parent = ms_MMn3H; + fragmentions[ms_MMn3H].positive = false; + fragmentions[ms_MMn3H].multiplier = 1; + fragmentions[ms_MMn3H].numberofisotopes = 0; + + // initialize ion [M+Co-H]+ + fragmentions[ms_MCoH].nterminal = true; + fragmentions[ms_MCoH].cterminal = true; + fragmentions[ms_MCoH].name = "[M+Co-H]+"; + fragmentions[ms_MCoH].massdifference = Co - 2*H + Hplus; + fragmentions[ms_MCoH].parent = ms_MCoH; + fragmentions[ms_MCoH].positive = true; + fragmentions[ms_MCoH].multiplier = 1; + fragmentions[ms_MCoH].numberofisotopes = 0; + + // initialize ion [M+Co-2H+Na]+ + fragmentions[ms_MCo2HNa].nterminal = true; + fragmentions[ms_MCo2HNa].cterminal = true; + fragmentions[ms_MCo2HNa].name = "[M+Co-2H+Na]+"; + fragmentions[ms_MCo2HNa].massdifference = Co - 2*H + Naplus; + fragmentions[ms_MCo2HNa].parent = ms_MCo2HNa; + fragmentions[ms_MCo2HNa].positive = true; + fragmentions[ms_MCo2HNa].multiplier = 1; + fragmentions[ms_MCo2HNa].numberofisotopes = 0; + + // initialize ion [M+Co-3H]- + fragmentions[ms_MCo3H].nterminal = true; + fragmentions[ms_MCo3H].cterminal = true; + fragmentions[ms_MCo3H].name = "[M+Co-3H]-"; + fragmentions[ms_MCo3H].massdifference = Co - 2*H - Hplus; + fragmentions[ms_MCo3H].parent = ms_MCo3H; + fragmentions[ms_MCo3H].positive = false; + fragmentions[ms_MCo3H].multiplier = 1; + fragmentions[ms_MCo3H].numberofisotopes = 0; + + // initialize ion [M+Ni-H]+ + fragmentions[ms_MNiH].nterminal = true; + fragmentions[ms_MNiH].cterminal = true; + fragmentions[ms_MNiH].name = "[M+Ni-H]+"; + fragmentions[ms_MNiH].massdifference = Ni - 2*H + Hplus; + fragmentions[ms_MNiH].parent = ms_MNiH; + fragmentions[ms_MNiH].positive = true; + fragmentions[ms_MNiH].multiplier = 1; + fragmentions[ms_MNiH].numberofisotopes = 3; + + // initialize ion [M+Ni-2H+Na]+ + fragmentions[ms_MNi2HNa].nterminal = true; + fragmentions[ms_MNi2HNa].cterminal = true; + fragmentions[ms_MNi2HNa].name = "[M+Ni-2H+Na]+"; + fragmentions[ms_MNi2HNa].massdifference = Ni - 2*H + Naplus; + fragmentions[ms_MNi2HNa].parent = ms_MNi2HNa; + fragmentions[ms_MNi2HNa].positive = true; + fragmentions[ms_MNi2HNa].multiplier = 1; + fragmentions[ms_MNi2HNa].numberofisotopes = 3; + + // initialize ion [M+Ni-3H]- + fragmentions[ms_MNi3H].nterminal = true; + fragmentions[ms_MNi3H].cterminal = true; + fragmentions[ms_MNi3H].name = "[M+Ni-3H]-"; + fragmentions[ms_MNi3H].massdifference = Ni - 2*H - Hplus; + fragmentions[ms_MNi3H].parent = ms_MNi3H; + fragmentions[ms_MNi3H].positive = false; + fragmentions[ms_MNi3H].multiplier = 1; + fragmentions[ms_MNi3H].numberofisotopes = 3; + + // initialize ion [M+Cu-H]+ + fragmentions[ms_MCuH].nterminal = true; + fragmentions[ms_MCuH].cterminal = true; + fragmentions[ms_MCuH].name = "[M+Cu-H]+"; + fragmentions[ms_MCuH].massdifference = Cu - 2*H + Hplus; + fragmentions[ms_MCuH].parent = ms_MCuH; + fragmentions[ms_MCuH].positive = true; + fragmentions[ms_MCuH].multiplier = 1; + fragmentions[ms_MCuH].numberofisotopes = 1; + + // initialize ion [M+Cu-2H+Na]+ + fragmentions[ms_MCu2HNa].nterminal = true; + fragmentions[ms_MCu2HNa].cterminal = true; + fragmentions[ms_MCu2HNa].name = "[M+Cu-2H+Na]+"; + fragmentions[ms_MCu2HNa].massdifference = Cu - 2*H + Naplus; + fragmentions[ms_MCu2HNa].parent = ms_MCu2HNa; + fragmentions[ms_MCu2HNa].positive = true; + fragmentions[ms_MCu2HNa].multiplier = 1; + fragmentions[ms_MCu2HNa].numberofisotopes = 1; + + // initialize ion [M+Cu-3H]- + fragmentions[ms_MCu3H].nterminal = true; + fragmentions[ms_MCu3H].cterminal = true; + fragmentions[ms_MCu3H].name = "[M+Cu-3H]-"; + fragmentions[ms_MCu3H].massdifference = Cu - 2*H - Hplus; + fragmentions[ms_MCu3H].parent = ms_MCu3H; + fragmentions[ms_MCu3H].positive = false; + fragmentions[ms_MCu3H].multiplier = 1; + fragmentions[ms_MCu3H].numberofisotopes = 1; + + // initialize ion [M+Zn-H]+ + fragmentions[ms_MZnH].nterminal = true; + fragmentions[ms_MZnH].cterminal = true; + fragmentions[ms_MZnH].name = "[M+Zn-H]+"; + fragmentions[ms_MZnH].massdifference = Zn - 2*H + Hplus; + fragmentions[ms_MZnH].parent = ms_MZnH; + fragmentions[ms_MZnH].positive = true; + fragmentions[ms_MZnH].multiplier = 1; + fragmentions[ms_MZnH].numberofisotopes = 3; + + // initialize ion [M+Zn-2H+Na]+ + fragmentions[ms_MZn2HNa].nterminal = true; + fragmentions[ms_MZn2HNa].cterminal = true; + fragmentions[ms_MZn2HNa].name = "[M+Zn-2H+Na]+"; + fragmentions[ms_MZn2HNa].massdifference = Zn - 2*H + Naplus; + fragmentions[ms_MZn2HNa].parent = ms_MZn2HNa; + fragmentions[ms_MZn2HNa].positive = true; + fragmentions[ms_MZn2HNa].multiplier = 1; + fragmentions[ms_MZn2HNa].numberofisotopes = 3; + + // initialize ion [M+Zn-3H]- + fragmentions[ms_MZn3H].nterminal = true; + fragmentions[ms_MZn3H].cterminal = true; + fragmentions[ms_MZn3H].name = "[M+Zn-3H]-"; + fragmentions[ms_MZn3H].massdifference = Zn - 2*H - Hplus; + fragmentions[ms_MZn3H].parent = ms_MZn3H; + fragmentions[ms_MZn3H].positive = false; + fragmentions[ms_MZn3H].multiplier = 1; + fragmentions[ms_MZn3H].numberofisotopes = 3; + + // initialize ion [M+Ga-2H]+ + fragmentions[ms_MGa2H].nterminal = true; + fragmentions[ms_MGa2H].cterminal = true; + fragmentions[ms_MGa2H].name = "[M+Ga-2H]+"; + fragmentions[ms_MGa2H].massdifference = Ga - 3*H + Hplus; + fragmentions[ms_MGa2H].parent = ms_MGa2H; + fragmentions[ms_MGa2H].positive = true; + fragmentions[ms_MGa2H].multiplier = 1; + fragmentions[ms_MGa2H].numberofisotopes = 1; + + // initialize ion [M+Ga-3H+Na]+ + fragmentions[ms_MGa3HNa].nterminal = true; + fragmentions[ms_MGa3HNa].cterminal = true; + fragmentions[ms_MGa3HNa].name = "[M+Ga-3H+Na]+"; + fragmentions[ms_MGa3HNa].massdifference = Ga - 3*H + Naplus; + fragmentions[ms_MGa3HNa].parent = ms_MGa3HNa; + fragmentions[ms_MGa3HNa].positive = true; + fragmentions[ms_MGa3HNa].multiplier = 1; + fragmentions[ms_MGa3HNa].numberofisotopes = 1; + + // initialize ion [M+Ga-4H]- + fragmentions[ms_MGa4H].nterminal = true; + fragmentions[ms_MGa4H].cterminal = true; + fragmentions[ms_MGa4H].name = "[M+Ga-4H]-"; + fragmentions[ms_MGa4H].massdifference = Ga - 3*H - Hplus; + fragmentions[ms_MGa4H].parent = ms_MGa4H; + fragmentions[ms_MGa4H].positive = false; + fragmentions[ms_MGa4H].multiplier = 1; + fragmentions[ms_MGa4H].numberofisotopes = 1; + +#if POLYKETIDE_SIDEROPHORES == 1 + + // initialize l0h ion + fragmentions[l0h_ion].nterminal = true; + fragmentions[l0h_ion].cterminal = false; + fragmentions[l0h_ion].name = "LB-2H"; + fragmentions[l0h_ion].massdifference = L0H_ION + adductshift; + fragmentions[l0h_ion].parent = l0h_ion; + + // initialize l0h-H2O ion + fragmentions[l0h_ion_dehydrated].nterminal = true; + fragmentions[l0h_ion_dehydrated].cterminal = false; + fragmentions[l0h_ion_dehydrated].name = "LB*-2H"; + fragmentions[l0h_ion_dehydrated].massdifference = L0H_ION - H2O + adductshift; + fragmentions[l0h_ion_dehydrated].parent = l0h_ion; + + // initialize l0h-NH3 ion + fragmentions[l0h_ion_deamidated].nterminal = true; + fragmentions[l0h_ion_deamidated].cterminal = false; + fragmentions[l0h_ion_deamidated].name = "LBx-2H"; + fragmentions[l0h_ion_deamidated].massdifference = L0H_ION - NH3 + adductshift; + fragmentions[l0h_ion_deamidated].parent = l0h_ion; + + // initialize l0h-H2O-NH3 ion + fragmentions[l0h_ion_dehydrated_and_deamidated].nterminal = true; + fragmentions[l0h_ion_dehydrated_and_deamidated].cterminal = false; + fragmentions[l0h_ion_dehydrated_and_deamidated].name = "LB*x-2H"; + fragmentions[l0h_ion_dehydrated_and_deamidated].massdifference = L0H_ION - H2O - NH3 + adductshift; + fragmentions[l0h_ion_dehydrated_and_deamidated].parent = l0h_ion; + + // initialize l0h-CO ion + fragmentions[l0h_ion_co_loss].nterminal = true; + fragmentions[l0h_ion_co_loss].cterminal = false; + fragmentions[l0h_ion_co_loss].name = "LA-2H"; + fragmentions[l0h_ion_co_loss].massdifference = L0H_ION - CO + adductshift; + fragmentions[l0h_ion_co_loss].parent = l0h_ion; + + // initialize l0h-CO-H2O ion + fragmentions[l0h_ion_co_loss_dehydrated].nterminal = true; + fragmentions[l0h_ion_co_loss_dehydrated].cterminal = false; + fragmentions[l0h_ion_co_loss_dehydrated].name = "LA*-2H"; + fragmentions[l0h_ion_co_loss_dehydrated].massdifference = L0H_ION - CO - H2O + adductshift; + fragmentions[l0h_ion_co_loss_dehydrated].parent = l0h_ion; + + // initialize l0h-CO-NH3 ion + fragmentions[l0h_ion_co_loss_deamidated].nterminal = true; + fragmentions[l0h_ion_co_loss_deamidated].cterminal = false; + fragmentions[l0h_ion_co_loss_deamidated].name = "LAx-2H"; + fragmentions[l0h_ion_co_loss_deamidated].massdifference = L0H_ION - CO - NH3 + adductshift; + fragmentions[l0h_ion_co_loss_deamidated].parent = l0h_ion; + + // initialize l0h-CO-H2O-NH3 ion + fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; + fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].name = "LA*x-2H"; + fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].massdifference = L0H_ION - CO - H2O - NH3 + adductshift; + fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].parent = l0h_ion; + + // initialize l1h ion + fragmentions[l1h_ion].nterminal = true; + fragmentions[l1h_ion].cterminal = false; + fragmentions[l1h_ion].name = "LB"; + fragmentions[l1h_ion].massdifference = L1H_ION + adductshift; + fragmentions[l1h_ion].parent = l1h_ion; + + // initialize l1h-H2O ion + fragmentions[l1h_ion_dehydrated].nterminal = true; + fragmentions[l1h_ion_dehydrated].cterminal = false; + fragmentions[l1h_ion_dehydrated].name = "LB*"; + fragmentions[l1h_ion_dehydrated].massdifference = L1H_ION - H2O + adductshift; + fragmentions[l1h_ion_dehydrated].parent = l1h_ion; + + // initialize l1h-NH3 ion + fragmentions[l1h_ion_deamidated].nterminal = true; + fragmentions[l1h_ion_deamidated].cterminal = false; + fragmentions[l1h_ion_deamidated].name = "LBx"; + fragmentions[l1h_ion_deamidated].massdifference = L1H_ION - NH3 + adductshift; + fragmentions[l1h_ion_deamidated].parent = l1h_ion; + + // initialize l1h-H2O-NH3 ion + fragmentions[l1h_ion_dehydrated_and_deamidated].nterminal = true; + fragmentions[l1h_ion_dehydrated_and_deamidated].cterminal = false; + fragmentions[l1h_ion_dehydrated_and_deamidated].name = "LB*x"; + fragmentions[l1h_ion_dehydrated_and_deamidated].massdifference = L1H_ION - H2O - NH3 + adductshift; + fragmentions[l1h_ion_dehydrated_and_deamidated].parent = l1h_ion; + + // initialize l1h-CO ion + fragmentions[l1h_ion_co_loss].nterminal = true; + fragmentions[l1h_ion_co_loss].cterminal = false; + fragmentions[l1h_ion_co_loss].name = "LA"; + fragmentions[l1h_ion_co_loss].massdifference = L1H_ION - CO + adductshift; + fragmentions[l1h_ion_co_loss].parent = l1h_ion; + + // initialize l1h-CO-H2O ion + fragmentions[l1h_ion_co_loss_dehydrated].nterminal = true; + fragmentions[l1h_ion_co_loss_dehydrated].cterminal = false; + fragmentions[l1h_ion_co_loss_dehydrated].name = "LA*"; + fragmentions[l1h_ion_co_loss_dehydrated].massdifference = L1H_ION - CO - H2O + adductshift; + fragmentions[l1h_ion_co_loss_dehydrated].parent = l1h_ion; + + // initialize l1h-CO-NH3 ion + fragmentions[l1h_ion_co_loss_deamidated].nterminal = true; + fragmentions[l1h_ion_co_loss_deamidated].cterminal = false; + fragmentions[l1h_ion_co_loss_deamidated].name = "LAx"; + fragmentions[l1h_ion_co_loss_deamidated].massdifference = L1H_ION - CO - NH3 + adductshift; + fragmentions[l1h_ion_co_loss_deamidated].parent = l1h_ion; + + // initialize l1h-CO-H2O-NH3 ion + fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; + fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].name = "LA*x"; + fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].massdifference = L1H_ION - CO - H2O - NH3 + adductshift; + fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].parent = l1h_ion; + + // initialize l2h ion + fragmentions[l2h_ion].nterminal = true; + fragmentions[l2h_ion].cterminal = false; + fragmentions[l2h_ion].name = "LB+2H"; + fragmentions[l2h_ion].massdifference = L2H_ION + adductshift; + fragmentions[l2h_ion].parent = l2h_ion; + + // initialize l2h-H2O ion + fragmentions[l2h_ion_dehydrated].nterminal = true; + fragmentions[l2h_ion_dehydrated].cterminal = false; + fragmentions[l2h_ion_dehydrated].name = "LB*+2H"; + fragmentions[l2h_ion_dehydrated].massdifference = L2H_ION - H2O + adductshift; + fragmentions[l2h_ion_dehydrated].parent = l2h_ion; + + // initialize l2h-NH3 ion + fragmentions[l2h_ion_deamidated].nterminal = true; + fragmentions[l2h_ion_deamidated].cterminal = false; + fragmentions[l2h_ion_deamidated].name = "LBx+2H"; + fragmentions[l2h_ion_deamidated].massdifference = L2H_ION - NH3 + adductshift; + fragmentions[l2h_ion_deamidated].parent = l2h_ion; + + // initialize l2h-H2O-NH3 ion + fragmentions[l2h_ion_dehydrated_and_deamidated].nterminal = true; + fragmentions[l2h_ion_dehydrated_and_deamidated].cterminal = false; + fragmentions[l2h_ion_dehydrated_and_deamidated].name = "LB*x+2H"; + fragmentions[l2h_ion_dehydrated_and_deamidated].massdifference = L2H_ION - H2O - NH3 + adductshift; + fragmentions[l2h_ion_dehydrated_and_deamidated].parent = l2h_ion; + + // initialize l2h-CO ion + fragmentions[l2h_ion_co_loss].nterminal = true; + fragmentions[l2h_ion_co_loss].cterminal = false; + fragmentions[l2h_ion_co_loss].name = "LA+2H"; + fragmentions[l2h_ion_co_loss].massdifference = L2H_ION - CO + adductshift; + fragmentions[l2h_ion_co_loss].parent = l2h_ion; + + // initialize l2h-CO-H2O ion + fragmentions[l2h_ion_co_loss_dehydrated].nterminal = true; + fragmentions[l2h_ion_co_loss_dehydrated].cterminal = false; + fragmentions[l2h_ion_co_loss_dehydrated].name = "LA*+2H"; + fragmentions[l2h_ion_co_loss_dehydrated].massdifference = L2H_ION - CO - H2O + adductshift; + fragmentions[l2h_ion_co_loss_dehydrated].parent = l2h_ion; + + // initialize l2h-CO-NH3 ion + fragmentions[l2h_ion_co_loss_deamidated].nterminal = true; + fragmentions[l2h_ion_co_loss_deamidated].cterminal = false; + fragmentions[l2h_ion_co_loss_deamidated].name = "LAx+2H"; + fragmentions[l2h_ion_co_loss_deamidated].massdifference = L2H_ION - CO - NH3 + adductshift; + fragmentions[l2h_ion_co_loss_deamidated].parent = l2h_ion; + + // initialize l2h-CO-H2O-NH3 ion + fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; + fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].name = "LA*x+2H"; + fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].massdifference = L2H_ION - CO - H2O - NH3 + adductshift; + fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].parent = l2h_ion; + + // initialize r1h ion + fragmentions[r1h_ion].nterminal = true; + fragmentions[r1h_ion].cterminal = false; + fragmentions[r1h_ion].name = "RB"; + fragmentions[r1h_ion].massdifference = R1H_ION + adductshift; + fragmentions[r1h_ion].parent = r1h_ion; + + // initialize r1h-H2O ion + fragmentions[r1h_ion_dehydrated].nterminal = true; + fragmentions[r1h_ion_dehydrated].cterminal = false; + fragmentions[r1h_ion_dehydrated].name = "RB*"; + fragmentions[r1h_ion_dehydrated].massdifference = R1H_ION - H2O + adductshift; + fragmentions[r1h_ion_dehydrated].parent = r1h_ion; + + // initialize r1h-NH3 ion + fragmentions[r1h_ion_deamidated].nterminal = true; + fragmentions[r1h_ion_deamidated].cterminal = false; + fragmentions[r1h_ion_deamidated].name = "RBx"; + fragmentions[r1h_ion_deamidated].massdifference = R1H_ION - NH3 + adductshift; + fragmentions[r1h_ion_deamidated].parent = r1h_ion; + + // initialize r1h-H2O-NH3 ion + fragmentions[r1h_ion_dehydrated_and_deamidated].nterminal = true; + fragmentions[r1h_ion_dehydrated_and_deamidated].cterminal = false; + fragmentions[r1h_ion_dehydrated_and_deamidated].name = "RB*x"; + fragmentions[r1h_ion_dehydrated_and_deamidated].massdifference = R1H_ION - H2O - NH3 + adductshift; + fragmentions[r1h_ion_dehydrated_and_deamidated].parent = r1h_ion; + + // initialize r1h-CO ion + fragmentions[r1h_ion_co_loss].nterminal = true; + fragmentions[r1h_ion_co_loss].cterminal = false; + fragmentions[r1h_ion_co_loss].name = "RA"; + fragmentions[r1h_ion_co_loss].massdifference = R1H_ION - CO + adductshift; + fragmentions[r1h_ion_co_loss].parent = r1h_ion; + + // initialize r1h-CO-H2O ion + fragmentions[r1h_ion_co_loss_dehydrated].nterminal = true; + fragmentions[r1h_ion_co_loss_dehydrated].cterminal = false; + fragmentions[r1h_ion_co_loss_dehydrated].name = "RA*"; + fragmentions[r1h_ion_co_loss_dehydrated].massdifference = R1H_ION - CO - H2O + adductshift; + fragmentions[r1h_ion_co_loss_dehydrated].parent = r1h_ion; + + // initialize r1h-CO-NH3 ion + fragmentions[r1h_ion_co_loss_deamidated].nterminal = true; + fragmentions[r1h_ion_co_loss_deamidated].cterminal = false; + fragmentions[r1h_ion_co_loss_deamidated].name = "RAx"; + fragmentions[r1h_ion_co_loss_deamidated].massdifference = R1H_ION - CO - NH3 + adductshift; + fragmentions[r1h_ion_co_loss_deamidated].parent = r1h_ion; + + // initialize r1h-CO-H2O-NH3 ion + fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; + fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].name = "RA*x"; + fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].massdifference = R1H_ION - CO - H2O - NH3 + adductshift; + fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].parent = r1h_ion; + + // initialize r2h ion + fragmentions[r2h_ion].nterminal = true; + fragmentions[r2h_ion].cterminal = false; + fragmentions[r2h_ion].name = "RB+2H"; + fragmentions[r2h_ion].massdifference = R2H_ION + adductshift; + fragmentions[r2h_ion].parent = r2h_ion; + + // initialize r2h-H2O ion + fragmentions[r2h_ion_dehydrated].nterminal = true; + fragmentions[r2h_ion_dehydrated].cterminal = false; + fragmentions[r2h_ion_dehydrated].name = "RB*+2H"; + fragmentions[r2h_ion_dehydrated].massdifference = R2H_ION - H2O + adductshift; + fragmentions[r2h_ion_dehydrated].parent = r2h_ion; + + // initialize r2h-NH3 ion + fragmentions[r2h_ion_deamidated].nterminal = true; + fragmentions[r2h_ion_deamidated].cterminal = false; + fragmentions[r2h_ion_deamidated].name = "RBx+2H"; + fragmentions[r2h_ion_deamidated].massdifference = R2H_ION - NH3 + adductshift; + fragmentions[r2h_ion_deamidated].parent = r2h_ion; + + // initialize r2h-H2O-NH3 ion + fragmentions[r2h_ion_dehydrated_and_deamidated].nterminal = true; + fragmentions[r2h_ion_dehydrated_and_deamidated].cterminal = false; + fragmentions[r2h_ion_dehydrated_and_deamidated].name = "RB*x+2H"; + fragmentions[r2h_ion_dehydrated_and_deamidated].massdifference = R2H_ION - H2O - NH3 + adductshift; + fragmentions[r2h_ion_dehydrated_and_deamidated].parent = r2h_ion; + + // initialize r2h-CO ion + fragmentions[r2h_ion_co_loss].nterminal = true; + fragmentions[r2h_ion_co_loss].cterminal = false; + fragmentions[r2h_ion_co_loss].name = "RA+2H"; + fragmentions[r2h_ion_co_loss].massdifference = R2H_ION - CO + adductshift; + fragmentions[r2h_ion_co_loss].parent = r2h_ion; + + // initialize r2h-CO-H2O ion + fragmentions[r2h_ion_co_loss_dehydrated].nterminal = true; + fragmentions[r2h_ion_co_loss_dehydrated].cterminal = false; + fragmentions[r2h_ion_co_loss_dehydrated].name = "RA*+2H"; + fragmentions[r2h_ion_co_loss_dehydrated].massdifference = R2H_ION - CO - H2O + adductshift; + fragmentions[r2h_ion_co_loss_dehydrated].parent = r2h_ion; + + // initialize r2h-CO-NH3 ion + fragmentions[r2h_ion_co_loss_deamidated].nterminal = true; + fragmentions[r2h_ion_co_loss_deamidated].cterminal = false; + fragmentions[r2h_ion_co_loss_deamidated].name = "RAx+2H"; + fragmentions[r2h_ion_co_loss_deamidated].massdifference = R2H_ION - CO - NH3 + adductshift; + fragmentions[r2h_ion_co_loss_deamidated].parent = r2h_ion; + + // initialize r2h-CO-H2O-NH3 ion + fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; + fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].name = "RA*x+2H"; + fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].massdifference = R2H_ION - CO - H2O - NH3 + adductshift; + fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].parent = r2h_ion; + + // initialize l1oh ion + fragmentions[l1oh_ion].nterminal = false; + fragmentions[l1oh_ion].cterminal = true; + fragmentions[l1oh_ion].name = "LY-2H"; + fragmentions[l1oh_ion].massdifference = L1OH_ION + adductshift; + fragmentions[l1oh_ion].parent = l1oh_ion; + + // initialize l1oh-H2O ion + fragmentions[l1oh_ion_dehydrated].nterminal = false; + fragmentions[l1oh_ion_dehydrated].cterminal = true; + fragmentions[l1oh_ion_dehydrated].name = "LY*-2H"; + fragmentions[l1oh_ion_dehydrated].massdifference = L1OH_ION - H2O + adductshift; + fragmentions[l1oh_ion_dehydrated].parent = l1oh_ion; + + // initialize l1oh-NH3 ion + fragmentions[l1oh_ion_deamidated].nterminal = false; + fragmentions[l1oh_ion_deamidated].cterminal = true; + fragmentions[l1oh_ion_deamidated].name = "LYx-2H"; + fragmentions[l1oh_ion_deamidated].massdifference = L1OH_ION - NH3 + adductshift; + fragmentions[l1oh_ion_deamidated].parent = l1oh_ion; + + // initialize l1oh-H2O-NH3 ion + fragmentions[l1oh_ion_dehydrated_and_deamidated].nterminal = false; + fragmentions[l1oh_ion_dehydrated_and_deamidated].cterminal = true; + fragmentions[l1oh_ion_dehydrated_and_deamidated].name = "LY*x-2H"; + fragmentions[l1oh_ion_dehydrated_and_deamidated].massdifference = L1OH_ION - H2O - NH3 + adductshift; + fragmentions[l1oh_ion_dehydrated_and_deamidated].parent = l1oh_ion; + + // initialize l1oh-CO ion + fragmentions[l1oh_ion_co_loss].nterminal = false; + fragmentions[l1oh_ion_co_loss].cterminal = true; + fragmentions[l1oh_ion_co_loss].name = "LY-2H-CO"; + fragmentions[l1oh_ion_co_loss].massdifference = L1OH_ION - CO + adductshift; + fragmentions[l1oh_ion_co_loss].parent = l1oh_ion; + + // initialize l1oh-CO-H2O ion + fragmentions[l1oh_ion_co_loss_dehydrated].nterminal = false; + fragmentions[l1oh_ion_co_loss_dehydrated].cterminal = true; + fragmentions[l1oh_ion_co_loss_dehydrated].name = "LY*-2H-CO"; + fragmentions[l1oh_ion_co_loss_dehydrated].massdifference = L1OH_ION - CO - H2O + adductshift; + fragmentions[l1oh_ion_co_loss_dehydrated].parent = l1oh_ion; + + // initialize l1oh-CO-NH3 ion + fragmentions[l1oh_ion_co_loss_deamidated].nterminal = false; + fragmentions[l1oh_ion_co_loss_deamidated].cterminal = true; + fragmentions[l1oh_ion_co_loss_deamidated].name = "LYx-2H-CO"; + fragmentions[l1oh_ion_co_loss_deamidated].massdifference = L1OH_ION - CO - NH3 + adductshift; + fragmentions[l1oh_ion_co_loss_deamidated].parent = l1oh_ion; + + // initialize l1oh-CO-H2O-NH3 ion + fragmentions[l1oh_ion_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[l1oh_ion_co_loss_dehydrated_and_deamidated].cterminal = true; + fragmentions[l1oh_ion_co_loss_dehydrated_and_deamidated].name = "LY*x-2H-CO"; + fragmentions[l1oh_ion_co_loss_dehydrated_and_deamidated].massdifference = L1OH_ION - CO - H2O - NH3 + adductshift; + fragmentions[l1oh_ion_co_loss_dehydrated_and_deamidated].parent = l1oh_ion; + + // initialize l2oh ion + fragmentions[l2oh_ion].nterminal = false; + fragmentions[l2oh_ion].cterminal = true; + fragmentions[l2oh_ion].name = "LY"; + fragmentions[l2oh_ion].massdifference = L2OH_ION + adductshift; + fragmentions[l2oh_ion].parent = l2oh_ion; + + // initialize l2oh-H2O ion + fragmentions[l2oh_ion_dehydrated].nterminal = false; + fragmentions[l2oh_ion_dehydrated].cterminal = true; + fragmentions[l2oh_ion_dehydrated].name = "LY*"; + fragmentions[l2oh_ion_dehydrated].massdifference = L2OH_ION - H2O + adductshift; + fragmentions[l2oh_ion_dehydrated].parent = l2oh_ion; + + // initialize l2oh-NH3 ion + fragmentions[l2oh_ion_deamidated].nterminal = false; + fragmentions[l2oh_ion_deamidated].cterminal = true; + fragmentions[l2oh_ion_deamidated].name = "LYx"; + fragmentions[l2oh_ion_deamidated].massdifference = L2OH_ION - NH3 + adductshift; + fragmentions[l2oh_ion_deamidated].parent = l2oh_ion; + + // initialize l2oh-H2O-NH3 ion + fragmentions[l2oh_ion_dehydrated_and_deamidated].nterminal = false; + fragmentions[l2oh_ion_dehydrated_and_deamidated].cterminal = true; + fragmentions[l2oh_ion_dehydrated_and_deamidated].name = "LY*x"; + fragmentions[l2oh_ion_dehydrated_and_deamidated].massdifference = L2OH_ION - H2O - NH3 + adductshift; + fragmentions[l2oh_ion_dehydrated_and_deamidated].parent = l2oh_ion; + + // initialize l2oh-CO ion + fragmentions[l2oh_ion_co_loss].nterminal = false; + fragmentions[l2oh_ion_co_loss].cterminal = true; + fragmentions[l2oh_ion_co_loss].name = "LY-CO"; + fragmentions[l2oh_ion_co_loss].massdifference = L2OH_ION - CO + adductshift; + fragmentions[l2oh_ion_co_loss].parent = l2oh_ion; + + // initialize l2oh-CO-H2O ion + fragmentions[l2oh_ion_co_loss_dehydrated].nterminal = false; + fragmentions[l2oh_ion_co_loss_dehydrated].cterminal = true; + fragmentions[l2oh_ion_co_loss_dehydrated].name = "LY*-CO"; + fragmentions[l2oh_ion_co_loss_dehydrated].massdifference = L2OH_ION - CO - H2O + adductshift; + fragmentions[l2oh_ion_co_loss_dehydrated].parent = l2oh_ion; + + // initialize l2oh-CO-NH3 ion + fragmentions[l2oh_ion_co_loss_deamidated].nterminal = false; + fragmentions[l2oh_ion_co_loss_deamidated].cterminal = true; + fragmentions[l2oh_ion_co_loss_deamidated].name = "LYx-CO"; + fragmentions[l2oh_ion_co_loss_deamidated].massdifference = L2OH_ION - CO - NH3 + adductshift; + fragmentions[l2oh_ion_co_loss_deamidated].parent = l2oh_ion; + + // initialize l2oh-CO-H2O-NH3 ion + fragmentions[l2oh_ion_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[l2oh_ion_co_loss_dehydrated_and_deamidated].cterminal = true; + fragmentions[l2oh_ion_co_loss_dehydrated_and_deamidated].name = "LY*x-CO"; + fragmentions[l2oh_ion_co_loss_dehydrated_and_deamidated].massdifference = L2OH_ION - CO - H2O - NH3 + adductshift; + fragmentions[l2oh_ion_co_loss_dehydrated_and_deamidated].parent = l2oh_ion; + + // initialize r1oh ion + fragmentions[r1oh_ion].nterminal = false; + fragmentions[r1oh_ion].cterminal = true; + fragmentions[r1oh_ion].name = "RY-2H"; + fragmentions[r1oh_ion].massdifference = R1OH_ION + adductshift; + fragmentions[r1oh_ion].parent = r1oh_ion; + + // initialize r1oh-H2O ion + fragmentions[r1oh_ion_dehydrated].nterminal = false; + fragmentions[r1oh_ion_dehydrated].cterminal = true; + fragmentions[r1oh_ion_dehydrated].name = "RY*-2H"; + fragmentions[r1oh_ion_dehydrated].massdifference = R1OH_ION - H2O + adductshift; + fragmentions[r1oh_ion_dehydrated].parent = r1oh_ion; + + // initialize r1oh-NH3 ion + fragmentions[r1oh_ion_deamidated].nterminal = false; + fragmentions[r1oh_ion_deamidated].cterminal = true; + fragmentions[r1oh_ion_deamidated].name = "RYx-2H"; + fragmentions[r1oh_ion_deamidated].massdifference = R1OH_ION - NH3 + adductshift; + fragmentions[r1oh_ion_deamidated].parent = r1oh_ion; + + // initialize r1oh-H2O-NH3 ion + fragmentions[r1oh_ion_dehydrated_and_deamidated].nterminal = false; + fragmentions[r1oh_ion_dehydrated_and_deamidated].cterminal = true; + fragmentions[r1oh_ion_dehydrated_and_deamidated].name = "RY*x-2H"; + fragmentions[r1oh_ion_dehydrated_and_deamidated].massdifference = R1OH_ION - H2O - NH3 + adductshift; + fragmentions[r1oh_ion_dehydrated_and_deamidated].parent = r1oh_ion; + + // initialize r1oh-CO ion + fragmentions[r1oh_ion_co_loss].nterminal = false; + fragmentions[r1oh_ion_co_loss].cterminal = true; + fragmentions[r1oh_ion_co_loss].name = "RY-2H-CO"; + fragmentions[r1oh_ion_co_loss].massdifference = R1OH_ION - CO + adductshift; + fragmentions[r1oh_ion_co_loss].parent = r1oh_ion; + + // initialize r1oh-CO-H2O ion + fragmentions[r1oh_ion_co_loss_dehydrated].nterminal = false; + fragmentions[r1oh_ion_co_loss_dehydrated].cterminal = true; + fragmentions[r1oh_ion_co_loss_dehydrated].name = "RY*-2H-CO"; + fragmentions[r1oh_ion_co_loss_dehydrated].massdifference = R1OH_ION - CO - H2O + adductshift; + fragmentions[r1oh_ion_co_loss_dehydrated].parent = r1oh_ion; + + // initialize r1oh-CO-NH3 ion + fragmentions[r1oh_ion_co_loss_deamidated].nterminal = false; + fragmentions[r1oh_ion_co_loss_deamidated].cterminal = true; + fragmentions[r1oh_ion_co_loss_deamidated].name = "RYx-2H-CO"; + fragmentions[r1oh_ion_co_loss_deamidated].massdifference = R1OH_ION - CO - NH3 + adductshift; + fragmentions[r1oh_ion_co_loss_deamidated].parent = r1oh_ion; + + // initialize r1oh-CO-H2O-NH3 ion + fragmentions[r1oh_ion_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[r1oh_ion_co_loss_dehydrated_and_deamidated].cterminal = true; + fragmentions[r1oh_ion_co_loss_dehydrated_and_deamidated].name = "RY*x-2H-CO"; + fragmentions[r1oh_ion_co_loss_dehydrated_and_deamidated].massdifference = R1OH_ION - CO - H2O - NH3 + adductshift; + fragmentions[r1oh_ion_co_loss_dehydrated_and_deamidated].parent = r1oh_ion; + + // initialize r2oh ion + fragmentions[r2oh_ion].nterminal = false; + fragmentions[r2oh_ion].cterminal = true; + fragmentions[r2oh_ion].name = "RY"; + fragmentions[r2oh_ion].massdifference = R2OH_ION + adductshift; + fragmentions[r2oh_ion].parent = r2oh_ion; + + // initialize r2oh-H2O ion + fragmentions[r2oh_ion_dehydrated].nterminal = false; + fragmentions[r2oh_ion_dehydrated].cterminal = true; + fragmentions[r2oh_ion_dehydrated].name = "RY*"; + fragmentions[r2oh_ion_dehydrated].massdifference = R2OH_ION - H2O + adductshift; + fragmentions[r2oh_ion_dehydrated].parent = r2oh_ion; + + // initialize r2oh-NH3 ion + fragmentions[r2oh_ion_deamidated].nterminal = false; + fragmentions[r2oh_ion_deamidated].cterminal = true; + fragmentions[r2oh_ion_deamidated].name = "RYx"; + fragmentions[r2oh_ion_deamidated].massdifference = R2OH_ION - NH3 + adductshift; + fragmentions[r2oh_ion_deamidated].parent = r2oh_ion; + + // initialize r2oh-H2O-NH3 ion + fragmentions[r2oh_ion_dehydrated_and_deamidated].nterminal = false; + fragmentions[r2oh_ion_dehydrated_and_deamidated].cterminal = true; + fragmentions[r2oh_ion_dehydrated_and_deamidated].name = "RY*x"; + fragmentions[r2oh_ion_dehydrated_and_deamidated].massdifference = R2OH_ION - H2O - NH3 + adductshift; + fragmentions[r2oh_ion_dehydrated_and_deamidated].parent = r2oh_ion; + + // initialize r2oh-CO ion + fragmentions[r2oh_ion_co_loss].nterminal = false; + fragmentions[r2oh_ion_co_loss].cterminal = true; + fragmentions[r2oh_ion_co_loss].name = "RY-CO"; + fragmentions[r2oh_ion_co_loss].massdifference = R2OH_ION - CO + adductshift; + fragmentions[r2oh_ion_co_loss].parent = r2oh_ion; + + // initialize r2oh-CO-H2O ion + fragmentions[r2oh_ion_co_loss_dehydrated].nterminal = false; + fragmentions[r2oh_ion_co_loss_dehydrated].cterminal = true; + fragmentions[r2oh_ion_co_loss_dehydrated].name = "RY*-CO"; + fragmentions[r2oh_ion_co_loss_dehydrated].massdifference = R2OH_ION - CO - H2O + adductshift; + fragmentions[r2oh_ion_co_loss_dehydrated].parent = r2oh_ion; + + // initialize r2oh-CO-NH3 ion + fragmentions[r2oh_ion_co_loss_deamidated].nterminal = false; + fragmentions[r2oh_ion_co_loss_deamidated].cterminal = true; + fragmentions[r2oh_ion_co_loss_deamidated].name = "RYx-CO"; + fragmentions[r2oh_ion_co_loss_deamidated].massdifference = R2OH_ION - CO - NH3 + adductshift; + fragmentions[r2oh_ion_co_loss_deamidated].parent = r2oh_ion; + + // initialize r2oh-CO-H2O-NH3 ion + fragmentions[r2oh_ion_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[r2oh_ion_co_loss_dehydrated_and_deamidated].cterminal = true; + fragmentions[r2oh_ion_co_loss_dehydrated_and_deamidated].name = "RY*x-CO"; + fragmentions[r2oh_ion_co_loss_dehydrated_and_deamidated].massdifference = R2OH_ION - CO - H2O - NH3 + adductshift; + fragmentions[r2oh_ion_co_loss_dehydrated_and_deamidated].parent = r2oh_ion; + + // initialize linear polyketide siderophore precursor ion (H-...-H) + fragmentions[linear_polyketide_precursor_ion_h_h].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h].name = "[M+zH]+ (H-...-H)"; + fragmentions[linear_polyketide_precursor_ion_h_h].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_h].parent = linear_polyketide_precursor_ion_h_h; + + // initialize linear polyketide siderophore precursor ion (H-...-H) - H2O + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].name = "[M+zH]+ * (H-...-H)"; + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - H2O + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].parent = linear_polyketide_precursor_ion_h_h; + + // initialize linear polyketide siderophore precursor ion (H-...-H) - NH3 + fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].name = "[M+zH]+ x (H-...-H)"; + fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].parent = linear_polyketide_precursor_ion_h_h; + + // initialize linear polyketide siderophore precursor ion (H-...-H) - H2O - NH3 + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].name = "[M+zH]+ *x (H-...-H)"; + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - H2O - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_h_h; + + // initialize linear polyketide siderophore precursor ion (H-...-H) - CO + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].name = "[M+zH]+ -CO (H-...-H)"; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - CO + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].parent = linear_polyketide_precursor_ion_h_h_co_loss; + + // initialize linear polyketide siderophore precursor ion (H-...-H) - CO - H2O + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].name = "[M+zH]+ *-CO (H-...-H)"; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - CO - H2O + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].parent = linear_polyketide_precursor_ion_h_h_co_loss; + + // initialize linear polyketide siderophore precursor ion (H-...-H) - CO - NH3 + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].name = "[M+zH]+ x-CO (H-...-H)"; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - CO - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].parent = linear_polyketide_precursor_ion_h_h_co_loss; + + // initialize linear polyketide siderophore precursor ion (H-...-H) - CO - H2O - NH3 + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (H-...-H)"; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - CO - H2O - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_h_h_co_loss; + + // initialize linear polyketide siderophore precursor ion (H-...-OH) + fragmentions[linear_polyketide_precursor_ion_h_oh].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh].name = "[M+zH]+ (H-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_h_oh].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_oh].parent = linear_polyketide_precursor_ion_h_oh; + + // initialize linear polyketide siderophore precursor ion (H-...-OH) - H2O + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].name = "[M+zH]+ * (H-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - H2O + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].parent = linear_polyketide_precursor_ion_h_oh; + + // initialize linear polyketide siderophore precursor ion (H-...-OH) - NH3 + fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].name = "[M+zH]+ x (H-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].parent = linear_polyketide_precursor_ion_h_oh; + + // initialize linear polyketide siderophore precursor ion (H-...-OH) - H2O - NH3 + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].name = "[M+zH]+ *x (H-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - H2O - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_h_oh; + + // initialize linear polyketide siderophore precursor ion (H-...-OH) - CO + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].name = "[M+zH]+ -CO (H-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - CO + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].parent = linear_polyketide_precursor_ion_h_oh_co_loss; + + // initialize linear polyketide siderophore precursor ion (H-...-OH) - CO - H2O + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].name = "[M+zH]+ *-CO (H-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - CO - H2O + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].parent = linear_polyketide_precursor_ion_h_oh_co_loss; + + // initialize linear polyketide siderophore precursor ion (H-...-OH) - CO - NH3 + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].name = "[M+zH]+ x-CO (H-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - CO - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].parent = linear_polyketide_precursor_ion_h_oh_co_loss; + + // initialize linear polyketide siderophore precursor ion (H-...-OH) - CO - H2O - NH3 + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (H-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - CO - H2O - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_h_oh_co_loss; + + // initialize linear polyketide siderophore precursor ion (HO-...-OH) + fragmentions[linear_polyketide_precursor_ion_oh_oh].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh].name = "[M+zH]+ (HO-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_oh_oh].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH + adductshift; + fragmentions[linear_polyketide_precursor_ion_oh_oh].parent = linear_polyketide_precursor_ion_oh_oh; + + // initialize linear polyketide siderophore precursor ion (HO-...-OH) - H2O + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].name = "[M+zH]+ * (HO-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - H2O + adductshift; + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].parent = linear_polyketide_precursor_ion_oh_oh; + + // initialize linear polyketide siderophore precursor ion (HO-...-OH) - NH3 + fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].name = "[M+zH]+ x (HO-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].parent = linear_polyketide_precursor_ion_oh_oh; + + // initialize linear polyketide siderophore precursor ion (HO-...-OH) - H2O - NH3 + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].name = "[M+zH]+ *x (HO-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - H2O - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_oh_oh; + + // initialize linear polyketide siderophore precursor ion (HO-...-OH) - CO + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].name = "[M+zH]+ -CO (HO-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - CO + adductshift; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].parent = linear_polyketide_precursor_ion_oh_oh_co_loss; + + // initialize linear polyketide siderophore precursor ion (HO-...-OH) - CO - H2O + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].name = "[M+zH]+ *-CO (HO-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - CO - H2O + adductshift; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].parent = linear_polyketide_precursor_ion_oh_oh_co_loss; + + // initialize linear polyketide siderophore precursor ion (HO-...-OH) - CO - NH3 + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].name = "[M+zH]+ x-CO (HO-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - CO - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].parent = linear_polyketide_precursor_ion_oh_oh_co_loss; + + // initialize linear polyketide siderophore precursor ion (HO-...-OH) - CO - H2O - NH3 + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (HO-...-OH)"; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - CO - H2O - NH3 + adductshift; + fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_oh_oh_co_loss; + + // initialize cyclic polyketide siderophore precursor ion + fragmentions[cyclic_polyketide_precursor_ion].nterminal = false; + fragmentions[cyclic_polyketide_precursor_ion].cterminal = false; + fragmentions[cyclic_polyketide_precursor_ion].name = "[M+zH]+"; + fragmentions[cyclic_polyketide_precursor_ion].massdifference = Hplus + adductshift; + fragmentions[cyclic_polyketide_precursor_ion].parent = cyclic_polyketide_precursor_ion; + + // initialize cyclic polyketide siderophore precursor ion - H2O + fragmentions[cyclic_polyketide_precursor_ion_dehydrated].nterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_dehydrated].cterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_dehydrated].name = "[M+zH]+ *"; + fragmentions[cyclic_polyketide_precursor_ion_dehydrated].massdifference = Hplus - H2O + adductshift; + fragmentions[cyclic_polyketide_precursor_ion_dehydrated].parent = cyclic_polyketide_precursor_ion; + + // initialize cyclic polyketide siderophore precursor ion - NH3 + fragmentions[cyclic_polyketide_precursor_ion_deamidated].nterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_deamidated].cterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_deamidated].name = "[M+zH]+ x"; + fragmentions[cyclic_polyketide_precursor_ion_deamidated].massdifference = Hplus - NH3 + adductshift; + fragmentions[cyclic_polyketide_precursor_ion_deamidated].parent = cyclic_polyketide_precursor_ion; + + // initialize cyclic polyketide siderophore precursor ion - H2O - NH3 + fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].nterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].cterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].name = "[M+zH]+ *x"; + fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].massdifference = Hplus - H2O - NH3 + adductshift; + fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].parent = cyclic_polyketide_precursor_ion; + + // initialize cyclic polyketide siderophore precursor ion - CO + fragmentions[cyclic_polyketide_precursor_ion_co_loss].nterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_co_loss].cterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_co_loss].name = "[M+zH]+ -CO"; + fragmentions[cyclic_polyketide_precursor_ion_co_loss].massdifference = Hplus - CO + adductshift; + fragmentions[cyclic_polyketide_precursor_ion_co_loss].parent = cyclic_polyketide_precursor_ion_co_loss; + + // initialize cyclic polyketide siderophore precursor ion - CO - H2O + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].nterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].cterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].name = "[M+zH]+ *-CO"; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].massdifference = Hplus - CO - H2O + adductshift; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].parent = cyclic_polyketide_precursor_ion_co_loss; + + // initialize cyclic polyketide siderophore precursor ion - CO - NH3 + fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].nterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].cterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].name = "[M+zH]+ x-CO"; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].massdifference = Hplus - CO - NH3 + adductshift; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].parent = cyclic_polyketide_precursor_ion_co_loss; + + // initialize cyclic polyketide siderophore precursor ion - CO - H2O - NH3 + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO"; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].massdifference = Hplus - CO - H2O - NH3 + adductshift; + fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].parent = cyclic_polyketide_precursor_ion_co_loss; +#endif // initialize B-2H ion //fragmentions[b_ion_2H_loss].nterminal = true; @@ -665,8 +1694,8 @@ void cFragmentIons::store(ofstream& os) { size = (int)fragmentions.size(); os.write((char *)&size, sizeof(int)); - for (map::iterator it = fragmentions.begin(); it != fragmentions.end(); ++it) { - os.write((char *)&it->first, sizeof(fragmentIonType)); + for (map::iterator it = fragmentions.begin(); it != fragmentions.end(); ++it) { + os.write((char *)&it->first, sizeof(eFragmentIonType)); it->second.store(os); } } @@ -674,45 +1703,70 @@ void cFragmentIons::store(ofstream& os) { void cFragmentIons::load(ifstream& is) { int size; - fragmentIonType iontype; + eFragmentIonType iontype; fragmentDescription description; is.read((char *)&size, sizeof(int)); fragmentions.clear(); for (int i = 0; i < size; i++) { - is.read((char *)&iontype, sizeof(fragmentIonType)); + is.read((char *)&iontype, sizeof(eFragmentIonType)); description.load(is); fragmentions[iontype] = description; } } -void initializeFragmentIonsForDeNovoGraphOfCyclicPeptides(vector& fragmentions) { +void initializeFragmentIonsForDeNovoGraphOfCyclicPeptides(vector& fragmentions) { fragmentions.push_back(b_ion); } -void initializeFragmentIonsForDeNovoGraphOfLinearPeptides(vector& fragmentions) { +void initializeFragmentIonsForDeNovoGraphOfLinearPeptides(vector& fragmentions) { fragmentions.push_back(y_ion); fragmentions.push_back(b_ion); fragmentions.push_back(precursor_ion); } -void initializeFragmentIonsForDeNovoGraphOfTPeptides(vector& fragmentions) { +void initializeFragmentIonsForDeNovoGraphOfTPeptides(vector& fragmentions) { fragmentions.push_back(y_ion); fragmentions.push_back(b_ion); fragmentions.push_back(precursor_ion); } -void initializeFragmentIonsForDeNovoGraphOfLassoPeptides(vector& fragmentions) { +void initializeFragmentIonsForDeNovoGraphOfBranchCyclicPeptides(vector& fragmentions) { fragmentions.push_back(b_ion); //fragmentions.push_back(y_ion); } -void initializeFragmentIonsForDeNovoGraphOfLinearPolysaccharide(vector& fragmentions) { +#if POLYKETIDE_SIDEROPHORES == 1 + + +void initializeFragmentIonsForDeNovoGraphOfLinearPolyketideSiderophore(vector& fragmentions) { + fragmentions.push_back(l1h_ion); + fragmentions.push_back(l2h_ion); + fragmentions.push_back(l1oh_ion); + fragmentions.push_back(l2oh_ion); + fragmentions.push_back(linear_polyketide_precursor_ion_h_h); + fragmentions.push_back(linear_polyketide_precursor_ion_h_oh); + fragmentions.push_back(linear_polyketide_precursor_ion_oh_oh); +} + + +void initializeFragmentIonsForDeNovoGraphOfCyclicPolyketideSiderophore(vector& fragmentions) { + fragmentions.push_back(l0h_ion); + fragmentions.push_back(l1h_ion); + fragmentions.push_back(l2h_ion); + fragmentions.push_back(cyclic_polyketide_precursor_ion); +} + + +#endif + + +void initializeFragmentIonsForDeNovoGraphOfLinearPolysaccharide(vector& fragmentions) { fragmentions.push_back(ms_nterminal_ion_hplus); //fragmentions.push_back(ms_cterminal_ion_hplus); fragmentions.push_back(precursor_ion); diff --git a/CycloBranch/core/cFragmentIons.h b/CycloBranch/core/cFragmentIons.h index 728e596..b3fb3e5 100644 --- a/CycloBranch/core/cFragmentIons.h +++ b/CycloBranch/core/cFragmentIons.h @@ -24,6 +24,7 @@ using namespace std; const double Hplus = 1.00727645; const double Naplus = 22.989222; const double Kplus = 38.963158; +const double Liplus = 7.015455; const double H = 1.0078250321; const double D = 2.014102; const double Li = 7.016004; @@ -127,9 +128,29 @@ const double Fm = 257.095093; const double Md = 258.098419; const double No = 259.101044; const double Lr = 262.109802; + const double R = 0; const double X = 0; const double e = H - Hplus; +//const double neutron = D - H; + +const double Li6 = 6.015122; +const double Mg25 = 24.985837; +const double Mg26 = 25.982593; +const double K41 = 40.961825; +const double Ca44 = 43.95548; +const double Fe54 = 53.939612; +//const double Fe57 = 56.935396; +//const double Fe58 = 57.933278; +const double Ni60 = 59.930788; +const double Ni61 = 60.931061; +const double Ni62 = 61.928346; +//const double Ni64 = 63.927968; +const double Cu65 = 64.927793; +const double Zn66 = 65.926034; +const double Zn67 = 66.927129; +const double Zn68 = 67.924846; +const double Ga71 = 70.9247; /** @@ -180,11 +201,27 @@ const double Z_ION = Hplus + O - N - H; const double PRECURSOR_ION = Hplus + H2O; const double PRECURSOR_ION_CYCLIC = Hplus; +#if POLYKETIDE_SIDEROPHORES == 1 + const double L0H_ION = Hplus - 2 * H; + const double L1H_ION = Hplus; + const double L2H_ION = Hplus + 2 * H; + const double R1H_ION = Hplus; + const double R2H_ION = Hplus + 2 * H; + const double L1OH_ION = Hplus + O; + const double L2OH_ION = Hplus + H2O; + const double R1OH_ION = Hplus + O; + const double R2OH_ION = Hplus + H2O; + + const double PRECURSOR_ION_LINEAR_POLYKETIDE_H_H = Hplus + 2 * H; + const double PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH = Hplus + H2O; + const double PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH = Hplus + 2 * H + 2 * O; +#endif + /** - \brief Register peptideType by Qt. + \brief Register ePeptideType by Qt. */ -Q_DECLARE_METATYPE(peptideType); +Q_DECLARE_METATYPE(ePeptideType); /** @@ -208,78 +245,212 @@ double uncharge(double mzratio, int charge); /** \brief The types of supported fragment ions. */ -enum fragmentIonType { +enum eFragmentIonType { a_ion = 1, - a_ion_dehydrated = 2, - a_ion_deamidated = 3, - a_ion_dehydrated_and_deamidated = 4, - b_ion = 5, - b_ion_dehydrated = 6, - b_ion_deamidated = 7, - b_ion_dehydrated_and_deamidated = 8, - c_ion = 9, - c_ion_dehydrated = 10, - c_ion_deamidated = 11, - c_ion_dehydrated_and_deamidated = 12, - x_ion = 13, - x_ion_dehydrated = 14, - x_ion_deamidated = 15, - x_ion_dehydrated_and_deamidated = 16, - y_ion = 17, - y_ion_dehydrated = 18, - y_ion_deamidated = 19, - y_ion_dehydrated_and_deamidated = 20, - z_ion = 21, - z_ion_dehydrated = 22, - z_ion_deamidated = 23, - z_ion_dehydrated_and_deamidated = 24, - precursor_ion = 25, - precursor_ion_dehydrated = 26, - precursor_ion_deamidated = 27, - precursor_ion_dehydrated_and_deamidated = 28, - precursor_ion_co_loss = 29, - precursor_ion_co_loss_and_dehydrated = 30, - precursor_ion_co_loss_and_deamidated = 31, - precursor_ion_co_loss_and_dehydrated_and_deamidated = 32, - cyclic_precursor_ion = 33, - cyclic_precursor_ion_dehydrated = 34, - cyclic_precursor_ion_deamidated = 35, - cyclic_precursor_ion_dehydrated_and_deamidated = 36, - cyclic_precursor_ion_co_loss = 37, - cyclic_precursor_ion_co_loss_and_dehydrated = 38, - cyclic_precursor_ion_co_loss_and_deamidated = 39, - cyclic_precursor_ion_co_loss_and_dehydrated_and_deamidated = 40, - ms_nterminal_ion_hplus = 41, - ms_nterminal_ion_naplus = 42, - ms_nterminal_ion_kplus = 43, - ms_cterminal_ion_hplus = 44, - ms_cterminal_ion_naplus = 45, - ms_cterminal_ion_kplus = 46, - ms_hplus = 47, - ms_naplus = 48, - ms_kplus = 49, - ms_hminus = 50, - ms_3M2Fe5H = 51, - ms_2MFe2H = 52, - ms_3MFe2H = 53, - ms_MFe2H = 54, - ms_3M2Fe6HNa = 55, - ms_2MFe3HNa = 56, - ms_3MFe3HNa = 57, - ms_MFe3HNa = 58, - ms_3M2Fe7H = 59, - ms_2MFe4H = 60, - ms_3MFe4H = 61, - ms_MFe4H = 62, - //b_ion_2H_loss = 63, + a_ion_dehydrated, + a_ion_deamidated, + a_ion_dehydrated_and_deamidated, + b_ion, + b_ion_dehydrated, + b_ion_deamidated, + b_ion_dehydrated_and_deamidated, + c_ion, + c_ion_dehydrated, + c_ion_deamidated, + c_ion_dehydrated_and_deamidated, + x_ion, + x_ion_dehydrated, + x_ion_deamidated, + x_ion_dehydrated_and_deamidated, + y_ion, + y_ion_dehydrated, + y_ion_deamidated, + y_ion_dehydrated_and_deamidated, + z_ion, + z_ion_dehydrated, + z_ion_deamidated, + z_ion_dehydrated_and_deamidated, + precursor_ion, + precursor_ion_dehydrated, + precursor_ion_deamidated, + precursor_ion_dehydrated_and_deamidated, + precursor_ion_co_loss, + precursor_ion_co_loss_and_dehydrated, + precursor_ion_co_loss_and_deamidated, + precursor_ion_co_loss_and_dehydrated_and_deamidated, + cyclic_precursor_ion, + cyclic_precursor_ion_dehydrated, + cyclic_precursor_ion_deamidated, + cyclic_precursor_ion_dehydrated_and_deamidated, + cyclic_precursor_ion_co_loss, + cyclic_precursor_ion_co_loss_and_dehydrated, + cyclic_precursor_ion_co_loss_and_deamidated, + cyclic_precursor_ion_co_loss_and_dehydrated_and_deamidated, + ms_nterminal_ion_hplus, + ms_nterminal_ion_naplus, + ms_nterminal_ion_kplus, + ms_cterminal_ion_hplus, + ms_cterminal_ion_naplus, + ms_cterminal_ion_kplus, + ms_hplus, + ms_naplus, + ms_kplus, + ms_hminus, + ms_MFe2H, + ms_MFe3HNa, + ms_2MFe2H, + ms_2MFe3HNa, + ms_3MFe2H, + ms_3MFe3HNa, + ms_3M2Fe5H, + ms_3M2Fe6HNa, + ms_MFe4H, + ms_2MFe4H, + ms_3MFe4H, + ms_3M2Fe7H, + ms_liplus, + ms_MMgH, + ms_MMg2HNa, + ms_MMg3H, + ms_MAl2H, + ms_MAl3HNa, + ms_MAl4H, + ms_MCaH, + ms_MCa2HNa, + ms_MCa3H, + ms_MMnH, + ms_MMn2HNa, + ms_MMn3H, + ms_MCoH, + ms_MCo2HNa, + ms_MCo3H, + ms_MNiH, + ms_MNi2HNa, + ms_MNi3H, + ms_MCuH, + ms_MCu2HNa, + ms_MCu3H, + ms_MZnH, + ms_MZn2HNa, + ms_MZn3H, + ms_MGa2H, + ms_MGa3HNa, + ms_MGa4H, +#if POLYKETIDE_SIDEROPHORES == 1 + l0h_ion, + l0h_ion_dehydrated, + l0h_ion_deamidated, + l0h_ion_dehydrated_and_deamidated, + l0h_ion_co_loss, + l0h_ion_co_loss_dehydrated, + l0h_ion_co_loss_deamidated, + l0h_ion_co_loss_dehydrated_and_deamidated, + l1h_ion, + l1h_ion_dehydrated, + l1h_ion_deamidated, + l1h_ion_dehydrated_and_deamidated, + l1h_ion_co_loss, + l1h_ion_co_loss_dehydrated, + l1h_ion_co_loss_deamidated, + l1h_ion_co_loss_dehydrated_and_deamidated, + l2h_ion, + l2h_ion_dehydrated, + l2h_ion_deamidated, + l2h_ion_dehydrated_and_deamidated, + l2h_ion_co_loss, + l2h_ion_co_loss_dehydrated, + l2h_ion_co_loss_deamidated, + l2h_ion_co_loss_dehydrated_and_deamidated, + r1h_ion, + r1h_ion_dehydrated, + r1h_ion_deamidated, + r1h_ion_dehydrated_and_deamidated, + r1h_ion_co_loss, + r1h_ion_co_loss_dehydrated, + r1h_ion_co_loss_deamidated, + r1h_ion_co_loss_dehydrated_and_deamidated, + r2h_ion, + r2h_ion_dehydrated, + r2h_ion_deamidated, + r2h_ion_dehydrated_and_deamidated, + r2h_ion_co_loss, + r2h_ion_co_loss_dehydrated, + r2h_ion_co_loss_deamidated, + r2h_ion_co_loss_dehydrated_and_deamidated, + l1oh_ion, + l1oh_ion_dehydrated, + l1oh_ion_deamidated, + l1oh_ion_dehydrated_and_deamidated, + l1oh_ion_co_loss, + l1oh_ion_co_loss_dehydrated, + l1oh_ion_co_loss_deamidated, + l1oh_ion_co_loss_dehydrated_and_deamidated, + l2oh_ion, + l2oh_ion_dehydrated, + l2oh_ion_deamidated, + l2oh_ion_dehydrated_and_deamidated, + l2oh_ion_co_loss, + l2oh_ion_co_loss_dehydrated, + l2oh_ion_co_loss_deamidated, + l2oh_ion_co_loss_dehydrated_and_deamidated, + r1oh_ion, + r1oh_ion_dehydrated, + r1oh_ion_deamidated, + r1oh_ion_dehydrated_and_deamidated, + r1oh_ion_co_loss, + r1oh_ion_co_loss_dehydrated, + r1oh_ion_co_loss_deamidated, + r1oh_ion_co_loss_dehydrated_and_deamidated, + r2oh_ion, + r2oh_ion_dehydrated, + r2oh_ion_deamidated, + r2oh_ion_dehydrated_and_deamidated, + r2oh_ion_co_loss, + r2oh_ion_co_loss_dehydrated, + r2oh_ion_co_loss_deamidated, + r2oh_ion_co_loss_dehydrated_and_deamidated, + linear_polyketide_precursor_ion_h_h, + linear_polyketide_precursor_ion_h_h_dehydrated, + linear_polyketide_precursor_ion_h_h_deamidated, + linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated, + linear_polyketide_precursor_ion_h_h_co_loss, + linear_polyketide_precursor_ion_h_h_co_loss_dehydrated, + linear_polyketide_precursor_ion_h_h_co_loss_deamidated, + linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated, + linear_polyketide_precursor_ion_h_oh, + linear_polyketide_precursor_ion_h_oh_dehydrated, + linear_polyketide_precursor_ion_h_oh_deamidated, + linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated, + linear_polyketide_precursor_ion_h_oh_co_loss, + linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated, + linear_polyketide_precursor_ion_h_oh_co_loss_deamidated, + linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated, + linear_polyketide_precursor_ion_oh_oh, + linear_polyketide_precursor_ion_oh_oh_dehydrated, + linear_polyketide_precursor_ion_oh_oh_deamidated, + linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated, + linear_polyketide_precursor_ion_oh_oh_co_loss, + linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated, + linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated, + linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated, + cyclic_polyketide_precursor_ion, + cyclic_polyketide_precursor_ion_dehydrated, + cyclic_polyketide_precursor_ion_deamidated, + cyclic_polyketide_precursor_ion_dehydrated_and_deamidated, + cyclic_polyketide_precursor_ion_co_loss, + cyclic_polyketide_precursor_ion_co_loss_dehydrated, + cyclic_polyketide_precursor_ion_co_loss_deamidated, + cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated, +#endif + //b_ion_2H_loss, fragmentIonTypeEnd }; /** - \brief Register vector by Qt. + \brief Register vector by Qt. */ -Q_DECLARE_METATYPE(vector); +Q_DECLARE_METATYPE(vector); /** @@ -320,7 +491,7 @@ struct fragmentDescription { /** \brief Parent fragment type. */ - fragmentIonType parent; + eFragmentIonType parent; /** @@ -335,6 +506,12 @@ struct fragmentDescription { int multiplier; + /** + \brief Number of implemented isotopes of a biometal ion. + */ + int numberofisotopes; + + /** \brief The default constructor. */ @@ -355,6 +532,7 @@ struct fragmentDescription { parent = fragmentIonTypeEnd; positive = true; multiplier = 1; + numberofisotopes = 0; } @@ -367,9 +545,10 @@ struct fragmentDescription { \param cterminal true when the fragment is C-terminal \param positive true when the fragment is charged positively; false when the fragment is charged negatively \param multiplier the multiplier (n) of M in [nM + H]+ + \param numberofisotopes the number of implemented isotopes of a biometal ion \param parent parent fragment type */ - fragmentDescription(string name, double massdifference, string summary, bool nterminal, bool cterminal, fragmentIonType parent = fragmentIonTypeEnd, bool positive = true, int multiplier = 1) { + fragmentDescription(string name, double massdifference, string summary, bool nterminal, bool cterminal, eFragmentIonType parent = fragmentIonTypeEnd, bool positive = true, int multiplier = 1, int numberofisotopes = 0) { this->name = name; this->massdifference = massdifference; this->summary = summary; @@ -378,6 +557,7 @@ struct fragmentDescription { this->parent = parent; this->positive = positive; this->multiplier = multiplier; + this->numberofisotopes = numberofisotopes; } @@ -408,7 +588,7 @@ Q_DECLARE_METATYPE(vector); */ class cFragmentIons { - map fragmentions; + map fragmentions; public: @@ -433,7 +613,7 @@ class cFragmentIons { \param iontype type of fragment ion \retval fragmentDescription reference to a structure with detailed information about the fragment ion */ - fragmentDescription &operator[](fragmentIonType iontype); + fragmentDescription &operator[](eFragmentIonType iontype); /** @@ -471,35 +651,55 @@ Q_DECLARE_METATYPE(cFragmentIons); \brief Initialize fragment ion types for the de novo graph of cyclic peptides. \param fragmentions reference to a vector of fragment ion types */ -void initializeFragmentIonsForDeNovoGraphOfCyclicPeptides(vector& fragmentions); +void initializeFragmentIonsForDeNovoGraphOfCyclicPeptides(vector& fragmentions); /** \brief Initialize fragment ion types for the de novo graph of linear peptides. \param fragmentions reference to a vector of fragment ion types */ -void initializeFragmentIonsForDeNovoGraphOfLinearPeptides(vector& fragmentions); +void initializeFragmentIonsForDeNovoGraphOfLinearPeptides(vector& fragmentions); /** \brief Initialize fragment ion types for the de novo graph of branched peptides. \param fragmentions reference to a vector of fragment ion types */ -void initializeFragmentIonsForDeNovoGraphOfTPeptides(vector& fragmentions); +void initializeFragmentIonsForDeNovoGraphOfTPeptides(vector& fragmentions); /** \brief Initialize fragment ion types for the de novo graph of branch-cyclic peptides. \param fragmentions reference to a vector of fragment ion types */ -void initializeFragmentIonsForDeNovoGraphOfLassoPeptides(vector& fragmentions); +void initializeFragmentIonsForDeNovoGraphOfBranchCyclicPeptides(vector& fragmentions); + + +#if POLYKETIDE_SIDEROPHORES == 1 + + +/** + \brief Initialize fragment ion types for the de novo graph of a linear polyketide siderophore + \param fragmentions reference to a vector of fragment ion types +*/ +void initializeFragmentIonsForDeNovoGraphOfLinearPolyketideSiderophore(vector& fragmentions); + + +/** + \brief Initialize fragment ion types for the de novo graph of a cyclic polyketide siderophore + \param fragmentions reference to a vector of fragment ion types +*/ +void initializeFragmentIonsForDeNovoGraphOfCyclicPolyketideSiderophore(vector& fragmentions); + + +#endif /** - \brief Initialize fragment ion types for the de novo graph of a custom linear type. + \brief Initialize fragment ion types for the de novo graph of a linear polysaccharide \param fragmentions reference to a vector of fragment ion types */ -void initializeFragmentIonsForDeNovoGraphOfLinearPolysaccharide(vector& fragmentions); +void initializeFragmentIonsForDeNovoGraphOfLinearPolysaccharide(vector& fragmentions); /** diff --git a/CycloBranch/core/cImzML.cpp b/CycloBranch/core/cImzML.cpp new file mode 100644 index 0000000..80476fe --- /dev/null +++ b/CycloBranch/core/cImzML.cpp @@ -0,0 +1,228 @@ +#include "core/cImzML.h" + + +cImzML::cImzML() { + XMLPlatformUtils::Initialize(); + parser = new XercesDOMParser(); +} + + +cImzML::~cImzML() { + delete parser; + XMLPlatformUtils::Terminate(); +} + + +void cImzML::parse(string filename) { + + parser->parse(filename.c_str()); + DOMDocument* document = parser->getDocument(); + + DOMElement* root = document->getDocumentElement(); + if (!root) { + return; + } + + + // childrens of mzML + for (XMLSize_t i = 0; i < root->getChildNodes()->getLength(); i++) { + + DOMNode* currentNode1 = root->getChildNodes()->item(i); + if (currentNode1->getNodeType() && currentNode1->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement1 = dynamic_cast(currentNode1); + if (XMLString::equals(currentElement1->getTagName(), XMLString::transcode("run"))) { + + + // childrens of run + for (XMLSize_t j = 0; j < currentNode1->getChildNodes()->getLength(); j++) { + + DOMNode* currentNode2 = currentNode1->getChildNodes()->item(j); + if (currentNode2->getNodeType() && currentNode2->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement2 = dynamic_cast(currentNode2); + if (XMLString::equals(currentElement2->getTagName(), XMLString::transcode("spectrumList"))) { + + + // childrens of spectrumList + for (XMLSize_t k = 0; k < currentNode2->getChildNodes()->getLength(); k++) { + + DOMNode* currentNode3 = currentNode2->getChildNodes()->item(k); + if (currentNode3->getNodeType() && currentNode3->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement3 = dynamic_cast(currentNode3); + if (XMLString::equals(currentElement3->getTagName(), XMLString::transcode("spectrum"))) { + + + cImzMLItem imzmlitem; + + + // childrens of spectrum + for (XMLSize_t l = 0; l < currentNode3->getChildNodes()->getLength(); l++) { + + DOMNode* currentNode4 = currentNode3->getChildNodes()->item(l); + if (currentNode4->getNodeType() && currentNode4->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement4 = dynamic_cast(currentNode4); + if (XMLString::equals(currentElement4->getTagName(), XMLString::transcode("scanList"))) { + + + // childrens of scanList + for (XMLSize_t m = 0; m < currentNode4->getChildNodes()->getLength(); m++) { + + DOMNode* currentNode5 = currentNode4->getChildNodes()->item(m); + if (currentNode5->getNodeType() && currentNode5->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement5 = dynamic_cast(currentNode5); + if (XMLString::equals(currentElement5->getTagName(), XMLString::transcode("scan"))) { + + + // childrens of scan + for (XMLSize_t n = 0; n < currentNode5->getChildNodes()->getLength(); n++) { + + DOMNode* currentNode6 = currentNode5->getChildNodes()->item(n); + if (currentNode6->getNodeType() && currentNode6->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement6 = dynamic_cast(currentNode6); + if (XMLString::equals(currentElement6->getTagName(), XMLString::transcode("cvParam"))) { + + + const XMLCh* xmlch_name = currentElement6->getAttribute(XMLString::transcode("name")); + string name = XMLString::transcode(xmlch_name); + + const XMLCh* xmlch_value = currentElement6->getAttribute(XMLString::transcode("value")); + if (name.compare("position x") == 0) { + imzmlitem.x = atoi(XMLString::transcode(xmlch_value)); + } + + if (name.compare("position y") == 0) { + imzmlitem.y = atoi(XMLString::transcode(xmlch_value)); + } + + + } + + } + + } + + + } + + } + + } + + + } + + if (XMLString::equals(currentElement4->getTagName(), XMLString::transcode("binaryDataArrayList"))) { + + + // childrens of binaryDataArrayList + for (XMLSize_t m = 0; m < currentNode4->getChildNodes()->getLength(); m++) { + + DOMNode* currentNode5 = currentNode4->getChildNodes()->item(m); + if (currentNode5->getNodeType() && currentNode5->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement5 = dynamic_cast(currentNode5); + if (XMLString::equals(currentElement5->getTagName(), XMLString::transcode("binaryDataArray"))) { + + + // childrens of binaryDataArray + bool mzarray = false; + unsigned long long offset = 0; + unsigned long long length = 0; + for (XMLSize_t n = 0; n < currentNode5->getChildNodes()->getLength(); n++) { + + DOMNode* currentNode6 = currentNode5->getChildNodes()->item(n); + if (currentNode6->getNodeType() && currentNode6->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement6 = dynamic_cast(currentNode6); + if (XMLString::equals(currentElement6->getTagName(), XMLString::transcode("cvParam"))) { + + + const XMLCh* xmlch_name = currentElement6->getAttribute(XMLString::transcode("name")); + string name = XMLString::transcode(xmlch_name); + + const XMLCh* xmlch_value = currentElement6->getAttribute(XMLString::transcode("value")); + if (name.compare("external offset") == 0) { + offset = stoull(XMLString::transcode(xmlch_value)); + } + + if (name.compare("external encoded length") == 0) { + length = stoull(XMLString::transcode(xmlch_value)); + } + + + } + + if (XMLString::equals(currentElement6->getTagName(), XMLString::transcode("referenceableParamGroupRef"))) { + + const XMLCh* xmlch_ref = currentElement6->getAttribute(XMLString::transcode("ref")); + string ref = XMLString::transcode(xmlch_ref); + + if (ref.compare("mzArray") == 0) { + mzarray = true; + } + + } + + } + + } + + if (mzarray) { + imzmlitem.mzstart = offset; + imzmlitem.mzlength = length; + } + else { + imzmlitem.intensitystart = offset; + imzmlitem.intensitylength = length; + } + + } + + } + + } + + + } + + } + + } + + + imzmlitems.push_back(imzmlitem); + + + } + + } + + } + + + } + + } + + } + + + } + + } + + } + + +} + + +vector& cImzML::getItems() { + return imzmlitems; +} + diff --git a/CycloBranch/core/cImzML.h b/CycloBranch/core/cImzML.h new file mode 100644 index 0000000..468d6df --- /dev/null +++ b/CycloBranch/core/cImzML.h @@ -0,0 +1,117 @@ +/** + \file cImzML.h + \brief imzML parser. +*/ + + +#ifndef _CIMZML_H +#define _CIMZML_H + + +#include +#include +#include +#include + +using namespace std; +using namespace xercesc; + + +/** + \brief A parsed imzML item. +*/ +struct cImzMLItem { + + /** + \brief Image - x coordinate. + */ + int x; + + + /** + \brief Image - y coordinate. + */ + int y; + + + /** + \brief Starting offset of m/z values array in ibd file (in bytes). + */ + long long unsigned mzstart; + + + /** + \brief Length of m/z values array in ibd file (in bytes). + */ + long long unsigned mzlength; + + + /** + \brief Starting offset of intensity values array in ibd file (in bytes). + */ + long long unsigned intensitystart; + + + /** + \brief Length of intensity values array in ibd file (in bytes). + */ + long long unsigned intensitylength; + + + /** + \brief The constructor. + */ + cImzMLItem() { + x = 0; + y = 0; + mzstart = 0; + mzlength = 0; + intensitystart = 0; + intensitylength = 0; + } + +}; + + + +/** + \brief imzML parser. +*/ +class cImzML { + + XercesDOMParser* parser; + vector imzmlitems; + +public: + + + /** + \brief The constructor. + */ + cImzML(); + + + /** + \brief The destructor. + */ + ~cImzML(); + + + /** + \brief Parse an imzml file. + \param filename imzml filename + */ + void parse(string filename); + + + /** + \brief Get a vector of cImzML items. + \retval vector a vector of cImzML items + */ + vector& getItems(); + +}; + + +#endif + diff --git a/CycloBranch/core/cParameters.cpp b/CycloBranch/core/cParameters.cpp index c0eb7db..e1aeac7 100644 --- a/CycloBranch/core/cParameters.cpp +++ b/CycloBranch/core/cParameters.cpp @@ -14,9 +14,23 @@ void cParameters::clear() { fragmentdefinitions.recalculateFragments(false, false, s); peptidetype = linear; peaklistfilename = ""; - peaklist.clear(); + peaklistfileformat = txt; + peaklistseries.clear(); precursormass = 0; precursoradduct = ""; + precursorAdductHasLi = false; + precursorAdductHasNa = false; + precursorAdductHasMg = false; + precursorAdductHasAl = false; + precursorAdductHasK = false; + precursorAdductHasCa = false; + precursorAdductHasMn = false; + precursorAdductHasFe = false; + precursorAdductHasCo = false; + precursorAdductHasNi = false; + precursorAdductHasCu = false; + precursorAdductHasZn = false; + precursorAdductHasGa = false; precursormasserrortolerance = 5; precursorcharge = 1; fragmentmasserrortolerance = 5; @@ -59,18 +73,20 @@ void cParameters::clear() { } -int cParameters::checkAndPrepare() { +int cParameters::checkAndPrepare(bool& terminatecomputation) { bool error = false; string errormessage = ""; ifstream peakliststream; + ifstream spotliststream; ifstream bricksdatabasestream; ifstream modificationsstream; ifstream sequencedatabasestream; regex rx; - ePeakListFileFormat peaklistfileformat; string s; int i; + string foldername; + string ibdfilename; if (peaklistfilename.empty()) { error = true; @@ -108,8 +124,20 @@ int cParameters::checkAndPrepare() { if (regex_search(peaklistfilename, rx)) { peaklistfileformat = baf; } + + rx = "\\.[mM][iI][sS]$"; + // flexImaging File + if (regex_search(peaklistfilename, rx)) { + peaklistfileformat = mis; + } #endif + rx = "\\.[iI][mM][zZ][mM][lL]$"; + // flexImaging File + if (regex_search(peaklistfilename, rx)) { + peaklistfileformat = imzML; + } + } catch (regex_error& e) { error = true; @@ -192,6 +220,33 @@ int cParameters::checkAndPrepare() { } #endif break; + case mis: + #if OS_TYPE == WIN + foldername = peaklistfilename.substr(0, peaklistfilename.rfind('.')); + *os << "Converting flexImaging data folder " + foldername + " ... "; + s = "External\\windows\\mis2csv.bat \"" + foldername + "\""; + if (system(s.c_str()) != 0) { + error = true; + errormessage = "The folder cannot be converted.\n"; + errormessage += "Does the folder '" + foldername + "' exist ?\n"; + errormessage += "Do you have Bruker Daltonik's CompassXport installed ?\n"; + errormessage += "Do you have path to the CompassXport.exe in your PATH variable ?\n"; + errormessage += "Is the directory with the file '" + peaklistfilename + "' writable ?\n"; + errormessage += "Do you have 'mis2csv.bat' file located in the 'External/windows' folder ?\n"; + } + + if (!error) { + *os << "ok" << endl << endl; + peakliststream.open(foldername + ".baf.csv"); + spotliststream.open(foldername + ".baf.txt"); + } + #endif + break; + case imzML: + ibdfilename = peaklistfilename.substr(0, (int)peaklistfilename.size() - 5); + ibdfilename += "ibd"; + peakliststream.open(ibdfilename, std::ifstream::binary); + break; default: break; } @@ -202,7 +257,12 @@ int cParameters::checkAndPrepare() { if (!error) { if (!peakliststream.good()) { error = true; - errormessage = "Cannot open the file '" + peaklistfilename + "'."; + if (peaklistfileformat == mis) { + errormessage = "Cannot open the folder '" + foldername + "'."; + } + else { + errormessage = "Cannot open the file '" + peaklistfilename + "'."; + } } else { if (os) { @@ -210,18 +270,31 @@ int cParameters::checkAndPrepare() { } switch (peaklistfileformat) { case txt: - peaklist.loadFromPlainTextStream(peakliststream); + peaklistseries.loadFromPlainTextStream(peakliststream); break; case mzML: case mzXML: case mgf: - peaklist.loadFromMGFStream(peakliststream); + peaklistseries.loadFromMGFStream(peakliststream); break; case baf: #if OS_TYPE == WIN - peaklist.loadFromBAFStream(peakliststream); + peaklistseries.loadFromBAFStream(peakliststream); #endif break; + case mis: + #if OS_TYPE == WIN + peaklistseries.loadFromBAFStream(peakliststream); + peaklistseries.loadSpotList(spotliststream); + spotliststream.close(); + #endif + break; + case imzML: + if (peaklistseries.loadFromIMZMLStream(peaklistfilename, peakliststream, minimumrelativeintensitythreshold, os, terminatecomputation) == -1) { + error = true; + errormessage = "Aborted by user."; + } + break; default: break; } @@ -330,6 +403,73 @@ int cParameters::checkAndPrepare() { error = true; errormessage = "Precursor Ion Adduct: " + errormessage; } + + precursorAdductHasLi = false; + precursorAdductHasNa = false; + precursorAdductHasMg = false; + precursorAdductHasAl = false; + precursorAdductHasK = false; + precursorAdductHasCa = false; + precursorAdductHasMn = false; + precursorAdductHasFe = false; + precursorAdductHasCo = false; + precursorAdductHasNi = false; + precursorAdductHasCu = false; + precursorAdductHasZn = false; + precursorAdductHasGa = false; + + rx = "Li"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasLi = true; + } + rx = "Na"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasNa = true; + } + rx = "Mg"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasMg = true; + } + rx = "Al"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasAl = true; + } + rx = "K"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasK = true; + } + rx = "Ca"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasCa = true; + } + rx = "Mn"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasMn = true; + } + rx = "Fe"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasFe = true; + } + rx = "Co"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasCo = true; + } + rx = "Ni"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasNi = true; + } + rx = "Cu"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasCu = true; + } + rx = "Zn"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasZn = true; + } + rx = "Ga"; + if (regex_search(precursoradduct, rx)) { + precursorAdductHasGa = true; + } } @@ -369,9 +509,17 @@ int cParameters::checkAndPrepare() { case branched: initializeFragmentIonsForDeNovoGraphOfTPeptides(fragmentionsfordenovograph); break; - case lasso: - initializeFragmentIonsForDeNovoGraphOfLassoPeptides(fragmentionsfordenovograph); + case branchcyclic: + initializeFragmentIonsForDeNovoGraphOfBranchCyclicPeptides(fragmentionsfordenovograph); + break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + initializeFragmentIonsForDeNovoGraphOfLinearPolyketideSiderophore(fragmentionsfordenovograph); + break; + case cyclicpolyketide: + initializeFragmentIonsForDeNovoGraphOfCyclicPolyketideSiderophore(fragmentionsfordenovograph); break; +#endif case linearpolysaccharide: initializeFragmentIonsForDeNovoGraphOfLinearPolysaccharide(fragmentionsfordenovograph); break; @@ -430,9 +578,17 @@ string cParameters::printToString() { case branched: s += "Branched\n"; break; - case lasso: + case branchcyclic: s += "Branch-cyclic\n"; break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + s += "Linear oligoketide siderophore\n"; + break; + case cyclicpolyketide: + s += "Cyclic oligoketide siderophore\n"; + break; +#endif case linearpolysaccharide: s += "Linear polysaccharide (beta version)\n"; break; @@ -494,7 +650,7 @@ string cParameters::printToString() { s += "\n"; s += "Mode: "; - switch ((modeType)mode) { + switch ((eModeType)mode) { case denovoengine: s += "De Novo Search Engine"; break; @@ -551,7 +707,7 @@ string cParameters::printToString() { s += "Maximum Number of Candidate Peptides Reported: " + to_string(hitsreported) + "\n"; s += "Peptide Sequence Tag: " + originalsequencetag + "\n"; - s += "Fragment Ion Types in Theoretical Spectra: "; + s += "Ion Types in Theoretical Spectra: "; for (int i = 0; i < (int)fragmentionsfortheoreticalspectra.size(); i++) { s += fragmentdefinitions[fragmentionsfortheoreticalspectra[i]].name; if (i < (int)fragmentionsfortheoreticalspectra.size() - 1) { @@ -595,14 +751,28 @@ void cParameters::store(ofstream& os) { fragmentdefinitions.store(os); - os.write((char *)&peptidetype, sizeof(peptideType)); + os.write((char *)&peptidetype, sizeof(ePeptideType)); storeString(peaklistfilename, os); - peaklist.store(os); + os.write((char *)&peaklistfileformat, sizeof(ePeakListFileFormat)); + peaklistseries.store(os); os.write((char *)&precursormass, sizeof(double)); storeString(precursoradduct, os); + os.write((char *)&precursorAdductHasLi, sizeof(bool)); + os.write((char *)&precursorAdductHasNa, sizeof(bool)); + os.write((char *)&precursorAdductHasMg, sizeof(bool)); + os.write((char *)&precursorAdductHasAl, sizeof(bool)); + os.write((char *)&precursorAdductHasK, sizeof(bool)); + os.write((char *)&precursorAdductHasCa, sizeof(bool)); + os.write((char *)&precursorAdductHasMn, sizeof(bool)); + os.write((char *)&precursorAdductHasFe, sizeof(bool)); + os.write((char *)&precursorAdductHasCo, sizeof(bool)); + os.write((char *)&precursorAdductHasNi, sizeof(bool)); + os.write((char *)&precursorAdductHasCu, sizeof(bool)); + os.write((char *)&precursorAdductHasZn, sizeof(bool)); + os.write((char *)&precursorAdductHasGa, sizeof(bool)); os.write((char *)&precursormasserrortolerance, sizeof(double)); os.write((char *)&precursorcharge, sizeof(int)); @@ -629,8 +799,8 @@ void cParameters::store(ofstream& os) { } os.write((char *)&maximumnumberofthreads, sizeof(int)); - os.write((char *)&mode, sizeof(modeType)); - os.write((char *)&scoretype, sizeof(scoreType)); + os.write((char *)&mode, sizeof(eModeType)); + os.write((char *)&scoretype, sizeof(eScoreType)); os.write((char *)&clearhitswithoutparent, sizeof(bool)); os.write((char *)&cyclicnterminus, sizeof(bool)); os.write((char *)&cycliccterminus, sizeof(bool)); @@ -655,13 +825,13 @@ void cParameters::store(ofstream& os) { size = (int)fragmentionsfordenovograph.size(); os.write((char *)&size, sizeof(int)); for (int i = 0; i < (int)fragmentionsfordenovograph.size(); i++) { - os.write((char *)&fragmentionsfordenovograph[i], sizeof(fragmentIonType)); + os.write((char *)&fragmentionsfordenovograph[i], sizeof(eFragmentIonType)); } size = (int)fragmentionsfortheoreticalspectra.size(); os.write((char *)&size, sizeof(int)); for (int i = 0; i < (int)fragmentionsfortheoreticalspectra.size(); i++) { - os.write((char *)&fragmentionsfortheoreticalspectra[i], sizeof(fragmentIonType)); + os.write((char *)&fragmentionsfortheoreticalspectra[i], sizeof(eFragmentIonType)); } } @@ -673,14 +843,28 @@ void cParameters::load(ifstream& is) { fragmentdefinitions.load(is); - is.read((char *)&peptidetype, sizeof(peptideType)); + is.read((char *)&peptidetype, sizeof(ePeptideType)); loadString(peaklistfilename, is); - peaklist.load(is); + is.read((char *)&peaklistfileformat, sizeof(ePeakListFileFormat)); + peaklistseries.load(is); is.read((char *)&precursormass, sizeof(double)); loadString(precursoradduct, is); + is.read((char *)&precursorAdductHasLi, sizeof(bool)); + is.read((char *)&precursorAdductHasNa, sizeof(bool)); + is.read((char *)&precursorAdductHasMg, sizeof(bool)); + is.read((char *)&precursorAdductHasAl, sizeof(bool)); + is.read((char *)&precursorAdductHasK, sizeof(bool)); + is.read((char *)&precursorAdductHasCa, sizeof(bool)); + is.read((char *)&precursorAdductHasMn, sizeof(bool)); + is.read((char *)&precursorAdductHasFe, sizeof(bool)); + is.read((char *)&precursorAdductHasCo, sizeof(bool)); + is.read((char *)&precursorAdductHasNi, sizeof(bool)); + is.read((char *)&precursorAdductHasCu, sizeof(bool)); + is.read((char *)&precursorAdductHasZn, sizeof(bool)); + is.read((char *)&precursorAdductHasGa, sizeof(bool)); is.read((char *)&precursormasserrortolerance, sizeof(double)); is.read((char *)&precursorcharge, sizeof(int)); @@ -707,8 +891,8 @@ void cParameters::load(ifstream& is) { } is.read((char *)&maximumnumberofthreads, sizeof(int)); - is.read((char *)&mode, sizeof(modeType)); - is.read((char *)&scoretype, sizeof(scoreType)); + is.read((char *)&mode, sizeof(eModeType)); + is.read((char *)&scoretype, sizeof(eScoreType)); is.read((char *)&clearhitswithoutparent, sizeof(bool)); is.read((char *)&cyclicnterminus, sizeof(bool)); is.read((char *)&cycliccterminus, sizeof(bool)); @@ -733,13 +917,13 @@ void cParameters::load(ifstream& is) { is.read((char *)&size, sizeof(int)); fragmentionsfordenovograph.resize(size); for (int i = 0; i < (int)fragmentionsfordenovograph.size(); i++) { - is.read((char *)&fragmentionsfordenovograph[i], sizeof(fragmentIonType)); + is.read((char *)&fragmentionsfordenovograph[i], sizeof(eFragmentIonType)); } is.read((char *)&size, sizeof(int)); fragmentionsfortheoreticalspectra.resize(size); for (int i = 0; i < (int)fragmentionsfortheoreticalspectra.size(); i++) { - is.read((char *)&fragmentionsfortheoreticalspectra[i], sizeof(fragmentIonType)); + is.read((char *)&fragmentionsfortheoreticalspectra[i], sizeof(eFragmentIonType)); } } diff --git a/CycloBranch/core/cParameters.h b/CycloBranch/core/cParameters.h index 9bafc84..242b149 100644 --- a/CycloBranch/core/cParameters.h +++ b/CycloBranch/core/cParameters.h @@ -10,12 +10,14 @@ #include #include #include "core/utilities.h" -#include "core/cPeaksList.h" +#include "core/cPeakListSeries.h" #include "core/cBricksDatabase.h" #include "core/cSequenceDatabase.h" + class cMainThread; + using namespace std; using namespace boost; @@ -23,7 +25,7 @@ using namespace boost; /** \brief Running modes of the application. */ -enum modeType { +enum eModeType { denovoengine = 0, singlecomparison = 1, databasesearch = 2, @@ -39,7 +41,9 @@ enum ePeakListFileFormat { mgf = 1, mzML = 2, mzXML = 3, - baf = 4 + baf = 4, + mis = 5, + imzML = 6 }; @@ -62,7 +66,7 @@ class cParameters { /** \brief The type of analyzed peptide. */ - peptideType peptidetype; + ePeptideType peptidetype; /** @@ -72,9 +76,15 @@ class cParameters { /** - \brief A structure representing a peak list. + \brief A file format of peak list. + */ + ePeakListFileFormat peaklistfileformat; + + + /** + \brief A structure representing a series of peaklists. */ - cPeaksList peaklist; + cPeakListSeries peaklistseries; /** @@ -89,6 +99,84 @@ class cParameters { string precursoradduct; + /** + \brief True when the precursor adduct contains Li. + */ + bool precursorAdductHasLi; + + + /** + \brief True when the precursor adduct contains Na. + */ + bool precursorAdductHasNa; + + + /** + \brief True when the precursor adduct contains Mg. + */ + bool precursorAdductHasMg; + + + /** + \brief True when the precursor adduct contains Al. + */ + bool precursorAdductHasAl; + + + /** + \brief True when the precursor adduct contains K. + */ + bool precursorAdductHasK; + + + /** + \brief True when the precursor adduct contains Ca. + */ + bool precursorAdductHasCa; + + + /** + \brief True when the precursor adduct contains Mn. + */ + bool precursorAdductHasMn; + + + /** + \brief True when the precursor adduct contains Fe. + */ + bool precursorAdductHasFe; + + + /** + \brief True when the precursor adduct contains Co. + */ + bool precursorAdductHasCo; + + + /** + \brief True when the precursor adduct contains Ni. + */ + bool precursorAdductHasNi; + + + /** + \brief True when the precursor adduct contains Cu. + */ + bool precursorAdductHasCu; + + + /** + \brief True when the precursor adduct contains Zn. + */ + bool precursorAdductHasZn; + + + /** + \brief True when the precursor adduct contains Ga. + */ + bool precursorAdductHasGa; + + /** \brief Precursor mass error tolerance (ppm). */ @@ -188,13 +276,13 @@ class cParameters { /** \brief Program mode. */ - modeType mode; + eModeType mode; /** \brief A type of score. */ - scoreType scoretype; + eScoreType scoretype; /** @@ -308,13 +396,13 @@ class cParameters { /** \brief A vector of fragment ion types generated in the de novo graph. */ - vector fragmentionsfordenovograph; + vector fragmentionsfordenovograph; /** \brief A vector of fragment ion types generated in theoretical spectra. */ - vector fragmentionsfortheoreticalspectra; + vector fragmentionsfortheoreticalspectra; /** @@ -331,9 +419,10 @@ class cParameters { /** \brief Test restrictions of parameters and prepare some internal parameters. + \param terminatecomputation reference to a variable determining that the computation must be stopped \retval int -1 when an error occurred, 0 otherwise */ - int checkAndPrepare(); + int checkAndPrepare(bool& terminatecomputation); /** diff --git a/CycloBranch/core/cPeak.cpp b/CycloBranch/core/cPeak.cpp index 605ced6..2cb4dd1 100644 --- a/CycloBranch/core/cPeak.cpp +++ b/CycloBranch/core/cPeak.cpp @@ -10,7 +10,9 @@ void cPeak::clear() { mzratio = 0; intensity = 0; description = ""; - matchdescription = ""; + matchedmz = 0; + matchedintensity = 0; + matchedppm = 0; iontype = fragmentIonTypeEnd; matched = 0; matchedid = -1; @@ -34,8 +36,10 @@ void cPeak::store(ofstream& os) { os.write((char *)&mzratio, sizeof(double)); os.write((char *)&intensity, sizeof(double)); storeString(description, os); - storeString(matchdescription, os); - os.write((char *)&iontype, sizeof(fragmentIonType)); + os.write((char *)&matchedmz, sizeof(double)); + os.write((char *)&matchedintensity, sizeof(double)); + os.write((char *)&matchedppm, sizeof(double)); + os.write((char *)&iontype, sizeof(eFragmentIonType)); os.write((char *)&matched, sizeof(int)); os.write((char *)&matchedid, sizeof(int)); os.write((char *)&charge, sizeof(int)); @@ -51,8 +55,10 @@ void cPeak::load(ifstream& is) { is.read((char *)&mzratio, sizeof(double)); is.read((char *)&intensity, sizeof(double)); loadString(description, is); - loadString(matchdescription, is); - is.read((char *)&iontype, sizeof(fragmentIonType)); + is.read((char *)&matchedmz, sizeof(double)); + is.read((char *)&matchedintensity, sizeof(double)); + is.read((char *)&matchedppm, sizeof(double)); + is.read((char *)&iontype, sizeof(eFragmentIonType)); is.read((char *)&matched, sizeof(int)); is.read((char *)&matchedid, sizeof(int)); is.read((char *)&charge, sizeof(int)); diff --git a/CycloBranch/core/cPeak.h b/CycloBranch/core/cPeak.h index cf38944..e4226b4 100644 --- a/CycloBranch/core/cPeak.h +++ b/CycloBranch/core/cPeak.h @@ -18,7 +18,7 @@ using namespace std; /** \brief The types of scores between an experimental and a theoretical spectrum. */ -enum scoreType { +enum eScoreType { b_ions = 0, b_ions_and_b_dehydrated_ions = 1, b_ions_and_b_deamidated_ions = 2, @@ -54,15 +54,27 @@ struct cPeak { /** - \brief An extended description when the peak is matched. + \brief A m/z ratio when the peak was matched with an experimental peak. */ - string matchdescription; + double matchedmz; + + + /** + \brief An intensity when the peak was matched with an experimental peak. + */ + double matchedintensity; + + + /** + \brief An error in ppm when the peak was matched with an experimental peak. + */ + double matchedppm; /** \brief The type of a fragment ion corresponding to the peak. */ - fragmentIonType iontype; + eFragmentIonType iontype; /** diff --git a/CycloBranch/core/cPeakListSeries.cpp b/CycloBranch/core/cPeakListSeries.cpp new file mode 100644 index 0000000..fb2ee2e --- /dev/null +++ b/CycloBranch/core/cPeakListSeries.cpp @@ -0,0 +1,171 @@ +#include "core/cPeakListSeries.h" + +#include "gui/cMainThread.h" + + +cPeakListSeries::cPeakListSeries() { + clear(); +} + + +cPeakListSeries::cPeakListSeries(const cPeakListSeries& peaklistseries) { + *this = peaklistseries; +} + + +cPeakListSeries& cPeakListSeries::operator=(const cPeakListSeries& peaklistseries) { + peaklists = peaklistseries.peaklists; + return *this; +} + + +cPeaksList& cPeakListSeries::operator[](int position) { + return peaklists[position]; +} + + +void cPeakListSeries::clear() { + peaklists.clear(); +} + + +void cPeakListSeries::addPeakList(cPeaksList& peaklist) { + peaklists.push_back(peaklist); +} + + +void cPeakListSeries::loadFromPlainTextStream(ifstream &stream) { + while (stream.good()) { + cPeaksList peaklist; + peaklist.loadFromPlainTextStream(stream); + + if (peaklist.size() > 0) { + peaklists.push_back(peaklist); + } + } +} + + +void cPeakListSeries::loadFromBAFStream(ifstream &stream) { + string s; + while (stream.good() && !(strstr(s.c_str(),"M/Z"))) { + getline(stream,s); + } + + while (stream.good()) { + cPeaksList peaklist; + peaklist.loadFromBAFStream(stream); + + if (peaklist.size() > 0) { + peaklists.push_back(peaklist); + } + } +} + + +int cPeakListSeries::loadFromIMZMLStream(string& imzmlfilename, ifstream &ibdstream, double minimumrelativeintensitythreshold, cMainThread* os, bool& terminatecomputation) { + *os << "Parsing the imzML file ..." << endl; + + cImzML imzml; + imzml.parse(imzmlfilename); + + *os << "Loading the peaklist no. : " << endl; + + for (int i = 0; i < (int)imzml.getItems().size(); i++) { + *os << i + 1 << " "; + if ((i + 1) % 25 == 0) { + *os << endl; + } + + cPeaksList peaklist; + peaklist.loadFromIBDStream(imzml.getItems()[i], ibdstream); + if (peaklist.size() > 0) { + peaklist.normalizeIntenzity(); // to do - redundant operation + peaklist.cropIntenzity(minimumrelativeintensitythreshold); // to do - redundant operation + peaklists.push_back(peaklist); + } + + if (terminatecomputation) { + peaklists.clear(); + return -1; + } + } + + *os << " ok" << endl; + + return 0; +} + + +void cPeakListSeries::loadSpotList(ifstream &stream) { + string s; + vector spots; + while (stream.good()) { + getline(stream,s); + if (!s.empty()) { + spots.push_back(s); + } + } + + if (peaklists.size() != spots.size()) { + return; + } + + size_t px, py; + int x, y; + for (int i = 0; i < (int)peaklists.size(); i++) { + px = spots[i].find('X'); + py = spots[i].find('Y'); + + if ((px == string::npos) || (py == string::npos)) { + return; + } + + x = stoi(spots[i].substr(0, py).substr(px + 1)); + y = stoi(spots[i].substr(py + 1)); + + peaklists[i].setCoordinates(x, y); + } +} + + +void cPeakListSeries::loadFromMGFStream(ifstream &stream) { + while (stream.good()) { + cPeaksList peaklist; + peaklist.loadFromMGFStream(stream); + + if (peaklist.size() > 0) { + peaklists.push_back(peaklist); + } + } +} + + +int cPeakListSeries::size() { + return (int)peaklists.size(); +} + + +void cPeakListSeries::store(ofstream& os) { + int size; + + size = (int)peaklists.size(); + os.write((char *)&size, sizeof(int)); + + for (int i = 0; i < size; i++) { + peaklists[i].store(os); + } +} + + +void cPeakListSeries::load(ifstream& is) { + int size; + + is.read((char *)&size, sizeof(int)); + peaklists.resize(size); + + for (int i = 0; i < size; i++) { + peaklists[i].load(is); + } +} + diff --git a/CycloBranch/core/cPeakListSeries.h b/CycloBranch/core/cPeakListSeries.h new file mode 100644 index 0000000..f44c10b --- /dev/null +++ b/CycloBranch/core/cPeakListSeries.h @@ -0,0 +1,130 @@ +/** + \file cPeakListSeries.h + \brief The representation of a series of peaklists. +*/ + + +#ifndef _CPEAKLISTSERIES_H +#define _CPEAKLISTSERIES_H + +#include "core/cPeaksList.h" + + +class cMainThread; + + +/** + \brief The class representing a series of peaklists. +*/ +class cPeakListSeries { + + vector peaklists; + +public: + + + /** + \brief The constructor. + */ + cPeakListSeries(); + + + /** + \brief The copy constructor. + \param peaklistseries reference to a cPeakListSeries + */ + cPeakListSeries(const cPeakListSeries& peaklistseries); + + + /** + \brief Overloaded operator=. + \param peaklistseries reference to a cPeakListSeries + */ + cPeakListSeries& operator=(const cPeakListSeries& peaklistseries); + + + /** + \brief Overloaded operator []. + \param position position of a peaklist + \retval cPeaksList reference to a peaklist + */ + cPeaksList& operator[](int position); + + + /** + \brief Clear the peaklist series. + */ + void clear(); + + + /** + \brief Add a peaklist. + \param peaklist peaklist which will be added + */ + void addPeakList(cPeaksList& peaklist); + + + /** + \brief Load the series of peaklists from a plain text stream. + \param stream source stream + */ + void loadFromPlainTextStream(ifstream &stream); + + + /** + \brief Load the series of peaklists from a .csv file converted from a .baf file by CompassXport. + \param stream source stream + */ + void loadFromBAFStream(ifstream &stream); + + + /** + \brief Load the series of peaklists from .imzML file. + \param imzmlfilename imzML filename + \param ibdstream ibd binary file stream + \param minimumrelativeintensitythreshold a minimum threshold of relative intensity + \param os pointer to the main thread of the application (output stream) + \param terminatecomputation reference to a variable determining that the computation must be stopped + \retval int 0 = success; -1 = error + */ + int loadFromIMZMLStream(string& imzmlfilename, ifstream &ibdstream, double minimumrelativeintensitythreshold, cMainThread* os, bool& terminatecomputation); + + + /** + \brief Load a spot list from a stream. + \param stream source stream + */ + void loadSpotList(ifstream &stream); + + + /** + \brief Load the series of peaklists from a .mgf file. + \param stream source stream + */ + void loadFromMGFStream(ifstream &stream); + + + /** + \brief The number of peaklists in the series. + \retval int number of peaklists in the series + */ + int size(); + + + /** + \brief Store the structure into an output stream. + \param os an output stream + */ + void store(ofstream& os); + + + /** + \brief Load the structure from an input stream. + \param is an input stream + */ + void load(ifstream& is); + +}; + + +#endif diff --git a/CycloBranch/core/cPeaksList.cpp b/CycloBranch/core/cPeaksList.cpp index bef1b46..aef3fe3 100644 --- a/CycloBranch/core/cPeaksList.cpp +++ b/CycloBranch/core/cPeaksList.cpp @@ -40,12 +40,16 @@ cPeaksList::cPeaksList(const cPeaksList& peakslist) { cPeaksList& cPeaksList::operator=(const cPeaksList& peakslist) { peaks = peakslist.peaks; + x = peakslist.x; + y = peakslist.y; return *this; } void cPeaksList::clear() { peaks.clear(); + x = 0; + y = 0; } @@ -85,6 +89,9 @@ void cPeaksList::loadFromPlainTextStream(ifstream &stream) { if (!p.empty()) { peaks.push_back(p); } + else { + break; + } } } @@ -94,19 +101,16 @@ void cPeaksList::loadFromBAFStream(ifstream &stream) { cPeak p; size_t pos; - getline(stream,s); - - while (stream.good()) { - getline(stream,s); + while (stream.good() && !(strstr(s.c_str(),"M/Z"))) { // replaces commas with dots - pos = s.find(','); - while (pos != string::npos) { - s.replace(pos, 1, "."); - pos = s.find(','); - } + //pos = s.find(','); + //while (pos != string::npos) { + // s.replace(pos, 1, "."); + // pos = s.find(','); + //} - pos = s.find(':'); + pos = s.find(','); if (pos != string::npos) { s.replace(pos, 1, "\t"); } @@ -117,10 +121,48 @@ void cPeaksList::loadFromBAFStream(ifstream &stream) { if (!p.empty()) { peaks.push_back(p); } + + getline(stream,s); } } +void cPeaksList::loadFromIBDStream(cImzMLItem& imzmlitem, ifstream &ibdstream) { + unsigned long long start; + unsigned long long end; + double value; + + peaks.resize(imzmlitem.mzlength/8); + + start = imzmlitem.mzstart; + end = imzmlitem.mzstart + imzmlitem.mzlength; + ibdstream.seekg(start, ibdstream.beg); + for (int i = 0; i < (int)imzmlitem.mzlength/8; i++) { + if (ibdstream.good()) { + ibdstream.read((char*)&value, 8); + peaks[i].mzratio = value; + } + } + + if (imzmlitem.mzlength != imzmlitem.intensitylength) { + return; + } + + start = imzmlitem.intensitystart; + end = imzmlitem.intensitystart + imzmlitem.intensitylength; + ibdstream.seekg(start, ibdstream.beg); + for (int i = 0; i < (int)imzmlitem.intensitylength/8; i++) { + if (ibdstream.good()) { + ibdstream.read((char*)&value, 8); + peaks[i].intensity = value; + } + } + + x = imzmlitem.x; + y = imzmlitem.y; +} + + void cPeaksList::loadFromMGFStream(ifstream &stream) { string s; cPeak p; @@ -147,7 +189,7 @@ void cPeaksList::loadFromMGFStream(ifstream &stream) { } } - while ((stream.good()) && !(strstr(s.c_str(),"END IONS"))) { + while (stream.good() && !(strstr(s.c_str(),"END IONS"))) { // replaces commas with dots pos = s.find(','); @@ -189,10 +231,6 @@ string cPeaksList::print(bool htmlterminatelines) { s += to_string(peaks[i].intensity); } - if (peaks[i].matchdescription.compare("") != 0) { - s += peaks[i].matchdescription + " "; - } - if (htmlterminatelines) { s += "
"; } @@ -243,15 +281,15 @@ int cPeaksList::normalizeIntenzity() { void cPeaksList::cropIntenzity(double minimumrelativeintensitythreshold) { - int i = 0; - while (i < (int)peaks.size()) { - if (peaks[i].intensity < minimumrelativeintensitythreshold) { - peaks.erase(peaks.begin()+i); - } - else { - i++; - } + sortbyIntensityDesc(); + + int i = (int)peaks.size() - 1; + while ((i > 0) && (peaks[i].intensity < minimumrelativeintensitythreshold)) { + i--; } + peaks.resize(i + 1); + + sortbyMass(); } @@ -535,6 +573,22 @@ double cPeaksList::getMaximumIntensityFromMZInterval(double minmz, double maxmz) } +void cPeaksList::setCoordinates(int x, int y) { + this->x = x; + this->y = y; +} + + +int cPeaksList::getCoordinateX() { + return x; +} + + +int cPeaksList::getCoordinateY() { + return y; +} + + void cPeaksList::store(ofstream& os) { int size; @@ -544,6 +598,9 @@ void cPeaksList::store(ofstream& os) { for (int i = 0; i < (int)peaks.size(); i++) { peaks[i].store(os); } + + os.write((char *)&x, sizeof(int)); + os.write((char *)&y, sizeof(int)); } @@ -556,5 +613,8 @@ void cPeaksList::load(ifstream& is) { for (int i = 0; i < (int)peaks.size(); i++) { peaks[i].load(is); } + + is.read((char *)&x, sizeof(int)); + is.read((char *)&y, sizeof(int)); } diff --git a/CycloBranch/core/cPeaksList.h b/CycloBranch/core/cPeaksList.h index 2fbb41e..2c5d11a 100644 --- a/CycloBranch/core/cPeaksList.h +++ b/CycloBranch/core/cPeaksList.h @@ -15,6 +15,9 @@ #include "core/cPeak.h" +#include "core/cImzML.h" + + using namespace std; @@ -73,6 +76,7 @@ double ppmError(double experimentalmass, double theoreticalmass); class cPeaksList { vector peaks; + int x, y; public: @@ -131,6 +135,14 @@ class cPeaksList { void loadFromBAFStream(ifstream &stream); + /** + \brief Load the spectrum from .ibd file. + \param imzmlitem cImzML containing the offset in the ibd file + \param ibdstream ibd binary file stream + */ + void loadFromIBDStream(cImzMLItem& imzmlitem, ifstream &ibdstream); + + /** \brief Load the spectrum from a .mgf file. \param stream source stream @@ -297,6 +309,28 @@ class cPeaksList { double getMaximumIntensityFromMZInterval(double minmz, double maxmz); + /** + \brief Set the coordinates. + \param x X coordinate + \param y Y coordinate + */ + void setCoordinates(int x, int y); + + + /** + \brief Get the X coordinate. + \retval int X coordinate + */ + int getCoordinateX(); + + + /** + \brief Get the Y coordinate. + \retval int Y coordinate + */ + int getCoordinateY(); + + /** \brief Store the structure into an output stream. \param os an output stream diff --git a/CycloBranch/core/cSequence.cpp b/CycloBranch/core/cSequence.cpp index c777eea..9eb8ec6 100644 --- a/CycloBranch/core/cSequence.cpp +++ b/CycloBranch/core/cSequence.cpp @@ -19,7 +19,7 @@ void cSequence::clear() { void cSequence::store(ofstream& os) { - os.write((char *)&peptidetype, sizeof(peptideType)); + os.write((char *)&peptidetype, sizeof(ePeptideType)); storeString(sequence, os); storeString(nterminalmodification, os); storeString(cterminalmodification, os); @@ -31,7 +31,7 @@ void cSequence::store(ofstream& os) { void cSequence::load(ifstream& is) { - is.read((char *)&peptidetype, sizeof(peptideType)); + is.read((char *)&peptidetype, sizeof(ePeptideType)); loadString(sequence, is); loadString(nterminalmodification, is); loadString(cterminalmodification, is); @@ -42,7 +42,7 @@ void cSequence::load(ifstream& is) { } -peptideType cSequence::getPeptideType() { +ePeptideType cSequence::getPeptideType() { return peptidetype; } @@ -62,7 +62,7 @@ string& cSequence::getReference() { } -void cSequence::setPeptideType(peptideType peptidetype) { +void cSequence::setPeptideType(ePeptideType peptidetype) { this->peptidetype = peptidetype; } diff --git a/CycloBranch/core/cSequence.h b/CycloBranch/core/cSequence.h index c84c94d..c594c16 100644 --- a/CycloBranch/core/cSequence.h +++ b/CycloBranch/core/cSequence.h @@ -25,7 +25,7 @@ using namespace boost; */ class cSequence { - peptideType peptidetype; + ePeptideType peptidetype; string sequence; string nterminalmodification; string cterminalmodification; @@ -65,9 +65,9 @@ class cSequence { /** \brief Get peptide type. - \retval peptideType peptide type + \retval ePeptideType peptide type */ - peptideType getPeptideType(); + ePeptideType getPeptideType(); /** @@ -95,7 +95,7 @@ class cSequence { \brief Set peptide type. \param peptidetype peptide type */ - void setPeptideType(peptideType peptidetype); + void setPeptideType(ePeptideType peptidetype); /** diff --git a/CycloBranch/core/cSequenceDatabase.cpp b/CycloBranch/core/cSequenceDatabase.cpp index 91ad447..a547ade 100644 --- a/CycloBranch/core/cSequenceDatabase.cpp +++ b/CycloBranch/core/cSequenceDatabase.cpp @@ -29,24 +29,7 @@ void cSequenceDatabase::loadFromPlainTextStream(ifstream &stream) { pos = s.find('\t'); if (pos != string::npos) { type = s.substr(0, pos); - if (type.compare("linear") == 0) { - sequence.setPeptideType(linear); - } - if (type.compare("cyclic") == 0) { - sequence.setPeptideType(cyclic); - } - if (type.compare("branched") == 0) { - sequence.setPeptideType(branched); - } - if (type.compare("branch-cyclic") == 0) { - sequence.setPeptideType(lasso); - } - if (type.compare("linearpolysaccharide") == 0) { - sequence.setPeptideType(linearpolysaccharide); - } - if (type.compare("other") == 0) { - sequence.setPeptideType(other); - } + sequence.setPeptideType(getPeptideTypeFromString(type)); s = s.substr(pos + 1); } else { diff --git a/CycloBranch/core/cTheoreticalSpectrum.cpp b/CycloBranch/core/cTheoreticalSpectrum.cpp index d72487f..e06bd4c 100644 --- a/CycloBranch/core/cTheoreticalSpectrum.cpp +++ b/CycloBranch/core/cTheoreticalSpectrum.cpp @@ -30,7 +30,7 @@ void visualSeries::load(ifstream& is) { } -void cTheoreticalSpectrum::clearFalseHits(map >& series, vector& fragmentions) { +void cTheoreticalSpectrum::clearFalseHits(map >& series, vector& fragmentions) { for (int i = 0; i < (int)fragmentions.size(); i++) { for (int j = 0; j < (int)series[fragmentions[i]].size(); j++) { @@ -75,7 +75,7 @@ void cTheoreticalSpectrum::computeStatistics(bool writedescription) { experimentalpeaksmatched = 0; scrambledpeaksmatched = 0; if (writedescription) { - unmatchedpeaks = ""; + unmatchedpeaks.clear(); } intensityweightedscore = 0; for (int i = 0; i < (int)experimentalpeaks.size(); i++) { @@ -94,7 +94,7 @@ void cTheoreticalSpectrum::computeStatistics(bool writedescription) { } else { if (writedescription) { - unmatchedpeaks += to_string((long double)experimentalpeaks[i].mzratio) + " "; + unmatchedpeaks.add(experimentalpeaks[i]); } } } @@ -106,6 +106,10 @@ void cTheoreticalSpectrum::computeStatistics(bool writedescription) { void cTheoreticalSpectrum::generatePrecursorIon(vector& intcomposition, cBricksDatabase& bricksdatabasewithcombinations, int& theoreticalpeaksrealsize, bool writedescription) { cPeak peak; int starttype, endtype; + set usedmodifications; + usedmodifications.insert(0); + + peak.isotope = false; switch (parameters->peptidetype) { @@ -114,6 +118,8 @@ void cTheoreticalSpectrum::generatePrecursorIon(vector& intcomposition, cBr peak.seriesid = 0; starttype = (int)precursor_ion; endtype = (int)precursor_ion_co_loss_and_dehydrated_and_deamidated; + usedmodifications.insert(candidate.getStartModifID()); + usedmodifications.insert(candidate.getEndModifID()); break; case cyclic: peak.mzratio = 0; @@ -126,18 +132,62 @@ void cTheoreticalSpectrum::generatePrecursorIon(vector& intcomposition, cBr peak.seriesid = 0; starttype = (int)precursor_ion; endtype = (int)precursor_ion_co_loss_and_dehydrated_and_deamidated; + usedmodifications.insert(candidate.getStartModifID()); + usedmodifications.insert(candidate.getEndModifID()); + usedmodifications.insert(candidate.getMiddleModifID()); break; - case lasso: + case branchcyclic: peak.mzratio = parameters->searchedmodifications[candidate.getMiddleModifID()].massdifference; peak.seriesid = 0; starttype = (int)cyclic_precursor_ion; endtype = (int)cyclic_precursor_ion_co_loss_and_dehydrated_and_deamidated; + usedmodifications.insert(candidate.getMiddleModifID()); + break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + peak.mzratio = parameters->searchedmodifications[candidate.getStartModifID()].massdifference + parameters->searchedmodifications[candidate.getEndModifID()].massdifference; + peak.seriesid = 0; + + switch (candidate.getResidueLossType(bricksdatabasewithcombinations)) + { + case water: + starttype = (int)linear_polyketide_precursor_ion_h_oh; + endtype = (int)linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated; + break; + case h2: + starttype = (int)linear_polyketide_precursor_ion_h_h; + endtype = (int)linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated; + break; + case h2o2: + starttype = (int)linear_polyketide_precursor_ion_oh_oh; + endtype = (int)linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated; + break; + default: + break; + } + + if (candidate.hasFirstBrickArtificial(bricksdatabasewithcombinations) || candidate.hasLastBrickArtificial(bricksdatabasewithcombinations)) { + starttype = (int)linear_polyketide_precursor_ion_h_h; + endtype = (int)linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated; + } + + usedmodifications.insert(candidate.getStartModifID()); + usedmodifications.insert(candidate.getEndModifID()); break; + case cyclicpolyketide: + peak.mzratio = 0; + peak.seriesid = (int)intcomposition.size() - 1; + starttype = (int)cyclic_polyketide_precursor_ion; + endtype = (int)cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated; + break; +#endif case linearpolysaccharide: peak.mzratio = parameters->searchedmodifications[candidate.getStartModifID()].massdifference + parameters->searchedmodifications[candidate.getEndModifID()].massdifference; peak.seriesid = 0; starttype = (int)precursor_ion; endtype = (int)precursor_ion_co_loss_and_dehydrated_and_deamidated; + usedmodifications.insert(candidate.getStartModifID()); + usedmodifications.insert(candidate.getEndModifID()); break; case other: break; @@ -151,86 +201,86 @@ void cTheoreticalSpectrum::generatePrecursorIon(vector& intcomposition, cBr double tempratio = peak.mzratio; for (int i = starttype; i <= endtype; i++) { - for (int j = 1; j <= abs(parameters->precursorcharge); j++) { - peak.mzratio = tempratio + parameters->fragmentdefinitions[(fragmentIonType)i].massdifference; - peak.iontype = (fragmentIonType)i; - - if (writedescription) { - string str; + for(set::iterator j = usedmodifications.begin(); j != usedmodifications.end(); ++j) { + for (int k = 1; k <= abs(parameters->precursorcharge); k++) { + peak.mzratio = tempratio + parameters->fragmentdefinitions[(eFragmentIonType)i].massdifference - parameters->searchedmodifications[*j].massdifference; + peak.iontype = (eFragmentIonType)i; - if (parameters->precursorcharge > 0) { - peak.description = parameters->fragmentdefinitions[(fragmentIonType)i].name + ":"; + if (writedescription) { + string str; - if (!parameters->precursoradduct.empty()) { - str = "+" + parameters->precursoradduct; - if (j > 1) { - str += "+"; - if (j > 2) { - str += to_string(j - 1); + if (parameters->precursorcharge > 0) { + peak.description = parameters->fragmentdefinitions[(eFragmentIonType)i].name; + if (*j > 0) { + peak.description += " (" + parameters->searchedmodifications[*j].name + " loss)"; + } + peak.description += ":"; + + if (!parameters->precursoradduct.empty()) { + str = "+" + parameters->precursoradduct; + if (k > 1) { + str += "+"; + if (k > 2) { + str += to_string(k - 1); + } + str += "H"; + } + peak.description.replace(peak.description.find("+zH"), 3, str); + } + else { + str = "+"; + if (k > 1) { + str += to_string(k); } str += "H"; + peak.description.replace(peak.description.find("+zH"), 3, str); } - peak.description.replace(peak.description.find("+zH"), 3, str); + + str = "]"; + if (k > 1) { + str += to_string(k); + } + str += "+"; + peak.description.replace(peak.description.find("]+"), 2, str); } else { - str = "+"; - if (j > 1) { - str += to_string(j); + peak.description = parameters->fragmentdefinitions[(eFragmentIonType)i].name + ":"; + + if (!parameters->precursoradduct.empty()) { + str = "-" + parameters->precursoradduct; + if (k > 1) { + str += "-"; + if (k > 2) { + str += to_string(k - 1); + } + str += "H"; + } + peak.description.replace(peak.description.find("+zH"), 3, str); } - str += "H"; - peak.description.replace(peak.description.find("+zH"), 3, str); - } - - str = "]"; - if (j > 1) { - str += to_string(j); - } - str += "+"; - peak.description.replace(peak.description.find("]+"), 2, str); - } - else { - peak.description = parameters->fragmentdefinitions[(fragmentIonType)i].name + ":"; - - if (!parameters->precursoradduct.empty()) { - str = "-" + parameters->precursoradduct; - if (j > 1) { - str += "-"; - if (j > 2) { - str += to_string(j - 1); + else { + str = "-"; + if (k > 1) { + str += to_string(k); } str += "H"; + peak.description.replace(peak.description.find("+zH"), 3, str); } - peak.description.replace(peak.description.find("+zH"), 3, str); - } - else { - str = "-"; - if (j > 1) { - str += to_string(j); - } - str += "H"; - peak.description.replace(peak.description.find("+zH"), 3, str); - } - str = "]"; - if (j > 1) { - str += to_string(j); + str = "]"; + if (k > 1) { + str += to_string(k); + } + str += "-"; + peak.description.replace(peak.description.find("]+"), 2, str); } - str += "-"; - peak.description.replace(peak.description.find("]+"), 2, str); } - } - - peak.mzratio = charge(uncharge(peak.mzratio, 1), (parameters->precursorcharge > 0)?j:-j); - peak.charge = (parameters->precursorcharge > 0)?j:-j; - if (theoreticalpeaks.size() > theoreticalpeaksrealsize) { - theoreticalpeaks[theoreticalpeaksrealsize] = peak; - } - else { - theoreticalpeaks.add(peak); + peak.mzratio = charge(uncharge(peak.mzratio, 1), (parameters->precursorcharge > 0)?k:-k); + peak.charge = (parameters->precursorcharge > 0)?k:-k; + + addPeakToList(peak, theoreticalpeaksrealsize); + addMetalPeaks(peak, theoreticalpeaksrealsize, k, writedescription); } - theoreticalpeaksrealsize++; - } } } @@ -287,7 +337,7 @@ void cTheoreticalSpectrum::generateScrambledIons(cBricksDatabase& bricksdatabase intcomposition.clear(); b.explodeToIntComposition(intcomposition); cPeak peak; - peak.iontype = (fragmentIonType)parameters->fragmentionsfortheoreticalspectra[i]; + peak.iontype = (eFragmentIonType)parameters->fragmentionsfortheoreticalspectra[i]; peak.mzratio = parameters->fragmentdefinitions[peak.iontype].massdifference; peak.removeme = false; peak.scrambled = true; @@ -342,13 +392,7 @@ void cTheoreticalSpectrum::generateScrambledIons(cBricksDatabase& bricksdatabase // attach scrambled peaks to common peaks for (int i = 0; i < (int)scrambledpeaks.size(); i++) { - if (theoreticalpeaks.size() > theoreticalpeaksrealsize) { - theoreticalpeaks[theoreticalpeaksrealsize] = scrambledpeaks[i]; - } - else { - theoreticalpeaks.add(scrambledpeaks[i]); - } - theoreticalpeaksrealsize++; + addPeakToList(scrambledpeaks[i], theoreticalpeaksrealsize); } } @@ -374,7 +418,7 @@ void cTheoreticalSpectrum::selectAndNormalizeScrambledSequences(unordered_set theoreticalpeaksrealsize) { + theoreticalpeaks[theoreticalpeaksrealsize] = peak; + } + else { + theoreticalpeaks.add(peak); + } + theoreticalpeaksrealsize++; +} + + +void cTheoreticalSpectrum::addAdductToDescription(string& description) { + if (parameters->precursorAdductHasLi) { + description += "_Li"; + } + + if (parameters->precursorAdductHasNa) { + description += "_Na"; + } + + if (parameters->precursorAdductHasMg) { + description += "_Mg"; + } + + if (parameters->precursorAdductHasAl) { + description += "_Al"; + } + + if (parameters->precursorAdductHasK) { + description += "_K"; + } + + if (parameters->precursorAdductHasCa) { + description += "_Ca"; + } + + if (parameters->precursorAdductHasMn) { + description += "_Mn"; + } + + if (parameters->precursorAdductHasFe) { + description += "_Fe"; + } + + if (parameters->precursorAdductHasCo) { + description += "_Co"; + } + + if (parameters->precursorAdductHasNi) { + description += "_Ni"; + } + + if (parameters->precursorAdductHasCu) { + description += "_Cu"; + } + + if (parameters->precursorAdductHasZn) { + description += "_Zn"; + } + + if (parameters->precursorAdductHasGa) { + description += "_Ga"; + } +} + + +int cTheoreticalSpectrum::countIsotopesOfMetals(cParameters* parameters) { + int count = 0; + for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { + count += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].numberofisotopes; + } + return count; +} + + +void cTheoreticalSpectrum::addMetalPeaks(cPeak& peak, int& peaklistrealsize, int charge, bool writedescription) { + if (parameters->precursorAdductHasLi) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio -= (Li - Li6)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Li"), 2, "6Li"); + } + addPeakToList(tmppeak, peaklistrealsize); + } + + if (parameters->precursorAdductHasMg) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Mg25 - Mg)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Mg"), 2, "25Mg"); + } + addPeakToList(tmppeak, peaklistrealsize); + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Mg26 - Mg)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Mg"), 2, "26Mg"); + } + addPeakToList(tmppeak, peaklistrealsize); + } + + if (parameters->precursorAdductHasK) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (K41 - K)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("K"), 1, "41K"); + } + addPeakToList(tmppeak, peaklistrealsize); + } + + if (parameters->precursorAdductHasCa) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Ca44 - Ca)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Ca"), 2, "44Ca"); + } + addPeakToList(tmppeak, peaklistrealsize); + } + + if (parameters->precursorAdductHasFe) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio -= (Fe - Fe54)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Fe"), 2, "54Fe"); + } + addPeakToList(tmppeak, peaklistrealsize); + + /*tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Fe57 - Fe)/(double)j; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find(':') - 2, 2, "57Fe"); + } + addPeakToList(tmppeak, peaklistrealsize);*/ + } + + if (parameters->precursorAdductHasNi) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Ni60 - Ni)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Ni"), 2, "60Ni"); + } + addPeakToList(tmppeak, peaklistrealsize); + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Ni61 - Ni)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Ni"), 2, "61Ni"); + } + addPeakToList(tmppeak, peaklistrealsize); + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Ni62 - Ni)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Ni"), 2, "62Ni"); + } + addPeakToList(tmppeak, peaklistrealsize); + } + + if (parameters->precursorAdductHasCu) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Cu65 - Cu)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Cu"), 2, "65Cu"); + } + addPeakToList(tmppeak, peaklistrealsize); + } + + if (parameters->precursorAdductHasZn) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Zn66 - Zn)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Zn"), 2, "66Zn"); + } + addPeakToList(tmppeak, peaklistrealsize); + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Zn67 - Zn)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Zn"), 2, "67Zn"); + } + addPeakToList(tmppeak, peaklistrealsize); + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Zn68 - Zn)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Zn"), 2, "68Zn"); + } + addPeakToList(tmppeak, peaklistrealsize); + } + + if (parameters->precursorAdductHasGa) { + cPeak tmppeak; + + tmppeak = peak; + tmppeak.isotope = true; + tmppeak.mzratio += (Ga71 - Ga)/(double)charge; + if (writedescription) { + tmppeak.description.replace(tmppeak.description.find("Ga"), 2, "71Ga"); + } + addPeakToList(tmppeak, peaklistrealsize); + } +} + + +void cTheoreticalSpectrum::removeUnmatchedMetalIsotopes(cPeaksList& theoreticalpeaks, int theoreticalpeaksrealsize, cPeaksList& experimentalpeaks, vector >& experimentalpeakmatches) { + int lastparent = 0; + for (int i = 0; i < theoreticalpeaksrealsize; i++) { + if (!theoreticalpeaks[i].isotope) { + lastparent = i; + continue; + } + + if ((theoreticalpeaks[lastparent].matched == 0) && (theoreticalpeaks[i].matched > 0)) { + experimentalpeakmatches[theoreticalpeaks[i].matchedid].erase(experimentalpeakmatches[theoreticalpeaks[i].matchedid].find(i)); + experimentalpeaks[theoreticalpeaks[i].matchedid].matched--; + + theoreticalpeaks[i].matched--; + theoreticalpeaks[i].matchedid = -1; + } + } +} + + cTheoreticalSpectrum::cTheoreticalSpectrum() { clear(); } @@ -505,7 +802,7 @@ void cTheoreticalSpectrum::clear(bool clearpeaklist) { experimentalpeaks.clear(); matchedions.clear(); for (int i = 0; i < fragmentIonTypeEnd; i++) { - matchedions[(fragmentIonType)i] = 0; + matchedions[(eFragmentIonType)i] = 0; } candidate.clear(); @@ -513,7 +810,7 @@ void cTheoreticalSpectrum::clear(bool clearpeaklist) { scrambledpeaksmatched = 0; peakstested = 0; experimentalpeaksmatchedratio = 0; - unmatchedpeaks = ""; + unmatchedpeaks.clear(); coveragebyseries = ""; valid = false; maskscore = 0; @@ -585,10 +882,10 @@ int cTheoreticalSpectrum::compareBranched(cPeaksList& sortedpeaklist, cBricksDat // j == 2, 4, 5 are invalid if ((j == 0) || ((j == 1) && (parameters->searchedmodifications[trotations[j].startmodifID].nterminal)) || ((j == 3) && (parameters->searchedmodifications[trotations[j].endmodifID].cterminal))) { if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) { - generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, trotations[j].bricks, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, branched, &trotations[j]); + generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, trotations[j].bricks, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype, &trotations[j]); } if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal) { - generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, trotations[j].bricks, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, branched, &trotations[j]); + generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, trotations[j].bricks, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype, &trotations[j]); } } @@ -606,7 +903,7 @@ int cTheoreticalSpectrum::compareBranched(cPeaksList& sortedpeaklist, cBricksDat // coverage of series - vector > > series; + vector > > series; series.resize(trotations.size()); for (int i = 0; i < (int)series.size(); i++) { for (int j = 0; j < (int)parameters->fragmentionsfortheoreticalspectra.size(); j++) { @@ -615,7 +912,7 @@ int cTheoreticalSpectrum::compareBranched(cPeaksList& sortedpeaklist, cBricksDat } for (int i = 0; i < theoreticalpeaksrealsize; i++) { - if ((theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid >= 0) && (series[theoreticalpeaks[i].rotationid].count(theoreticalpeaks[i].iontype) == 1)) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid >= 0) && (series[theoreticalpeaks[i].rotationid].count(theoreticalpeaks[i].iontype) == 1)) { series[theoreticalpeaks[i].rotationid][theoreticalpeaks[i].iontype][theoreticalpeaks[i].seriesid]++; } } @@ -628,7 +925,7 @@ int cTheoreticalSpectrum::compareBranched(cPeaksList& sortedpeaklist, cBricksDat } for (int i = 0; i < theoreticalpeaksrealsize; i++) { - if ((theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid >= 0) && ((series[theoreticalpeaks[i].rotationid].count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[theoreticalpeaks[i].rotationid][parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid >= 0) && ((series[theoreticalpeaks[i].rotationid].count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[theoreticalpeaks[i].rotationid][parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { experimentalpeakmatches[theoreticalpeaks[i].matchedid].erase(experimentalpeakmatches[theoreticalpeaks[i].matchedid].find(i)); experimentalpeaks[theoreticalpeaks[i].matchedid].matched--; @@ -639,6 +936,9 @@ int cTheoreticalSpectrum::compareBranched(cPeaksList& sortedpeaklist, cBricksDat } + removeUnmatchedMetalIsotopes(theoreticalpeaks, theoreticalpeaksrealsize, experimentalpeaks, experimentalpeakmatches); + + // fill annotations of peaks for (int i = 0; i < (int)experimentalpeaks.size(); i++) { for (set::iterator it = experimentalpeakmatches[i].begin(); it != experimentalpeakmatches[i].end(); ++it) { @@ -647,7 +947,9 @@ int cTheoreticalSpectrum::compareBranched(cPeaksList& sortedpeaklist, cBricksDat experimentalpeaks[i].description += ","; } experimentalpeaks[i].description += theoreticalpeaks[*it].description.substr(0,theoreticalpeaks[*it].description.find(':')); - theoreticalpeaks[*it].matchdescription += ", measured mass " + to_string((long double)experimentalpeaks[i].mzratio) + " matched with " + to_string((long double)ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio)) + " ppm error"; + theoreticalpeaks[*it].matchedmz = experimentalpeaks[i].mzratio; + theoreticalpeaks[*it].matchedintensity = experimentalpeaks[i].intensity; + theoreticalpeaks[*it].matchedppm = ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio); } experimentalpeaks[i].iontype = selectHigherPriorityIonTypeCID(experimentalpeaks[i].iontype,theoreticalpeaks[*it].iontype); @@ -723,10 +1025,10 @@ int cTheoreticalSpectrum::compareLinear(cPeaksList& sortedpeaklist, cBricksDatab for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) { - generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, linear); + generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype); } if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal) { - generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, linear); + generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype); } } @@ -740,13 +1042,13 @@ int cTheoreticalSpectrum::compareLinear(cPeaksList& sortedpeaklist, cBricksDatab // coverage of series - map > series; + map > series; for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { series[parameters->fragmentionsfortheoreticalspectra[i]].resize(intcomposition.size()); } for (int i = 0; i < theoreticalpeaksrealsize; i++) { - if ((theoreticalpeaks[i].matched > 0) && (series.count(theoreticalpeaks[i].iontype) == 1)) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (series.count(theoreticalpeaks[i].iontype) == 1)) { series[theoreticalpeaks[i].iontype][theoreticalpeaks[i].seriesid]++; } } @@ -757,7 +1059,7 @@ int cTheoreticalSpectrum::compareLinear(cPeaksList& sortedpeaklist, cBricksDatab clearFalseHits(series, parameters->fragmentionsfortheoreticalspectra); for (int i = 0; i < theoreticalpeaksrealsize; i++) { - if ((theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid != -1) && ((series.count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid != -1) && ((series.count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { experimentalpeakmatches[theoreticalpeaks[i].matchedid].erase(experimentalpeakmatches[theoreticalpeaks[i].matchedid].find(i)); experimentalpeaks[theoreticalpeaks[i].matchedid].matched--; @@ -768,6 +1070,9 @@ int cTheoreticalSpectrum::compareLinear(cPeaksList& sortedpeaklist, cBricksDatab } + removeUnmatchedMetalIsotopes(theoreticalpeaks, theoreticalpeaksrealsize, experimentalpeaks, experimentalpeakmatches); + + // fill annotations of peaks for (int i = 0; i < (int)experimentalpeaks.size(); i++) { for (set::iterator it = experimentalpeakmatches[i].begin(); it != experimentalpeakmatches[i].end(); ++it) { @@ -776,7 +1081,9 @@ int cTheoreticalSpectrum::compareLinear(cPeaksList& sortedpeaklist, cBricksDatab experimentalpeaks[i].description += ","; } experimentalpeaks[i].description += theoreticalpeaks[*it].description.substr(0,theoreticalpeaks[*it].description.find(':')); - theoreticalpeaks[*it].matchdescription += ", measured mass " + to_string((long double)experimentalpeaks[i].mzratio) + " matched with " + to_string((long double)ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio)) + " ppm error"; + theoreticalpeaks[*it].matchedmz = experimentalpeaks[i].mzratio; + theoreticalpeaks[*it].matchedintensity = experimentalpeaks[i].intensity; + theoreticalpeaks[*it].matchedppm = ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio); } experimentalpeaks[i].iontype = selectHigherPriorityIonTypeCID(experimentalpeaks[i].iontype,theoreticalpeaks[*it].iontype); @@ -907,6 +1214,8 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab return -2; } + eResidueLossType leftresiduelosstype = water; + bool hasfirstblockartificial = false; for (int i = 0; i < 2*r; i++) { @@ -915,8 +1224,13 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab brick.setComposition(rotations[i], false); brick.explodeToIntComposition(intcomposition); +#if POLYKETIDE_SIDEROPHORES == 1 + eResidueLossType leftresiduelosstype = bricksdatabasewithcombinations[intcomposition[0] - 1].getResidueLossType(); + bool hasfirstblockartificial = bricksdatabasewithcombinations[intcomposition[0] - 1].isArtificial(); +#endif + for (int j = 0; j < (int)parameters->fragmentionsfortheoreticalspectra.size(); j++) { - generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[j], bricksdatabasewithcombinations, writedescription, i, splittingsites, parameters->searchedmodifications, cyclic); + generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[j], bricksdatabasewithcombinations, writedescription, i, splittingsites, parameters->searchedmodifications, parameters->peptidetype, 0, leftresiduelosstype, hasfirstblockartificial); } } @@ -935,7 +1249,7 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab // coverage of series - vector > > series; + vector > > series; series.resize(rotations.size()); for (int i = 0; i < (int)series.size(); i++) { for (int j = 0; j < (int)parameters->fragmentionsfortheoreticalspectra.size(); j++) { @@ -944,7 +1258,7 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab } for (int i = 0; i < theoreticalpeaksrealsize; i++) { - if ((theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid >= 0) && (series[theoreticalpeaks[i].rotationid].count(theoreticalpeaks[i].iontype) == 1)) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid >= 0) && (series[theoreticalpeaks[i].rotationid].count(theoreticalpeaks[i].iontype) == 1)) { series[theoreticalpeaks[i].rotationid][theoreticalpeaks[i].iontype][theoreticalpeaks[i].seriesid]++; } } @@ -957,7 +1271,7 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab } for (int i = 0; i < theoreticalpeaksrealsize; i++) { - if ((theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid >= 0) && ((series[theoreticalpeaks[i].rotationid].count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[theoreticalpeaks[i].rotationid][parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid >= 0) && ((series[theoreticalpeaks[i].rotationid].count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[theoreticalpeaks[i].rotationid][parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { experimentalpeakmatches[theoreticalpeaks[i].matchedid].erase(experimentalpeakmatches[theoreticalpeaks[i].matchedid].find(i)); experimentalpeaks[theoreticalpeaks[i].matchedid].matched--; @@ -1022,6 +1336,9 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab } + removeUnmatchedMetalIsotopes(theoreticalpeaks, theoreticalpeaksrealsize, experimentalpeaks, experimentalpeakmatches); + + // fill annotations of peaks for (int i = 0; i < (int)experimentalpeakmatches.size(); i++) { for (set::iterator it = experimentalpeakmatches[i].begin(); it != experimentalpeakmatches[i].end(); ++it) { @@ -1030,7 +1347,9 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab experimentalpeaks[i].description += ","; } experimentalpeaks[i].description += theoreticalpeaks[*it].description.substr(0,theoreticalpeaks[*it].description.find(':')); - theoreticalpeaks[*it].matchdescription += ", measured mass " + to_string((long double)experimentalpeaks[i].mzratio) + " matched with " + to_string((long double)ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio)) + " ppm error"; + theoreticalpeaks[*it].matchedmz = experimentalpeaks[i].mzratio; + theoreticalpeaks[*it].matchedintensity = experimentalpeaks[i].intensity; + theoreticalpeaks[*it].matchedppm = ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio); } if (experimentalpeaks[i].iontype != fragmentIonTypeEnd) { @@ -1149,47 +1468,47 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab } -int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { +int cTheoreticalSpectrum::compareBranchCyclic(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { vector splittingsites; int theoreticalpeaksrealsize = 0; - vector lassorotations; + vector branchcyclicrotations; // normalize the candidate - candidate.getLassoRotations(lassorotations, false); + candidate.getBranchCyclicRotations(branchcyclicrotations, false); int numberofbricks = getNumberOfBricks(candidate.getComposition()); - for (int i = 0; i < (int)lassorotations.size(); i++) { - if (lassorotations[i].getBranchEnd() == numberofbricks - 1) { + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { + if (branchcyclicrotations[i].getBranchEnd() == numberofbricks - 1) { vector v; - v.push_back(lassorotations[i].getComposition()); + v.push_back(branchcyclicrotations[i].getComposition()); string name = candidate.getName(); vector cpath = candidate.getPath(); - candidate.setCandidate(v, cpath, candidate.getStartModifID(), candidate.getEndModifID(), candidate.getMiddleModifID(), lassorotations[i].getBranchStart(), lassorotations[i].getBranchEnd()); + candidate.setCandidate(v, cpath, candidate.getStartModifID(), candidate.getEndModifID(), candidate.getMiddleModifID(), branchcyclicrotations[i].getBranchStart(), branchcyclicrotations[i].getBranchEnd()); candidate.setName(name); break; } } // get branch-cyclic rotations - candidate.getLassoRotations(lassorotations, true); + candidate.getBranchCyclicRotations(branchcyclicrotations, true); // get T-permutations of branch-cyclic rotations - vector > trotationsoflassorotations; - trotationsoflassorotations.resize(lassorotations.size()); - for (int i = 0; i < (int)lassorotations.size(); i++) { - lassorotations[i].getPermutationsOfBranches(trotationsoflassorotations[i]); + vector > trotationsofbranchcyclicrotations; + trotationsofbranchcyclicrotations.resize(branchcyclicrotations.size()); + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { + branchcyclicrotations[i].getPermutationsOfBranches(trotationsofbranchcyclicrotations[i]); } - int r = (int)lassorotations.size() / 2; + int r = (int)branchcyclicrotations.size() / 2; validposition = -1; reversevalidposition = -1; try { bool stop = true; - for (int i = 0; i < (int)lassorotations.size(); i++) { - for (int j = 0; j < (int)trotationsoflassorotations[i].size(); j++) { - if (regex_search(trotationsoflassorotations[i][j].tcomposition, sequencetag)) { + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { + for (int j = 0; j < (int)trotationsofbranchcyclicrotations[i].size(); j++) { + if (regex_search(trotationsofbranchcyclicrotations[i][j].tcomposition, sequencetag)) { stop = false; break; } @@ -1202,8 +1521,8 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba if (writedescription) { valid = false; if (parameters->searchedsequence.size() > 0) { - for (int i = 0; i < (int)lassorotations.size(); i++) { - if (regex_search(lassorotations[i].getComposition(), searchedsequence)) { + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { + if (regex_search(branchcyclicrotations[i].getComposition(), searchedsequence)) { validposition = i; if (validposition == 0) { @@ -1217,9 +1536,9 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba } } - for (int j = 0; j < (int)trotationsoflassorotations[i].size(); j++) { - if (regex_search(trotationsoflassorotations[i][j].tcomposition, searchedsequence) && - (parameters->searchedmodifications[trotationsoflassorotations[i][j].middlemodifID].name.compare(parameters->searchedsequenceTmodif) == 0)) { + for (int j = 0; j < (int)trotationsofbranchcyclicrotations[i].size(); j++) { + if (regex_search(trotationsofbranchcyclicrotations[i][j].tcomposition, searchedsequence) && + (parameters->searchedmodifications[trotationsofbranchcyclicrotations[i][j].middlemodifID].name.compare(parameters->searchedsequenceTmodif) == 0)) { valid = true; break; } @@ -1235,7 +1554,7 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba if (validposition != -1) { - splittingsites.resize(lassorotations.size()); + splittingsites.resize(branchcyclicrotations.size()); splittingsites[validposition].first = 0; splittingsites[validposition].second = r - 1; splittingsites[reversevalidposition].first = r - 1; @@ -1269,25 +1588,25 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { - for (int j = 0; j < (int)lassorotations.size(); j++) { + for (int j = 0; j < (int)branchcyclicrotations.size(); j++) { - for (int k = 0; k < (int)trotationsoflassorotations[j].size(); k++) { + for (int k = 0; k < (int)trotationsofbranchcyclicrotations[j].size(); k++) { // we do not know whether the middle branch is n-terminal or c-terminal for an unmodified middle branch // in this case the modifID is 0, and both n-terminal (*) and c-terminal (**) fragments are generated if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) { // if the start modification for k == 1 or k == 4 is nterminal, generate n-terminal ions (*) - if (!(((k == 1) || (k == 4)) && (!parameters->searchedmodifications[trotationsoflassorotations[j][k].startmodifID].nterminal))) { - generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, trotationsoflassorotations[j][k].bricks, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, j, splittingsites, parameters->searchedmodifications, lasso, &trotationsoflassorotations[j][k]); + if (!(((k == 1) || (k == 4)) && (!parameters->searchedmodifications[trotationsofbranchcyclicrotations[j][k].startmodifID].nterminal))) { + generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, trotationsofbranchcyclicrotations[j][k].bricks, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, j, splittingsites, parameters->searchedmodifications, parameters->peptidetype, &trotationsofbranchcyclicrotations[j][k]); } } // all permmutations except 3 and 5 have invalid c-terms - if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal && ((k == 3) || (k == 5) /*|| ((k == 0) && (trotationsoflassorotations[j][k].endsWithBracket())) || ((k == 2) && (trotationsoflassorotations[j][k].startsWithBracket()))*/)) { + if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal && ((k == 3) || (k == 5) /*|| ((k == 0) && (trotationsofbranchcyclicrotations[j][k].endsWithBracket())) || ((k == 2) && (trotationsofbranchcyclicrotations[j][k].startsWithBracket()))*/)) { // if the end modification is cterminal, generate c-terminal ions (**) - if (parameters->searchedmodifications[trotationsoflassorotations[j][k].endmodifID].cterminal) { - generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, trotationsoflassorotations[j][k].bricks, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, j, splittingsites, parameters->searchedmodifications, lasso, &trotationsoflassorotations[j][k]); + if (parameters->searchedmodifications[trotationsofbranchcyclicrotations[j][k].endmodifID].cterminal) { + generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, trotationsofbranchcyclicrotations[j][k].bricks, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, j, splittingsites, parameters->searchedmodifications, parameters->peptidetype, &trotationsofbranchcyclicrotations[j][k]); } } @@ -1297,7 +1616,7 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba } - generatePrecursorIon(trotationsoflassorotations[0][0].bricks, bricksdatabasewithcombinations, theoreticalpeaksrealsize, writedescription); + generatePrecursorIon(trotationsofbranchcyclicrotations[0][0].bricks, bricksdatabasewithcombinations, theoreticalpeaksrealsize, writedescription); // search the theoretical peaks in the experimental peak list @@ -1307,20 +1626,20 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba // coverage of series - vector > > > series; - series.resize(lassorotations.size()); - for (int i = 0; i < (int)lassorotations.size(); i++) { + vector > > > series; + series.resize(branchcyclicrotations.size()); + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { series[i].resize(6); - //series[i].resize(trotationsoflassorotations[i].size()); // to do - potential bug + //series[i].resize(trotationsofbranchcyclicrotations[i].size()); // to do - potential bug for (int j = 0; j < (int)series[i].size(); j++) { for (int k = 0; k < (int)parameters->fragmentionsfortheoreticalspectra.size(); k++) { - series[i][j][parameters->fragmentionsfortheoreticalspectra[k]].resize(trotationsoflassorotations[i][0].bricks.size()); + series[i][j][parameters->fragmentionsfortheoreticalspectra[k]].resize(trotationsofbranchcyclicrotations[i][0].bricks.size()); } } for (int j = 0; j < theoreticalpeaksrealsize; j++) { - if ((theoreticalpeaks[j].matched > 0) && (theoreticalpeaks[j].rotationid >= 0) && (series[i][theoreticalpeaks[j].rotationid % 6].count(theoreticalpeaks[j].iontype) == 1)) { + if (!theoreticalpeaks[j].isotope && (theoreticalpeaks[j].matched > 0) && (theoreticalpeaks[j].rotationid >= 0) && (series[i][theoreticalpeaks[j].rotationid % 6].count(theoreticalpeaks[j].iontype) == 1)) { if (i == theoreticalpeaks[j].rotationid / 6) { series[i][theoreticalpeaks[j].rotationid % 6][theoreticalpeaks[j].iontype][theoreticalpeaks[j].seriesid]++; } @@ -1331,13 +1650,13 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba // peak hits without parents are removed if (parameters->clearhitswithoutparent) { - for (int i = 0; i < (int)lassorotations.size(); i++) { - for (int j = 0; j < (int)trotationsoflassorotations[i].size(); j++) { + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { + for (int j = 0; j < (int)trotationsofbranchcyclicrotations[i].size(); j++) { clearFalseHits(series[i][j], parameters->fragmentionsfortheoreticalspectra); } for (int j = 0; j < theoreticalpeaksrealsize; j++) { - if ((theoreticalpeaks[j].matched > 0) && (theoreticalpeaks[j].rotationid >= 0) && (i == theoreticalpeaks[j].rotationid / 6) && ((series[i][theoreticalpeaks[j].rotationid % 6].count(parameters->fragmentdefinitions[theoreticalpeaks[j].iontype].parent) == 0) || (series[i][theoreticalpeaks[j].rotationid % 6][parameters->fragmentdefinitions[theoreticalpeaks[j].iontype].parent][theoreticalpeaks[j].seriesid] == 0))) { + if (!theoreticalpeaks[j].isotope && (theoreticalpeaks[j].matched > 0) && (theoreticalpeaks[j].rotationid >= 0) && (i == theoreticalpeaks[j].rotationid / 6) && ((series[i][theoreticalpeaks[j].rotationid % 6].count(parameters->fragmentdefinitions[theoreticalpeaks[j].iontype].parent) == 0) || (series[i][theoreticalpeaks[j].rotationid % 6][parameters->fragmentdefinitions[theoreticalpeaks[j].iontype].parent][theoreticalpeaks[j].seriesid] == 0))) { experimentalpeakmatches[theoreticalpeaks[j].matchedid].erase(experimentalpeakmatches[theoreticalpeaks[j].matchedid].find(j)); experimentalpeaks[theoreticalpeaks[j].matchedid].matched--; @@ -1349,6 +1668,9 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba } + removeUnmatchedMetalIsotopes(theoreticalpeaks, theoreticalpeaksrealsize, experimentalpeaks, experimentalpeakmatches); + + // fill annotations of peaks for (int i = 0; i < (int)experimentalpeaks.size(); i++) { for (set::iterator it = experimentalpeakmatches[i].begin(); it != experimentalpeakmatches[i].end(); ++it) { @@ -1357,7 +1679,9 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba experimentalpeaks[i].description += ","; } experimentalpeaks[i].description += theoreticalpeaks[*it].description.substr(0,theoreticalpeaks[*it].description.find(':')); - theoreticalpeaks[*it].matchdescription += ", measured mass " + to_string((long double)experimentalpeaks[i].mzratio) + " matched with " + to_string((long double)ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio)) + " ppm error"; + theoreticalpeaks[*it].matchedmz = experimentalpeaks[i].mzratio; + theoreticalpeaks[*it].matchedintensity = experimentalpeaks[i].intensity; + theoreticalpeaks[*it].matchedppm = ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio); } experimentalpeaks[i].iontype = selectHigherPriorityIonTypeCID(experimentalpeaks[i].iontype,theoreticalpeaks[*it].iontype); @@ -1371,18 +1695,18 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba visualcoverage.clear(); coveragebyseries = "Linearized sequences from all ring break up points:
\n"; - for (int i = 0; i < (int)lassorotations.size(); i++) { - for (int j = 0; j < (int)trotationsoflassorotations[i].size(); j++) { + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { + for (int j = 0; j < (int)trotationsofbranchcyclicrotations[i].size(); j++) { coveragebyseries += to_string(splittingsites[i].first + 1) + "-" + to_string(splittingsites[i].second + 1) + "_"; coveragebyseries += to_string(j + 1) + " ~ "; - coveragebyseries += bricksdatabasewithcombinations.getAcronymNameOfTPeptide(trotationsoflassorotations[i][j].tcomposition, false); + coveragebyseries += bricksdatabasewithcombinations.getAcronymNameOfTPeptide(trotationsofbranchcyclicrotations[i][j].tcomposition, false); coveragebyseries += "
\n"; } coveragebyseries += "
\n"; } coveragebyseries += "Series of matched peaks:
\n"; - for (int i = 0; i < (int)lassorotations.size(); i++) { + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { for (int j = 0; j < (int)series[i].size(); j++) { for (int k = 0; k < (int)parameters->fragmentionsfortheoreticalspectra.size(); k++) { tempseries.name = to_string(splittingsites[i].first + 1) + "-" + to_string(splittingsites[i].second + 1) + "_"; @@ -1411,6 +1735,187 @@ int cTheoreticalSpectrum::compareLasso(cPeaksList& sortedpeaklist, cBricksDataba } +#if POLYKETIDE_SIDEROPHORES == 1 + + +int cTheoreticalSpectrum::compareLinearPolyketideSiderophore(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { + + if (!candidate.checkPolyketideSequence(bricksdatabasewithcombinations, parameters->peptidetype)) { + return -2; + } + + cBrick brick; + vector intcomposition; + vector splittingsites; + int theoreticalpeaksrealsize = 0; + + intcomposition.clear(); + brick.clear(); + brick.setComposition(candidate.getComposition(), false); + brick.explodeToIntComposition(intcomposition); + + eResidueLossType leftresiduelosstype = bricksdatabasewithcombinations[intcomposition[0] - 1].getResidueLossType(); + eResidueLossType rightresiduelosstype = bricksdatabasewithcombinations[intcomposition.back() - 1].getResidueLossType(); + + bool hasfirstblockartificial = bricksdatabasewithcombinations[intcomposition[0] - 1].isArtificial(); + bool haslastblockartificial = bricksdatabasewithcombinations[intcomposition.back() - 1].isArtificial(); + + if (!hasfirstblockartificial && !haslastblockartificial) { + if (((leftresiduelosstype == h2) && (candidate.getStartModifID() > 0) && parameters->searchedmodifications[candidate.getStartModifID()].cterminal) + || ((leftresiduelosstype == h2o2) && (candidate.getStartModifID() > 0) && parameters->searchedmodifications[candidate.getStartModifID()].nterminal) + || ((rightresiduelosstype == h2) && (candidate.getEndModifID() > 0) && parameters->searchedmodifications[candidate.getEndModifID()].cterminal) + || ((rightresiduelosstype == h2o2) && (candidate.getEndModifID() > 0) && parameters->searchedmodifications[candidate.getEndModifID()].nterminal)) { + return -2; + } + } + + cCandidate revertedcandidate = candidate; + revertedcandidate.revertComposition(); + + try { + if (!regex_search(candidate.getComposition(), sequencetag) && !regex_search(revertedcandidate.getComposition(), sequencetag)) { + return -2; + } + + if (writedescription) { + valid = false; + if ((parameters->searchedsequence.size() > 0) && + ((regex_search(candidate.getComposition(), searchedsequence) && + (parameters->searchedmodifications[candidate.getStartModifID()].name.compare(parameters->searchedsequenceNtermmodif) == 0) && + (parameters->searchedmodifications[candidate.getEndModifID()].name.compare(parameters->searchedsequenceCtermmodif) == 0)) + || + (regex_search(revertedcandidate.getComposition(), searchedsequence) && + (parameters->searchedmodifications[revertedcandidate.getStartModifID()].name.compare(parameters->searchedsequenceNtermmodif) == 0) && + (parameters->searchedmodifications[revertedcandidate.getEndModifID()].name.compare(parameters->searchedsequenceCtermmodif) == 0))) + ) { + valid = true; + } + } + } + catch (regex_error& /*e*/) { + return -2; + } + + for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { + if ( + ((hasfirstblockartificial || (leftresiduelosstype == h2)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2h_ion))) + || + ((hasfirstblockartificial || (leftresiduelosstype == h2o2)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2oh_ion))) + ) { + generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype, 0, leftresiduelosstype, hasfirstblockartificial); + } + if ( + ((haslastblockartificial || (rightresiduelosstype == h2)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2h_ion))) + || + ((haslastblockartificial || (rightresiduelosstype == h2o2)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2oh_ion))) + ) { + generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype, 0, rightresiduelosstype, haslastblockartificial); + } + } + + generatePrecursorIon(intcomposition, bricksdatabasewithcombinations, theoreticalpeaksrealsize, writedescription); + + + // search the theoretical peaks in the experimental peak list + experimentalpeaks = sortedpeaklist; + vector > experimentalpeakmatches; + searchForPeakPairs(theoreticalpeaks, theoreticalpeaksrealsize, experimentalpeaks, experimentalpeakmatches, parameters->fragmentmasserrortolerance); + + + // coverage of series + map > series; + for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { + series[parameters->fragmentionsfortheoreticalspectra[i]].resize(intcomposition.size()); + } + + for (int i = 0; i < theoreticalpeaksrealsize; i++) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (series.count(theoreticalpeaks[i].iontype) == 1)) { + series[theoreticalpeaks[i].iontype][theoreticalpeaks[i].seriesid]++; + } + } + + + // peak hits without parents are removed + if (parameters->clearhitswithoutparent) { + clearFalseHits(series, parameters->fragmentionsfortheoreticalspectra); + + for (int i = 0; i < theoreticalpeaksrealsize; i++) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid != -1) && ((series.count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { + experimentalpeakmatches[theoreticalpeaks[i].matchedid].erase(experimentalpeakmatches[theoreticalpeaks[i].matchedid].find(i)); + experimentalpeaks[theoreticalpeaks[i].matchedid].matched--; + + theoreticalpeaks[i].matched--; + theoreticalpeaks[i].matchedid = -1; + } + } + } + + + removeUnmatchedMetalIsotopes(theoreticalpeaks, theoreticalpeaksrealsize, experimentalpeaks, experimentalpeakmatches); + + + // fill annotations of peaks + for (int i = 0; i < (int)experimentalpeaks.size(); i++) { + for (set::iterator it = experimentalpeakmatches[i].begin(); it != experimentalpeakmatches[i].end(); ++it) { + if (writedescription) { + if (experimentalpeaks[i].description.compare("") != 0) { + experimentalpeaks[i].description += ","; + } + experimentalpeaks[i].description += theoreticalpeaks[*it].description.substr(0,theoreticalpeaks[*it].description.find(':')); + theoreticalpeaks[*it].matchedmz = experimentalpeaks[i].mzratio; + theoreticalpeaks[*it].matchedintensity = experimentalpeaks[i].intensity; + theoreticalpeaks[*it].matchedppm = ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio); + } + + experimentalpeaks[i].iontype = selectHigherPriorityIonTypeCID(experimentalpeaks[i].iontype,theoreticalpeaks[*it].iontype); + } + } + + + if (writedescription) { + + visualcoverage.clear(); + visualSeries tempseries; + + coveragebyseries = "Series of matched peaks:
\n"; + for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { + tempseries.name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name; + coveragebyseries += tempseries.name + " "; + tempseries.series.clear(); + for (int j = 0; j < (int)series[parameters->fragmentionsfortheoreticalspectra[i]].size() - 1; j++) { + coveragebyseries += to_string(series[parameters->fragmentionsfortheoreticalspectra[i]][j]); + tempseries.series.push_back(series[parameters->fragmentionsfortheoreticalspectra[i]][j]); + if (j < (int)series[parameters->fragmentionsfortheoreticalspectra[i]].size() - 2) { + coveragebyseries += " "; + } + } + coveragebyseries += "
\n"; + visualcoverage.push_back(tempseries); + } + + } + + computeStatistics(writedescription); + + return theoreticalpeaksrealsize; + +} + + +int cTheoreticalSpectrum::compareCyclicPolyketideSiderophore(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { + + if (!candidate.checkPolyketideSequence(bricksdatabasewithcombinations, parameters->peptidetype)) { + return -2; + } + + return compareCyclic(sortedpeaklist, bricksdatabasewithcombinations, writedescription, sequencetag, searchedsequence); + +} + + +#endif + + int cTheoreticalSpectrum::compareLinearPolysaccharide(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { cBrick brick; vector intcomposition; @@ -1442,10 +1947,10 @@ int cTheoreticalSpectrum::compareLinearPolysaccharide(cPeaksList& sortedpeaklist for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) { - generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, linearpolysaccharide); + generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype); } if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal) { - generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, linearpolysaccharide); + generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype); } } @@ -1459,13 +1964,13 @@ int cTheoreticalSpectrum::compareLinearPolysaccharide(cPeaksList& sortedpeaklist // coverage of series - map > series; + map > series; for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { series[parameters->fragmentionsfortheoreticalspectra[i]].resize(intcomposition.size()); } for (int i = 0; i < theoreticalpeaksrealsize; i++) { - if ((theoreticalpeaks[i].matched > 0) && (series.count(theoreticalpeaks[i].iontype) == 1)) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (series.count(theoreticalpeaks[i].iontype) == 1)) { series[theoreticalpeaks[i].iontype][theoreticalpeaks[i].seriesid]++; } } @@ -1476,7 +1981,7 @@ int cTheoreticalSpectrum::compareLinearPolysaccharide(cPeaksList& sortedpeaklist clearFalseHits(series, parameters->fragmentionsfortheoreticalspectra); for (int i = 0; i < theoreticalpeaksrealsize; i++) { - if ((theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid != -1) && ((series.count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { + if (!theoreticalpeaks[i].isotope && (theoreticalpeaks[i].matched > 0) && (theoreticalpeaks[i].rotationid != -1) && ((series.count(parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent) == 0) || (series[parameters->fragmentdefinitions[theoreticalpeaks[i].iontype].parent][theoreticalpeaks[i].seriesid] == 0))) { experimentalpeakmatches[theoreticalpeaks[i].matchedid].erase(experimentalpeakmatches[theoreticalpeaks[i].matchedid].find(i)); experimentalpeaks[theoreticalpeaks[i].matchedid].matched--; @@ -1487,6 +1992,9 @@ int cTheoreticalSpectrum::compareLinearPolysaccharide(cPeaksList& sortedpeaklist } + removeUnmatchedMetalIsotopes(theoreticalpeaks, theoreticalpeaksrealsize, experimentalpeaks, experimentalpeakmatches); + + // fill annotations of peaks for (int i = 0; i < (int)experimentalpeaks.size(); i++) { for (set::iterator it = experimentalpeakmatches[i].begin(); it != experimentalpeakmatches[i].end(); ++it) { @@ -1495,7 +2003,9 @@ int cTheoreticalSpectrum::compareLinearPolysaccharide(cPeaksList& sortedpeaklist experimentalpeaks[i].description += ","; } experimentalpeaks[i].description += theoreticalpeaks[*it].description.substr(0,theoreticalpeaks[*it].description.find(':')); - theoreticalpeaks[*it].matchdescription += ", measured mass " + to_string((long double)experimentalpeaks[i].mzratio) + " matched with " + to_string((long double)ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio)) + " ppm error"; + theoreticalpeaks[*it].matchedmz = experimentalpeaks[i].mzratio; + theoreticalpeaks[*it].matchedintensity = experimentalpeaks[i].intensity; + theoreticalpeaks[*it].matchedppm = ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio); } // to do @@ -1533,22 +2043,78 @@ int cTheoreticalSpectrum::compareLinearPolysaccharide(cPeaksList& sortedpeaklist } -void cTheoreticalSpectrum::compareMSSpectrum(cParameters* parameters) { - experimentalpeaks = parameters->peaklist; - experimentalpeaks.sortbyMass(); - +void cTheoreticalSpectrum::generateMSSpectrum() { cPeak peak; cSummaryFormula formula; - theoreticalpeaks.resize((int)parameters->fragmentionsfortheoreticalspectra.size()*parameters->sequencedatabase.size()*abs(parameters->precursorcharge)); + string metalname; + regex rx; + + theoreticalpeaks.resize(((int)parameters->fragmentionsfortheoreticalspectra.size() + countIsotopesOfMetals(parameters)) * parameters->sequencedatabase.size() * abs(parameters->precursorcharge)); + int theoreticalpeaksrealsize = 0; + for (int i = 0; i < parameters->sequencedatabase.size(); i++) { + peak.clear(); + peak.isotope = false; + formula.clear(); formula.setFormula(parameters->sequencedatabase[i].getSummaryFormula()); for (int j = 0; j < (int)parameters->fragmentionsfortheoreticalspectra.size(); j++) { + parameters->precursorAdductHasLi = false; + parameters->precursorAdductHasMg = false; + parameters->precursorAdductHasK = false; + parameters->precursorAdductHasCa = false; + parameters->precursorAdductHasFe = false; + parameters->precursorAdductHasNi = false; + parameters->precursorAdductHasCu = false; + parameters->precursorAdductHasZn = false; + parameters->precursorAdductHasGa = false; + + metalname = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[j]].name; + + // to do - optimize performance + rx = "Li"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasLi = true; + } + rx = "Mg"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasMg = true; + } + rx = "K"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasK = true; + } + rx = "Ca"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasCa = true; + } + rx = "Fe"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasFe = true; + } + rx = "Ni"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasNi = true; + } + rx = "Cu"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasCu = true; + } + rx = "Zn"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasZn = true; + } + rx = "Ga"; + if (regex_search(metalname, rx)) { + parameters->precursorAdductHasGa = true; + } + for (int k = 0; k < abs(parameters->precursorcharge); k++) { + peak.mzratio = (double)parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[j]].multiplier*formula.getMass() + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[j]].massdifference; if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[j]].positive) { peak.mzratio += (double)k*Hplus; @@ -1565,19 +2131,30 @@ void cTheoreticalSpectrum::compareMSSpectrum(cParameters* parameters) { else { peak.description += "-"; } - //peak.description += " " + parameters->sequencedatabase[i].getName() + " (" + parameters->sequencedatabase[i].getSummaryFormula() + "): "; peak.description += " " + parameters->sequencedatabase[i].getNameWithReferenceAsHTMLString() + " (" + parameters->sequencedatabase[i].getSummaryFormula() + "): "; + + addPeakToList(peak, theoreticalpeaksrealsize); + addMetalPeaks(peak, theoreticalpeaksrealsize, k + 1, true); - theoreticalpeaks[(i*(int)parameters->fragmentionsfortheoreticalspectra.size() + j)*abs(parameters->precursorcharge) + k] = peak; } - + } + } - theoreticalpeaks.sortbyMass(); + + theoreticalpeaks.resize(theoreticalpeaksrealsize); +} + + +void cTheoreticalSpectrum::compareMSSpectrum(cPeaksList& peaklist) { + experimentalpeaks = peaklist; + experimentalpeaks.sortbyMass(); vector > experimentalpeakmatches; searchForPeakPairs(theoreticalpeaks, theoreticalpeaks.size(), experimentalpeaks, experimentalpeakmatches, parameters->fragmentmasserrortolerance); + removeUnmatchedMetalIsotopes(theoreticalpeaks, theoreticalpeaks.size(), experimentalpeaks, experimentalpeakmatches); + // fill annotations of peaks for (int i = 0; i < (int)experimentalpeaks.size(); i++) { for (set::iterator it = experimentalpeakmatches[i].begin(); it != experimentalpeakmatches[i].end(); ++it) { @@ -1586,11 +2163,25 @@ void cTheoreticalSpectrum::compareMSSpectrum(cParameters* parameters) { experimentalpeaks[i].description += ","; } experimentalpeaks[i].description += theoreticalpeaks[*it].description.substr(0,theoreticalpeaks[*it].description.rfind(':')); - theoreticalpeaks[*it].matchdescription += ", measured mass " + to_string((long double)experimentalpeaks[i].mzratio) + " matched with " + to_string((long double)ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio)) + " ppm error"; + theoreticalpeaks[*it].matchedmz = experimentalpeaks[i].mzratio; + theoreticalpeaks[*it].matchedintensity = experimentalpeaks[i].intensity; + theoreticalpeaks[*it].matchedppm = ppmError(experimentalpeaks[i].mzratio, theoreticalpeaks[*it].mzratio); } } computeStatistics(true); + + cPeaksList tmppeaklist = theoreticalpeaks; + theoreticalpeaks.clear(); + + // remove unmatched theoretical peaks to save memory + for (int i = 0; i < tmppeaklist.size(); i++) { + if (tmppeaklist[i].matchedmz > 0) { + theoreticalpeaks.add(tmppeaklist[i]); + } + } + + theoreticalpeaks.sortbyMass(); } @@ -1609,7 +2200,7 @@ int cTheoreticalSpectrum::getNumberOfScrambledPeaks() { } -int cTheoreticalSpectrum::getNumberOfMatchedPeaks(fragmentIonType iontype) const { +int cTheoreticalSpectrum::getNumberOfMatchedPeaks(eFragmentIonType iontype) const { return matchedions.at(iontype); } @@ -1624,138 +2215,26 @@ double cTheoreticalSpectrum::getRatioOfMatchedPeaks() { } -void cTheoreticalSpectrum::printMatch(ofstream& os, peptideType peptidetype) { - vector rotations; - - os << endl << "Peptide: " << candidate.getRealPeptideName() << endl; - - switch (peptidetype) - { - case linear: - case cyclic: - case linearpolysaccharide: - os << "Composition: " << candidate.getComposition(); - break; - case branched: - case lasso: - os << "Composition: " << candidate.getTComposition(); - break; - case other: - break; - default: - break; - } - - if (valid) { - os << " (valid)"; - } - os << endl; - - os << "Number of bricks: " << getNumberOfBricks(candidate.getComposition()) << endl << endl; - - if ((peptidetype == linear) || (peptidetype == linearpolysaccharide)) { - os << "Modifications: "; - os << candidate.getStartModifID() << " " << candidate.getEndModifID() << endl; - } - - if (peptidetype == branched) { - os << "Modifications: "; - os << candidate.getStartModifID() << " " << candidate.getMiddleModifID() << " " << candidate.getEndModifID() << endl; - } - - if (peptidetype == lasso) { - os << "Modifications: "; - os << candidate.getMiddleModifID() << endl; - } - - os << "Coverage by series:" << endl; - os << coveragebyseries << endl; - - switch (peptidetype) - { - case linear: - os << "Matched y-ions and b-ions: " << matchedions[y_ion] + matchedions[b_ion] << endl; - os << "Matched y-ions: " << matchedions[y_ion] << endl; - os << "Matched b-ions: " << matchedions[b_ion] << endl; - os << "Matched a-ions: " << matchedions[a_ion] << endl; - os << "Matched y*-ions: " << matchedions[y_ion_dehydrated] << endl; - os << "Matched b*-ions: " << matchedions[b_ion_dehydrated] << endl; - os << "Matched a*-ions: " << matchedions[a_ion_dehydrated] << endl; - os << "Matched yx-ions: " << matchedions[y_ion_deamidated] << endl; - os << "Matched bx-ions: " << matchedions[b_ion_deamidated] << endl; - os << "Matched ax-ions: " << matchedions[a_ion_deamidated] << endl; - break; - case cyclic: - os << "Matched b-ions: " << matchedions[b_ion] << endl; - os << "Matched a-ions: " << matchedions[a_ion] << endl; - os << "Matched b*-ions: " << matchedions[b_ion_dehydrated] << endl; - os << "Matched a*-ions: " << matchedions[a_ion_dehydrated] << endl; - os << "Matched bx-ions: " << matchedions[b_ion_deamidated] << endl; - os << "Matched ax-ions: " << matchedions[a_ion_deamidated] << endl; - os << "Matched b*x-ions: " << matchedions[b_ion_dehydrated_and_deamidated] << endl; - os << "Matched a*x-ions: " << matchedions[a_ion_dehydrated_and_deamidated] << endl; - os << "Matched b-ions and b*-ions: " << matchedions[b_ion] + matchedions[b_ion_dehydrated] << endl; - os << "Matched b-ions and bx-ions: " << matchedions[b_ion] + matchedions[b_ion_deamidated] << endl << endl; - break; - case branched: - os << "Matched y-ions and b-ions: " << matchedions[y_ion] + matchedions[b_ion] << endl; - os << "Matched y-ions: " << matchedions[y_ion] << endl; - os << "Matched b-ions: " << matchedions[b_ion] << endl; - os << "Matched a-ions: " << matchedions[a_ion] << endl; - os << "Matched y*-ions: " << matchedions[y_ion_dehydrated] << endl; - os << "Matched b*-ions: " << matchedions[b_ion_dehydrated] << endl; - os << "Matched a*-ions: " << matchedions[a_ion_dehydrated] << endl; - os << "Matched yx-ions: " << matchedions[y_ion_deamidated] << endl; - os << "Matched bx-ions: " << matchedions[b_ion_deamidated] << endl; - os << "Matched ax-ions: " << matchedions[a_ion_deamidated] << endl; - break; - case lasso: - os << "Matched y-ions and b-ions: " << matchedions[y_ion] + matchedions[b_ion] << endl; - os << "Matched y-ions: " << matchedions[y_ion] << endl; - os << "Matched b-ions: " << matchedions[b_ion] << endl; - os << "Matched a-ions: " << matchedions[a_ion] << endl; - os << "Matched y*-ions: " << matchedions[y_ion_dehydrated] << endl; - os << "Matched b*-ions: " << matchedions[b_ion_dehydrated] << endl; - os << "Matched a*-ions: " << matchedions[a_ion_dehydrated] << endl; - os << "Matched yx-ions: " << matchedions[y_ion_deamidated] << endl; - os << "Matched bx-ions: " << matchedions[b_ion_deamidated] << endl; - os << "Matched ax-ions: " << matchedions[a_ion_deamidated] << endl; - break; - case linearpolysaccharide: - break; - case other: - break; - default: - break; - } - - os << "Matched peaks: " << experimentalpeaksmatched << endl; - if (peptidetype == cyclic) { - os << "Scrambled peaks matched: " << scrambledpeaksmatched << endl; - } - os << "Total peaks: " << peakstested << endl; - os << "Sum of Relative Intensities: " << intensityweightedscore << endl; - os << "Ratio of matched peaks: " << experimentalpeaksmatchedratio*100.0f << "%" << endl << endl; - os << "Unmatched measured peaks:" << endl << unmatchedpeaks << endl << endl; - os << "Theoretical peaks:" << endl << theoreticalpeaks.print(); -} - - -void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, fragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, peptideType peptidetype, TRotationInfo* trotation) { +void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, eFragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, ePeptideType peptidetype, TRotationInfo* trotation, eResidueLossType leftresiduelosstype, bool hasfirstblockartificial) { cPeak peak; double tempratio; string tempdescription; peak.mzratio = parameters->fragmentdefinitions[fragmentiontype].massdifference; - if ((peptidetype == linear) || (peptidetype == linearpolysaccharide)) { + if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) +#if POLYKETIDE_SIDEROPHORES == 1 + || (peptidetype == linearpolyketide) +#endif + ) { peak.mzratio += searchedmodifications[candidate.getStartModifID()].massdifference; } - if ((peptidetype == branched) || (peptidetype == lasso)) { + if ((peptidetype == branched) || (peptidetype == branchcyclic)) { peak.mzratio += searchedmodifications[trotation->startmodifID].massdifference; } peak.iontype = fragmentiontype; peak.scrambled = false; + peak.isotope = false; switch (peptidetype) { @@ -1768,12 +2247,20 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea case branched: peak.rotationid = trotation->id; break; - case lasso: + case branchcyclic: peak.rotationid = rotationid*6 + trotation->id; // to do - potential bug break; case linearpolysaccharide: peak.rotationid = rotationid; break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + peak.rotationid = rotationid; + break; + case cyclicpolyketide: + peak.rotationid = rotationid; + break; +#endif case other: break; default: @@ -1784,7 +2271,7 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea peak.mzratio += bricksdatabase[intcomposition[i] - 1].getMass(); - if ((peptidetype == branched) || (peptidetype == lasso)) { + if ((peptidetype == branched) || (peptidetype == branchcyclic)) { if (i == trotation->middlebranchstart) { peak.mzratio += searchedmodifications[trotation->middlemodifID].massdifference; } @@ -1804,25 +2291,91 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea //} } +#if POLYKETIDE_SIDEROPHORES == 1 + if (peptidetype == linearpolyketide) { + if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { + continue; + } + + if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion) && (i % 2 == 1)) { + continue; + } + + if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1oh_ion) && (i % 2 == 1)) { + continue; + } + + if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2oh_ion) && (i % 2 == 0)) { + continue; + } + } + + if (peptidetype == cyclicpolyketide) { + + if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l0h_ion)) { // b+2H ion is generated instead of b-2H + continue; + } + + if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { + continue; + } + + if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion) && (i % 2 == 1)) { + continue; + } + + if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l0h_ion) && (i % 2 == 1)) { + continue; + } + + if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { // ok - even numbers of blocks => always b-ion + continue; + } + + if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion)) { // b-2H ion is generated instead of b+2H + continue; + } + } +#endif + peak.seriesid = i; if (writedescription) { peak.description = ""; +#if POLYKETIDE_SIDEROPHORES == 1 + if ((peptidetype == cyclic) || (peptidetype == cyclicpolyketide)) { +#else if (peptidetype == cyclic) { +#endif peak.description += to_string(splittingsites[rotationid].first + 1) + "-" + to_string(splittingsites[rotationid].second + 1) + "_"; } if (peptidetype == branched) { peak.description += to_string(peak.rotationid + 1) + "_"; } - if (peptidetype == lasso) { + if (peptidetype == branchcyclic) { peak.description += to_string(splittingsites[rotationid].first + 1) + "-" + to_string(splittingsites[rotationid].second + 1) + "_"; peak.description += to_string(trotation->id + 1) + "_"; } - peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(0, 1) + to_string(i + 1); - if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 1) { - peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(1, parameters->fragmentdefinitions[fragmentiontype].name.length() - 1); + +#if POLYKETIDE_SIDEROPHORES == 1 + if ((peptidetype == linearpolyketide) || (peptidetype == cyclicpolyketide)) { + peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(0, 2) + to_string(i + 1); + if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 2) { + peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(2, parameters->fragmentdefinitions[fragmentiontype].name.length() - 2); + } + } + else { +#endif + peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(0, 1) + to_string(i + 1); + if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 1) { + peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(1, parameters->fragmentdefinitions[fragmentiontype].name.length() - 1); + } +#if POLYKETIDE_SIDEROPHORES == 1 } +#endif + + addAdductToDescription(peak.description); peak.description += ": "; for (int j = 0; j <= i; j++) { peak.description += "[" + bricksdatabase[intcomposition[j] - 1].getAcronymsAsString() + "]"; @@ -1852,13 +2405,8 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea } } - if (theoreticalpeaks.size() > peaklistrealsize) { - theoreticalpeaks[peaklistrealsize] = peak; - } - else { - theoreticalpeaks.add(peak); - } - peaklistrealsize++; + addPeakToList(peak, peaklistrealsize); + addMetalPeaks(peak, peaklistrealsize, j, writedescription); } peak.mzratio = tempratio; @@ -1873,21 +2421,26 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea } -void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, fragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, peptideType peptidetype, TRotationInfo* trotation) { +void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, eFragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, ePeptideType peptidetype, TRotationInfo* trotation, eResidueLossType rightresiduelosstype, bool haslastblockartificial) { cPeak peak; double tempratio; string tempdescription; peak.mzratio = parameters->fragmentdefinitions[fragmentiontype].massdifference; - if ((peptidetype == linear) || (peptidetype == linearpolysaccharide)) { + if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) +#if POLYKETIDE_SIDEROPHORES == 1 + || (peptidetype == linearpolyketide) +#endif + ) { peak.mzratio += searchedmodifications[candidate.getEndModifID()].massdifference; } - if ((peptidetype == branched) || (peptidetype == lasso)) { + if ((peptidetype == branched) || (peptidetype == branchcyclic)) { peak.mzratio += searchedmodifications[trotation->endmodifID].massdifference; } peak.iontype = fragmentiontype; peak.scrambled = false; + peak.isotope = false; switch (peptidetype) { @@ -1900,9 +2453,17 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea case branched: peak.rotationid = trotation->id; break; - case lasso: + case branchcyclic: peak.rotationid = rotationid*6 + trotation->id; // to do - potential bug break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + peak.rotationid = rotationid; + break; + case cyclicpolyketide: + peak.rotationid = rotationid; + break; +#endif case linearpolysaccharide: peak.rotationid = rotationid; break; @@ -1912,10 +2473,12 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea break; } + int order = -1; for (int i = (int)intcomposition.size() - 1; i > 0; i--) { peak.mzratio += bricksdatabase[intcomposition[i] - 1].getMass(); + order++; - if ((peptidetype == branched) || (peptidetype == lasso)) { + if ((peptidetype == branched) || (peptidetype == branchcyclic)) { if (i == trotation->middlebranchend) { peak.mzratio += searchedmodifications[trotation->middlemodifID].massdifference; } @@ -1935,26 +2498,65 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea //} } +#if POLYKETIDE_SIDEROPHORES == 1 + if (peptidetype == linearpolyketide) { + if (!haslastblockartificial && (rightresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == r1h_ion) && (order % 2 == 0)) { + continue; + } + + if (!haslastblockartificial && (rightresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == r2h_ion) && (order % 2 == 1)) { + continue; + } + + if (!haslastblockartificial && (rightresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == r1oh_ion) && (order % 2 == 1)) { + continue; + } + + if (!haslastblockartificial && (rightresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == r2oh_ion) && (order % 2 == 0)) { + continue; + } + } +#endif + peak.seriesid = (int)intcomposition.size() - i - 1; if (writedescription) { peak.description = ""; +#if POLYKETIDE_SIDEROPHORES == 1 + if (peptidetype == cyclicpolyketide) { + peak.description += to_string(splittingsites[rotationid].first + 1) + "-" + to_string(splittingsites[rotationid].second + 1) + "_"; + } +#endif //if (peptidetype == cyclic) { - // peak.description += to_string(splittingsites[rotationid].first + 1) + "-" + to_string(splittingsites[rotationid].second + 1); // +"_"; + // peak.description += to_string(splittingsites[rotationid].first + 1) + "-" + to_string(splittingsites[rotationid].second + 1) + "_"; //} if (peptidetype == branched) { peak.description += to_string(peak.rotationid + 1) + "_"; } - if (peptidetype == lasso) { + if (peptidetype == branchcyclic) { peak.description += to_string(splittingsites[rotationid].first + 1) + "-" + to_string(splittingsites[rotationid].second + 1) + "_"; peak.description += to_string(trotation->id + 1) + "_"; } - peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(0, 1) + to_string((int)intcomposition.size() - i); - - if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 1) { - peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(1, parameters->fragmentdefinitions[fragmentiontype].name.length() - 1); + +#if POLYKETIDE_SIDEROPHORES == 1 + if ((peptidetype == linearpolyketide) || (peptidetype == cyclicpolyketide)) { + peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(0, 2) + to_string((int)intcomposition.size() - i); + if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 2) { + peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(2, parameters->fragmentdefinitions[fragmentiontype].name.length() - 2); + } + } + else { +#endif + peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(0, 1) + to_string((int)intcomposition.size() - i); + if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 1) { + peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(1, parameters->fragmentdefinitions[fragmentiontype].name.length() - 1); + } +#if POLYKETIDE_SIDEROPHORES == 1 } +#endif + + addAdductToDescription(peak.description); peak.description += ": "; for (int j = (int)intcomposition.size() - 1; j >= i; j--) { peak.description += "[" + bricksdatabase[intcomposition[j] - 1].getAcronymsAsString() + "]"; @@ -1983,14 +2585,9 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea peak.description = to_string(j) + "- " + tempdescription; } } - - if (theoreticalpeaks.size() > peaklistrealsize) { - theoreticalpeaks[peaklistrealsize] = peak; - } - else { - theoreticalpeaks.add(peak); - } - peaklistrealsize++; + + addPeakToList(peak, peaklistrealsize); + addMetalPeaks(peak, peaklistrealsize, j, writedescription); } peak.mzratio = tempratio; @@ -2040,8 +2637,8 @@ string cTheoreticalSpectrum::getCoverageBySeries() { } -string cTheoreticalSpectrum::getUnmatchedPeaks() { - return unmatchedpeaks; +cPeaksList* cTheoreticalSpectrum::getUnmatchedPeaks() { + return &unmatchedpeaks; } @@ -2102,15 +2699,15 @@ void cTheoreticalSpectrum::store(ofstream& os) { size = (int)matchedions.size(); os.write((char *)&size, sizeof(int)); - for (map::iterator it = matchedions.begin(); it != matchedions.end(); ++it) { - os.write((char *)&it->first, sizeof(fragmentIonType)); + for (map::iterator it = matchedions.begin(); it != matchedions.end(); ++it) { + os.write((char *)&it->first, sizeof(eFragmentIonType)); os.write((char *)&it->second, sizeof(int)); } os.write((char *)&peakstested, sizeof(int)); os.write((char *)&experimentalpeaksmatchedratio, sizeof(double)); - storeString(unmatchedpeaks, os); + unmatchedpeaks.store(os); storeString(coveragebyseries, os); os.write((char *)&valid, sizeof(bool)); @@ -2131,7 +2728,7 @@ void cTheoreticalSpectrum::store(ofstream& os) { void cTheoreticalSpectrum::load(ifstream& is) { int size; - fragmentIonType iontype; + eFragmentIonType iontype; int number; parameters = 0; @@ -2146,7 +2743,7 @@ void cTheoreticalSpectrum::load(ifstream& is) { is.read((char *)&size, sizeof(int)); matchedions.clear(); for (int i = 0; i < size; i++) { - is.read((char *)&iontype, sizeof(fragmentIonType)); + is.read((char *)&iontype, sizeof(eFragmentIonType)); is.read((char *)&number, sizeof(int)); matchedions[iontype] = number; } @@ -2154,7 +2751,7 @@ void cTheoreticalSpectrum::load(ifstream& is) { is.read((char *)&peakstested, sizeof(int)); is.read((char *)&experimentalpeaksmatchedratio, sizeof(double)); - loadString(unmatchedpeaks, is); + unmatchedpeaks.load(is); loadString(coveragebyseries, is); is.read((char *)&valid, sizeof(bool)); diff --git a/CycloBranch/core/cTheoreticalSpectrum.h b/CycloBranch/core/cTheoreticalSpectrum.h index 3f69e6e..20ae222 100644 --- a/CycloBranch/core/cTheoreticalSpectrum.h +++ b/CycloBranch/core/cTheoreticalSpectrum.h @@ -14,7 +14,7 @@ #include #include "core/cParameters.h" -#include "core/cPeaksList.h" +#include "core/cPeakListSeries.h" #include "core/cCandidateSet.h" class cMainThread; @@ -34,11 +34,13 @@ struct splitSite { */ int first; + /** \brief Order of the second amino acid where a cyclic peptide is split. */ int second; + splitSite() { first = 0; second = 0; @@ -99,10 +101,10 @@ class cTheoreticalSpectrum { cCandidate candidate; int experimentalpeaksmatched; int scrambledpeaksmatched; - map matchedions; + map matchedions; int peakstested; double experimentalpeaksmatchedratio; - string unmatchedpeaks; + cPeaksList unmatchedpeaks; string coveragebyseries; bool valid; double intensityweightedscore; @@ -113,7 +115,7 @@ class cTheoreticalSpectrum { int seriescompleted; // remove false hits, i.e., b-H2O without existing b-ion - void clearFalseHits(map >& series, vector& fragmentions); + void clearFalseHits(map >& series, vector& fragmentions); // search for matches of experimental and theoretical peaks void searchForPeakPairs(cPeaksList& theoreticalpeaks, int theoreticalpeaksrealsize, cPeaksList& experimentalpeaks, vector >& experimentalpeakmatches, double fragmentmasserrortolerance); @@ -131,7 +133,23 @@ class cTheoreticalSpectrum { void selectAndNormalizeScrambledSequences(unordered_set& scrambledsequences); // select a proper fragment ion type for an experimental peak when masses of more theoretical fragment ions collide - fragmentIonType selectHigherPriorityIonTypeCID(fragmentIonType experimentalpeakiontype, fragmentIonType theoreticalpeakiontype); + eFragmentIonType selectHigherPriorityIonTypeCID(eFragmentIonType experimentalpeakiontype, eFragmentIonType theoreticalpeakiontype); + + // add a peak to the list + void addPeakToList(cPeak& peak, int& theoreticalpeaksrealsize); + + // add an adduct to a peak description + void addAdductToDescription(string& description); + + // count isotopes of metals + int countIsotopesOfMetals(cParameters* parameters); + + // add theoretical peaks containing metals + void addMetalPeaks(cPeak& peak, int& peaklistrealsize, int charge, bool writedescription); + + // remove unmatched biometal isotopes + void removeUnmatchedMetalIsotopes(cPeaksList& theoreticalpeaks, int theoreticalpeaksrealsize, cPeaksList& experimentalpeaks, vector >& experimentalpeakmatches); + public: @@ -180,7 +198,7 @@ class cTheoreticalSpectrum { /** \brief Compare the theoretical spectrum of a branched peptide with an experimental spectrum. - \param sortedpeaklist reference to a peak list of an experimental spectrum + \param sortedpeaklist reference to an experimental peaklist \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks \param writedescription if true then string descriptions of peaks are filled \param sequencetag reference to a regex of a sequence tag @@ -192,7 +210,7 @@ class cTheoreticalSpectrum { /** \brief Compare the theoretical spectrum of a linear peptide with an experimental spectrum. - \param sortedpeaklist reference to a peak list of an experimental spectrum + \param sortedpeaklist reference to an experimental peaklist \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks \param writedescription if true then string descriptions of peaks are filled \param sequencetag reference to a regex of a sequence tag @@ -204,7 +222,7 @@ class cTheoreticalSpectrum { /** \brief Compare the theoretical spectrum of a cyclic peptide with an experimental spectrum. - \param sortedpeaklist reference to a peak list of an experimental spectrum + \param sortedpeaklist reference to an experimental peaklist \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks \param writedescription if true then string descriptions of peaks are filled \param sequencetag reference to a regex of a sequence tag @@ -216,19 +234,49 @@ class cTheoreticalSpectrum { /** \brief Compare the theoretical spectrum of a branch-cyclic peptide with an experimental spectrum. - \param sortedpeaklist reference to a peak list of an experimental spectrum + \param sortedpeaklist reference to an experimental peaklist \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks \param writedescription if true then string descriptions of peaks are filled \param sequencetag reference to a regex of a sequence tag \param searchedsequence reference to a regex of a searched sequence \retval int number theoretical peaks generated; -2 when the sequence tag does not match the peptide sequence candidate */ - int compareLasso(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); + int compareBranchCyclic(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); + + +#if POLYKETIDE_SIDEROPHORES == 1 + + + /** + \brief Compare the theoretical spectrum of a linear polyketide siderophore with an experimental spectrum. + \param sortedpeaklist reference to an experimental peaklist + \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks + \param writedescription if true then string descriptions of peaks are filled + \param sequencetag reference to a regex of a sequence tag + \param searchedsequence reference to a regex of a searched sequence + \retval int number theoretical peaks generated; -2 when the sequence tag does not match the peptide sequence candidate + */ + int compareLinearPolyketideSiderophore(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); + + + /** + \brief Compare the theoretical spectrum of a cyclic polyketide siderophore with an experimental spectrum. + \param sortedpeaklist reference to an experimental peaklist + \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks + \param writedescription if true then string descriptions of peaks are filled + \param sequencetag reference to a regex of a sequence tag + \param searchedsequence reference to a regex of a searched sequence + \retval int number theoretical peaks generated; -2 when the sequence tag does not match the peptide sequence candidate + */ + int compareCyclicPolyketideSiderophore(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); + + +#endif /** \brief Compare the theoretical spectrum of a linear polysaccharide with an experimental spectrum. - \param sortedpeaklist reference to a peak list of an experimental spectrum + \param sortedpeaklist reference to an experimental peaklist \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks \param writedescription if true then string descriptions of peaks are filled \param sequencetag reference to a regex of a sequence tag @@ -240,9 +288,15 @@ class cTheoreticalSpectrum { /** \brief Compare theoretical peaks with an experimental spectrum. - \param parameters a pointer to the parameters of the application */ - void compareMSSpectrum(cParameters* parameters); + void generateMSSpectrum(); + + + /** + \brief Compare theoretical peaks with an experimental spectrum. + \param peaklist reference to an experimental peaklist + */ + void compareMSSpectrum(cPeaksList& peaklist); /** @@ -264,7 +318,7 @@ class cTheoreticalSpectrum { \param iontype a fragment ion type \retval int number of matched peaks */ - int getNumberOfMatchedPeaks(fragmentIonType iontype) const; + int getNumberOfMatchedPeaks(eFragmentIonType iontype) const; /** @@ -281,14 +335,6 @@ class cTheoreticalSpectrum { double getRatioOfMatchedPeaks(); - /** - \brief Print a peptide-spectrum match into a stream. - \param os reference to an ouput stream - \param peptidetype the type of peptide corresponding to the experimental spectrum - */ - void printMatch(ofstream& os, peptideType peptidetype); - - /** \brief Generate a N-terminal fragment ion series. \param maxcharge a charge of precursor ion @@ -302,8 +348,10 @@ class cTheoreticalSpectrum { \param searchedmodifications reference to a vector of searched modifications \param peptidetype the type of searched peptide \param trotation a pointer to a T-permutation of a branched peptide + \param leftresiduelosstype a residue type of the leftmost building block + \param hasfirstblockartificial true when the first block is artificial, false otherwise */ - void generateNTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, fragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, peptideType peptidetype, TRotationInfo* trotation = 0); + void generateNTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, eFragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, ePeptideType peptidetype, TRotationInfo* trotation = 0, eResidueLossType leftresiduelosstype = water, bool hasfirstblockartificial = false); /** @@ -319,8 +367,10 @@ class cTheoreticalSpectrum { \param searchedmodifications reference to a vector of searched modifications \param peptidetype the type of searched peptide \param trotation a pointer to a T-permutation of a branched peptide + \param rightresiduelosstype a residue type of the rightmost building block + \param haslastblockartificial true when the last block is artificial, false otherwise */ - void generateCTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, fragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, peptideType peptidetype, TRotationInfo* trotation = 0); + void generateCTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, eFragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, ePeptideType peptidetype, TRotationInfo* trotation = 0, eResidueLossType rightresiduelosstype = water, bool haslastblockartificial = false); /** @@ -375,15 +425,15 @@ class cTheoreticalSpectrum { /** - \brief Get list of unmatched peaks. - \retval string list of unmatched peaks + \brief Get a list of unmatched peaks. + \retval cPeaksList a pointer to a list of unmatched peaks */ - string getUnmatchedPeaks(); + cPeaksList* getUnmatchedPeaks(); /** - \brief Access to the list of theoretical peaks. - \retval cPeaksList pointer to a list of theoretical peaks + \brief Get a list of theoretical peaks. + \retval cPeaksList a pointer to a list of theoretical peaks */ cPeaksList* getTheoreticalPeaks(); diff --git a/CycloBranch/core/cTheoreticalSpectrumList.cpp b/CycloBranch/core/cTheoreticalSpectrumList.cpp index 1addb34..e6dccaf 100644 --- a/CycloBranch/core/cTheoreticalSpectrumList.cpp +++ b/CycloBranch/core/cTheoreticalSpectrumList.cpp @@ -89,7 +89,7 @@ cTheoreticalSpectrum& cTheoreticalSpectrumList::operator[](int position) { int cTheoreticalSpectrumList::parallelCompareAndStore(cCandidateSet& candidates, bool& terminatecomputation) { - cPeaksList peaklist = parameters->peaklist; + cPeaksList peaklist = parameters->peaklistseries[0]; peaklist.sortbyMass(); cCandidateSet permutations; theoreticalspectra.clear(); @@ -253,9 +253,17 @@ int cTheoreticalSpectrumList::parallelCompareAndStore(cCandidateSet& candidates, case branched: theoreticalpeaksrealsize = tsp.compareBranched(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); break; - case lasso: - theoreticalpeaksrealsize = tsp.compareLasso(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); + case branchcyclic: + theoreticalpeaksrealsize = tsp.compareBranchCyclic(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + theoreticalpeaksrealsize = tsp.compareLinearPolyketideSiderophore(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); + break; + case cyclicpolyketide: + theoreticalpeaksrealsize = tsp.compareCyclicPolyketideSiderophore(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); + break; +#endif case linearpolysaccharide: theoreticalpeaksrealsize = tsp.compareLinearPolysaccharide(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); break; @@ -282,7 +290,7 @@ int cTheoreticalSpectrumList::parallelCompareAndStore(cCandidateSet& candidates, theoreticalspectra[i].getCandidate().setRealPeptideName(*bricksdb, parameters->peptidetype); theoreticalspectra[i].getCandidate().setAcronymPeptideNameWithHTMLReferences(*bricksdb, parameters->peptidetype); theoreticalspectra[i].getCandidate().setAcronyms(*bricksdb); - if ((parameters->peptidetype == branched) || (parameters->peptidetype == lasso)) { + if ((parameters->peptidetype == branched) || (parameters->peptidetype == branchcyclic)) { theoreticalspectra[i].getCandidate().setBackboneAcronyms(*bricksdb); theoreticalspectra[i].getCandidate().setBranchAcronyms(*bricksdb); } @@ -298,16 +306,6 @@ int cTheoreticalSpectrumList::parallelCompareAndStore(cCandidateSet& candidates, } -void cTheoreticalSpectrumList::printPeptideSpectrumMatches(ofstream& os, int limit, peptideType peptidetype) { - int count = min(limit, (int)theoreticalspectra.size()); - for (int i = 0; i < count; i++) { - os << "--------------------------------------------------------------------------------" << endl; - os << "Peptide-Spectrum Match no. " << i+1 << endl; - theoreticalspectra[i].printMatch(os, peptidetype); - } -} - - void cTheoreticalSpectrumList::addButDoNotFitSize(cTheoreticalSpectrum& theoreticalspectrum, int theoreticalpeaksrealsize) { QMutexLocker ml(&mutex); diff --git a/CycloBranch/core/cTheoreticalSpectrumList.h b/CycloBranch/core/cTheoreticalSpectrumList.h index f0129ab..8d2cba5 100644 --- a/CycloBranch/core/cTheoreticalSpectrumList.h +++ b/CycloBranch/core/cTheoreticalSpectrumList.h @@ -92,14 +92,6 @@ class cTheoreticalSpectrumList { int parallelCompareAndStore(cCandidateSet& candidates, bool& terminatecomputation); - /** - \brief Print peptide spectrum matches into a stream. - \param os reference to the main thread of the application (output stream) - \param limit a number of peptide spectrum matches printed - \param peptidetype the type of peptide corresponding to the experimental spectrum - */ - void printPeptideSpectrumMatches(ofstream& os, int limit, peptideType peptidetype); - /** \brief Add a new spectrum to the list when the number cParameters::hitsreported has not been exceeded or when it has been exceeded but the score of the newly added spectrum is better than the worst score of a peptide in the list (thread-safe). diff --git a/CycloBranch/core/utilities.cpp b/CycloBranch/core/utilities.cpp index 73d9619..2b464ca 100644 --- a/CycloBranch/core/utilities.cpp +++ b/CycloBranch/core/utilities.cpp @@ -4,7 +4,8 @@ QString appname = "CycloBranch"; -QString appversion = "v. 1.0.1216 (64-bit)"; +QString appversion = "v. 1.0.1512 (64-bit)"; + #if OS_TYPE == UNX QString installdir = "/usr/share/cyclobranch/"; @@ -60,7 +61,7 @@ string& removeWhiteSpacesExceptSpaces(string& s) { } -bool checkRegex(peptideType peptidetype, string& sequence, string& errormessage) { +bool checkRegex(ePeptideType peptidetype, string& sequence, string& errormessage) { errormessage = ""; if (sequence.compare("") == 0) { @@ -74,15 +75,21 @@ bool checkRegex(peptideType peptidetype, string& sequence, string& errormessage) { case linear: case linearpolysaccharide: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*$"; break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+$"; break; case branched: rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*\\\\\\(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+\\\\\\)\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*$"; break; - case lasso: + case branchcyclic: rx = "(^(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*)?\\\\\\(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+\\\\\\)\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*$|^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*\\\\\\(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+\\\\\\)(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*)?$)"; break; case other: @@ -106,13 +113,13 @@ bool checkRegex(peptideType peptidetype, string& sequence, string& errormessage) } -void parseBranch(peptideType peptidetype, string& composition, vector& vectorcomposition, int& branchstart, int& branchend) { +void parseBranch(ePeptideType peptidetype, string& composition, vector& vectorcomposition, int& branchstart, int& branchend) { string s = composition; cBrick b; branchstart = -1; branchend = -1; - if ((peptidetype == branched) || (peptidetype == lasso)) { + if ((peptidetype == branched) || (peptidetype == branchcyclic)) { int i = 0; while (i < (int)s.size()) { if (s[i] == '\\') { @@ -166,7 +173,7 @@ void parseBranch(peptideType peptidetype, string& composition, vector& v } -peptideType getPeptideTypeFromString(string s) { +ePeptideType getPeptideTypeFromString(string& s) { if (s.compare("linear") == 0) { return linear; } @@ -177,9 +184,17 @@ peptideType getPeptideTypeFromString(string s) { return branched; } if (s.compare("branch-cyclic") == 0) { - return lasso; + return branchcyclic; } - if (s.compare("linearpolysaccharide") == 0) { +#if POLYKETIDE_SIDEROPHORES == 1 + if (s.compare("linear-oligoketide-siderophore") == 0) { + return linearpolyketide; + } + if (s.compare("cyclic-oligoketide-siderophore") == 0) { + return cyclicpolyketide; + } +#endif + if (s.compare("linear-polysaccharide") == 0) { return linearpolysaccharide; } if (s.compare("other") == 0) { @@ -190,7 +205,7 @@ peptideType getPeptideTypeFromString(string s) { } -string getStringFromPeptideType(peptideType peptidetype) { +string getStringFromPeptideType(ePeptideType peptidetype) { switch (peptidetype) { case linear: @@ -202,11 +217,19 @@ string getStringFromPeptideType(peptideType peptidetype) { case branched: return "branched"; break; - case lasso: + case branchcyclic: return "branch-cyclic"; break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + return "linear-oligoketide-siderophore"; + break; + case cyclicpolyketide: + return "cyclic-oligoketide-siderophore"; + break; +#endif case linearpolysaccharide: - return "linearpolysaccharide"; + return "linear-polysaccharide"; break; case other: return "other"; @@ -218,3 +241,12 @@ string getStringFromPeptideType(peptideType peptidetype) { return "other"; } + +double cropPrecisionToSixDecimals(double value) { + char buffer[50]; + double val; + sprintf_s(buffer, "%.6f\0", value); + sscanf_s(buffer, "%lf", &val); + return val; +} + diff --git a/CycloBranch/core/utilities.h b/CycloBranch/core/utilities.h index daf0cdc..986e584 100644 --- a/CycloBranch/core/utilities.h +++ b/CycloBranch/core/utilities.h @@ -36,6 +36,9 @@ class cBrick; #endif +#define POLYKETIDE_SIDEROPHORES 1 + + using namespace std; using namespace boost; @@ -43,13 +46,20 @@ using namespace boost; /** \brief The types of peptides supported by the application. */ -enum peptideType { +enum ePeptideType { linear = 0, cyclic = 1, branched = 2, - lasso = 3, + branchcyclic = 3, +#if POLYKETIDE_SIDEROPHORES == 1 + linearpolyketide = 4, + cyclicpolyketide = 5, + linearpolysaccharide = 6, + other = 7 +#else linearpolysaccharide = 4, other = 5 +#endif }; @@ -126,7 +136,7 @@ string& removeWhiteSpacesExceptSpaces(string& s); \param errormessage an error message if false is returned \retval bool true when the syntax is correct, false otherwise */ -bool checkRegex(peptideType peptidetype, string& sequence, string& errormessage); +bool checkRegex(ePeptideType peptidetype, string& sequence, string& errormessage); /** @@ -137,15 +147,15 @@ bool checkRegex(peptideType peptidetype, string& sequence, string& errormessage) \param branchstart start position of a branch (an output value) \param branchend end position of a branch (an output value) */ -void parseBranch(peptideType peptidetype, string& composition, vector& vectorcomposition, int& branchstart, int& branchend); +void parseBranch(ePeptideType peptidetype, string& composition, vector& vectorcomposition, int& branchstart, int& branchend); /** \brief Convert a string to peptide type. \param s string - \retval peptideType type of peptide + \retval ePeptideType type of peptide */ -peptideType getPeptideTypeFromString(string s); +ePeptideType getPeptideTypeFromString(string& s); /** @@ -153,7 +163,15 @@ peptideType getPeptideTypeFromString(string s); \param peptidetype type of peptide \retval string string */ -string getStringFromPeptideType(peptideType peptidetype); +string getStringFromPeptideType(ePeptideType peptidetype); + + +/** + \brief Crop a precision of a double to six decimal places. + \param value an input value + \retval double a value with the limited precision +*/ +double cropPrecisionToSixDecimals(double value); #endif diff --git a/CycloBranch/gui/cAboutWidget.cpp b/CycloBranch/gui/cAboutWidget.cpp index 3f354a6..8a0226f 100644 --- a/CycloBranch/gui/cAboutWidget.cpp +++ b/CycloBranch/gui/cAboutWidget.cpp @@ -16,13 +16,19 @@ cAboutWidget::cAboutWidget(QWidget* parent) { layout = new QVBoxLayout(); - QString title = "A tool for de novo sequencing of nonribosomal peptides from accurate product ion mass spectra.


"; + QString homepage = "Homepage: http://ms.biomed.cas.cz/cyclobranch/

"; + + QString citation = "If you use CycloBranch in your work, please, cite us using the following publication:

"; + citation += "Jiri Novak, Karel Lemr, Kevin A. Schug and Vladimir Havlicek.
"; + citation += "CycloBranch: De Novo Sequencing of Nonribosomal Peptides from Accurate Product Ion Mass Spectra.
"; + citation += "J. Am. Soc. Mass Spectrom., vol. 26, no. 10, pp. 1780-1786, 2015. DOI: 10.1007/s13361-015-1211-1.
"; + citation += "Download citation: [ ris ], [ bib ]



"; QString licence = "Licence:

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

"; licence += "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

"; licence += "You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.


"; - QString developers = "Developers:

Jiri Novak
Laboratory of Molecular Structure Characterization
Institute of Microbiology
Academy of Sciences of the Czech Republic
Videnska 1083
142 20 Prague
Czech Republic
jiri.novak@biomed.cas.cz
http://ms.biomed.cas.cz/cyclobranch/
http://ms.biomed.cas.cz/staff-novak_jiri.php
https://cas-cz.academia.edu/JiriNovak

(C) 2013 - 2015


"; + QString developers = "Developers:

Jiri Novak
Laboratory of Molecular Structure Characterization
Institute of Microbiology
Academy of Sciences of the Czech Republic
Videnska 1083
142 20 Prague
Czech Republic
jiri.novak@biomed.cas.cz
http://ms.biomed.cas.cz/staff-novak_jiri.php
https://cas-cz.academia.edu/JiriNovak

(C) 2013 - 2015


"; QString splash = "



"; @@ -32,7 +38,7 @@ cAboutWidget::cAboutWidget(QWidget* parent) { message->setReadOnly(true); message->setAcceptRichText(true); message->setOpenExternalLinks(true); - message->setHtml("
" + splash + "" + appname + " " + appversion + "

" + title + developers + licence + acknowledgement); + message->setHtml("
" + splash + "" + appname + " " + appversion + "

" + homepage + citation + developers + licence + acknowledgement); buttonbox = new QDialogButtonBox(QDialogButtonBox::Ok); //buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); diff --git a/CycloBranch/gui/cBranchCyclicWidget.cpp b/CycloBranch/gui/cBranchCyclicWidget.cpp new file mode 100644 index 0000000..3214dc6 --- /dev/null +++ b/CycloBranch/gui/cBranchCyclicWidget.cpp @@ -0,0 +1,362 @@ +#include "gui/cBranchCyclicWidget.h" + +#include +#include +#include +#include +#include +#include +#include + + +void generateBranchLabelsDown(bool nterminal, int rotationid, unordered_set& labels, cParameters* parameters, cTheoreticalSpectrum* theoreticalspectrum, int centerx, int topmargin, int horizontalstep, int verticalstep, int visiblerotationid, int branchstart) { + string name; + int j; + if ((visiblerotationid == -1) || (visiblerotationid == rotationid/6)) { + for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { + if ((nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) || (!nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal)) { + j = 0; + while (j < branchstart) { + if (theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].series[j] > 0) { + name = theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.substr(0, theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.rfind('_') + 1); + name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); + insertLabel(labels, centerx + 25, topmargin + verticalstep*j + verticalstep/2 - verticalstep/8, name, false); + } + j++; + } + } + } + } +} + + +void generateBranchLabelsUp(bool nterminal, int rotationid, unordered_set& labels, cParameters* parameters, cTheoreticalSpectrum* theoreticalspectrum, int centerx, int topmargin, int horizontalstep, int verticalstep, int visiblerotationid, int branchend) { + string name; + int j; + int count; + if ((visiblerotationid == -1) || (visiblerotationid == rotationid/6)) { + for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { + if ((nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) || (!nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal)) { + j = 0; + count = (int)theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].series.size() - branchend; + while (j < count) { + if (theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].series[j + branchend] > 0) { + name = theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.substr(0, theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.rfind('_') + 1); + name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + branchend + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); + insertLabel(labels, centerx - 25, topmargin + verticalstep*(count - j - 1) + verticalstep/2, name, true); + } + j++; + } + } + } + } +} + + +cBranchCyclicWidget::cBranchCyclicWidget() { + parameters = 0; + theoreticalspectrum = 0; + visiblerotationid = -1; + visibletrotationid = -1; +} + + +void cBranchCyclicWidget::initialize(cParameters* parameters, cTheoreticalSpectrum* theoreticalspectrum) { + this->parameters = parameters; + this->theoreticalspectrum = theoreticalspectrum; +} + + +void cBranchCyclicWidget::exportToPDF(QString filename, bool postscript) { + QPrinter printer; + if (postscript) { + printer.setPaperSize(QSizeF(width() + 100, height() + 100), QPrinter::DevicePixel); + printer.setPageMargins (50, 50, 50, 50, QPrinter::DevicePixel); + } + else { + printer.setPaperSize(QSizeF(width(), height()), QPrinter::DevicePixel); + printer.setPageMargins (0, 0, 0, 0, QPrinter::DevicePixel); + } + printer.setOutputFormat(QPrinter::NativeFormat); + printer.setOutputFileName(filename); + + QPainter painter; + if (!painter.begin(&printer)) { + QMessageBox msgBox; + QString errstr = "The file cannot be created."; + #if OS_TYPE == UNX + errstr += "\nDo you have a properly configured print server (sudo apt-get install cups-pdf) ?"; + #endif + msgBox.setText(errstr); + msgBox.exec(); + return; + } + + painter.setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing|QPainter::SmoothPixmapTransform); + paint(painter); + painter.end(); +} + + +void cBranchCyclicWidget::exportToPNG(QString filename) { + QImage image(width(), height(), QImage::Format_ARGB32); + image.fill(Qt::white); + + QPainter painter; + if (!painter.begin(&image)) { + QMessageBox msgBox; + QString errstr = "The file cannot be created."; + msgBox.setText(errstr); + msgBox.exec(); + return; + } + + painter.setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing|QPainter::SmoothPixmapTransform); + paint(painter); + painter.end(); + image.save(filename); +} + + +void cBranchCyclicWidget::exportToSVG(QString filename) { + QSvgGenerator generator; + generator.setFileName(filename); + generator.setSize(QSize(width(), height())); + generator.setViewBox(QRect(0, 0, width(), height())); + + QPainter painter; + if (!painter.begin(&generator)) { + QMessageBox msgBox; + QString errstr = "The file cannot be created."; + msgBox.setText(errstr); + msgBox.exec(); + return; + } + + painter.fillRect(QRect(0, 0, width(), height()), Qt::white); + paint(painter); + painter.end(); +} + + +void cBranchCyclicWidget::paintEvent(QPaintEvent *event) { + QPainter painter; + painter.begin(this); + paint(painter); + painter.end(); +} + + +void cBranchCyclicWidget::paint(QPainter& painter) { + + if (!theoreticalspectrum) { + return; + } + + vector backboneacronyms; + vector branchacronyms; + backboneacronyms = theoreticalspectrum->getCandidate().getBackboneAcronyms(); + branchacronyms = theoreticalspectrum->getCandidate().getBranchAcronyms(); + + const int topmargin = 20; + const int leftmargin = 20; + const int bottommargin = 80; + const int rightmargin = 20; + + int backbonesize = (int)backboneacronyms.size(); + int branchsize = (int)branchacronyms.size(); + + if (branchsize < 1) { + return; + } + + double angle = 2*pi/(double)backbonesize; + int centerx = width()/2; + int centery = height()*3/4; + int radius = (height()/2 - bottommargin)/2; + + const int horizontalstep = (width() - leftmargin - rightmargin)/std::max(backbonesize, 1); + const int verticalstep = (centery - radius - topmargin - 10)/std::max(branchsize, 1); + + QFont myFont("Courier", 9); + QFontMetrics fm(myFont); + painter.setFont(myFont); + + unordered_set labels; + labels.clear(); + + int linesize = 20; + int cornerlinesize = horizontalstep/8; + + paintCircle(painter, backboneacronyms, centerx, centery, radius, angle, horizontalstep, linesize, cornerlinesize, theoreticalspectrum->getVisualCoverage().size() > 0, visiblerotationid, labels); + + + // paint the branch + for (int i = 0; i < branchsize; i++) { + painter.setPen(QPen(Qt::blue, 2, Qt::SolidLine)); + if (fm.width(branchacronyms[branchsize - i - 1].c_str()) > horizontalstep*2/3) { + painter.drawText(centerx - horizontalstep/3 + 2, topmargin + verticalstep*i, horizontalstep*2/3 - 2, 20, Qt::AlignLeft|Qt::AlignVCenter, branchacronyms[branchsize - i - 1].c_str()); + } + else { + painter.drawText(centerx - horizontalstep/3, topmargin + verticalstep*i, horizontalstep*2/3, 20, Qt::AlignCenter, branchacronyms[branchsize - i - 1].c_str()); + } + + if (theoreticalspectrum->getVisualCoverage().size() > 0) { + painter.drawText(centerx - horizontalstep/3, topmargin + verticalstep*i - 20, horizontalstep*2/3, 20, Qt::AlignLeft, to_string(backbonesize + branchsize - i).c_str()); + } + + painter.setPen(QPen(Qt::black, 2, Qt::SolidLine)); + painter.drawRect(centerx - horizontalstep/3, topmargin + verticalstep*i, horizontalstep*2/3, 20); + + painter.setPen(QPen(Qt::black, 2, Qt::SolidLine)); + painter.drawLine(centerx, topmargin + verticalstep*i + 20, centerx, topmargin + verticalstep*i + verticalstep); + + if (theoreticalspectrum->getVisualCoverage().size() > 0) { + painter.setPen(QPen(Qt::black, 2, Qt::DashLine)); + painter.drawLine(centerx - 20, topmargin + verticalstep*i + (verticalstep + 10)/2, centerx + 20, topmargin + verticalstep*i + (verticalstep + 10)/2); + painter.drawLine(centerx - 20, topmargin + verticalstep*i + (verticalstep + 10)/2, centerx - 20, topmargin + verticalstep*i + (verticalstep + 10)/2 + verticalstep/8); + painter.drawLine(centerx + 20, topmargin + verticalstep*i + (verticalstep + 10)/2 - verticalstep/8, centerx + 20, topmargin + verticalstep*i + (verticalstep + 10)/2); + } + + if (i == branchsize - 1) { + painter.setPen(QPen(Qt::black, 2, Qt::SolidLine)); + painter.drawLine(centerx, topmargin + verticalstep*i + verticalstep, centerx, centery - radius - 10); + } + } + + + if (parameters && (theoreticalspectrum->getVisualCoverage().size() > 0)) { + + // get branch-cyclic rotations + vector branchcyclicrotations; + theoreticalspectrum->getCandidate().getBranchCyclicRotations(branchcyclicrotations, true); + + // get T-permutations of branch-cyclic rotations + vector > trotationsofbranchcyclicrotations; + trotationsofbranchcyclicrotations.resize(branchcyclicrotations.size()); + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { + branchcyclicrotations[i].getPermutationsOfBranches(trotationsofbranchcyclicrotations[i]); + } + + int rotationid; + int half = (int)theoreticalspectrum->getVisualCoverage().size()/(int)parameters->fragmentionsfortheoreticalspectra.size()/2; + for (int i = 0; i < half; i++) { + + if ((visibletrotationid != -1) && (visibletrotationid != i % 6)) { + continue; + } + + if (i/6 == 0) { + rotationid = half/6; + } + else { + rotationid = 2*half/6 - i/6; + } + + switch (i % 6) + { + case 0: + generateCyclicLabelsToRight(true, i, i/6, 0, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][0].middlebranchstart, trotationsofbranchcyclicrotations[i/6][0].middlebranchend); + break; + case 1: + generateBranchLabelsDown(true, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][1].middlebranchstart); + generateCyclicLabelsToRight(true, i, -1, trotationsofbranchcyclicrotations[i/6][1].middlebranchend, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][1].middlebranchstart, trotationsofbranchcyclicrotations[i/6][1].middlebranchend); + break; + case 2: + generateCyclicLabelsToRight(true, rotationid*6 + 2, i/6, 0, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[rotationid][2].middlebranchstart, trotationsofbranchcyclicrotations[rotationid][2].middlebranchend); + break; + case 3: + generateCyclicLabelsToRight(true, i, i/6, 0, trotationsofbranchcyclicrotations[i/6][3].middlebranchstart, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][3].middlebranchstart, trotationsofbranchcyclicrotations[i/6][3].middlebranchend); + generateBranchLabelsUp(true, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][3].middlebranchend); + generateBranchLabelsDown(false, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][4].middlebranchstart); + generateCyclicLabelsToLeft(false, i, 0, trotationsofbranchcyclicrotations[i/6][4].middlebranchend, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][4].middlebranchstart, trotationsofbranchcyclicrotations[i/6][4].middlebranchend); + break; + case 4: + generateBranchLabelsDown(true, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][4].middlebranchstart); + generateCyclicLabelsToLeft(true, i, 0, trotationsofbranchcyclicrotations[i/6][4].middlebranchend, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][4].middlebranchstart, trotationsofbranchcyclicrotations[i/6][4].middlebranchend); + break; + case 5: + generateCyclicLabelsToRight(true, rotationid*6 + 5, i/6, 0, trotationsofbranchcyclicrotations[rotationid][5].middlebranchstart, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[rotationid][5].middlebranchstart, trotationsofbranchcyclicrotations[rotationid][5].middlebranchend); + generateBranchLabelsUp(true, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][5].middlebranchend); + generateBranchLabelsDown(false, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][1].middlebranchstart); + generateCyclicLabelsToRight(false, i, -1, trotationsofbranchcyclicrotations[i/6][1].middlebranchend, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][1].middlebranchstart, trotationsofbranchcyclicrotations[i/6][1].middlebranchend); + break; + default: + break; + } + + } + + for (int i = half; i < 2*half; i++) { + + if ((visibletrotationid != -1) && (visibletrotationid != i % 6)) { + continue; + } + + if (i/6 == half/6) { + rotationid = 0; + } + else { + rotationid = 2*half/6 - i/6; + } + + switch (i % 6) + { + case 0: + generateCyclicLabelsToLeft(true, i, i/6, 0, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][0].middlebranchstart, trotationsofbranchcyclicrotations[i/6][0].middlebranchend); + break; + case 1: + generateBranchLabelsDown(true, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][1].middlebranchstart); + generateCyclicLabelsToLeft(true, i, 0, trotationsofbranchcyclicrotations[i/6][1].middlebranchend, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][1].middlebranchstart, trotationsofbranchcyclicrotations[i/6][1].middlebranchend); + break; + case 2: + generateCyclicLabelsToLeft(true, rotationid*6 + 2, i/6, 0, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[rotationid][2].middlebranchstart, trotationsofbranchcyclicrotations[rotationid][2].middlebranchend); + break; + case 3: + generateCyclicLabelsToLeft(true, i, i/6, 0, trotationsofbranchcyclicrotations[i/6][3].middlebranchstart, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][3].middlebranchstart, trotationsofbranchcyclicrotations[i/6][3].middlebranchend); + generateBranchLabelsUp(true, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][3].middlebranchend); + generateBranchLabelsDown(false, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][4].middlebranchstart); + generateCyclicLabelsToRight(false, i, -1, trotationsofbranchcyclicrotations[i/6][4].middlebranchend, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][4].middlebranchstart, trotationsofbranchcyclicrotations[i/6][4].middlebranchend); + break; + case 4: + generateBranchLabelsDown(true, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][4].middlebranchstart); + generateCyclicLabelsToRight(true, i, -1, trotationsofbranchcyclicrotations[i/6][4].middlebranchend, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][4].middlebranchstart, trotationsofbranchcyclicrotations[i/6][4].middlebranchend); + break; + case 5: + generateCyclicLabelsToLeft(true, rotationid*6 + 5, i/6, 0, trotationsofbranchcyclicrotations[rotationid][5].middlebranchstart, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[rotationid][5].middlebranchstart, trotationsofbranchcyclicrotations[rotationid][5].middlebranchend); + generateBranchLabelsUp(true, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][5].middlebranchend); + generateBranchLabelsDown(false, i, labels, parameters, theoreticalspectrum, centerx, topmargin, horizontalstep, verticalstep, visiblerotationid, trotationsofbranchcyclicrotations[i/6][1].middlebranchstart); + generateCyclicLabelsToLeft(false, i, 0, trotationsofbranchcyclicrotations[i/6][1].middlebranchend, backbonesize + branchsize - 1, backbonesize, labels, parameters, theoreticalspectrum, centerx, centery, radius, angle, linesize, cornerlinesize, visiblerotationid, trotationsofbranchcyclicrotations[i/6][1].middlebranchstart, trotationsofbranchcyclicrotations[i/6][1].middlebranchend); + break; + default: + break; + } + + } + + painter.setPen(QPen(Qt::red, 2, Qt::SolidLine)); + for (auto it = labels.begin(); it != labels.end(); ++it) { + if (it->alignright) { + painter.drawText(it->x - fm.width(it->label.c_str()), it->y, fm.width(it->label.c_str()), 20, Qt::AlignLeft, it->label.c_str()); + } + else { + painter.drawText(it->x, it->y, width(), 20, Qt::AlignLeft, it->label.c_str()); + } + } + + } + +} + + +void cBranchCyclicWidget::rotationChanged(int index) { + visiblerotationid = index - 1; + repaint(); +} + + +void cBranchCyclicWidget::trotationChanged(int index) { + visibletrotationid = index - 1; + repaint(); +} + diff --git a/CycloBranch/gui/cBranchCyclicWidget.h b/CycloBranch/gui/cBranchCyclicWidget.h new file mode 100644 index 0000000..e5d6e16 --- /dev/null +++ b/CycloBranch/gui/cBranchCyclicWidget.h @@ -0,0 +1,131 @@ +/** + \file cBranchCyclicWidget.h + \brief Visualization of a branch-cyclic peptide. +*/ + + +#ifndef _CBRANCHCYCLICWIDGET_H +#define _CBRANCHCYCLICWIDGET_H + +#include +#include +#include + +#include "core/cTheoreticalSpectrum.h" +#include "gui/cLinearWidget.h" +#include "gui/cCyclicWidget.h" + + +// forward declaration +class QPaintEvent; + + +/** + \brief Generate labels of fragment ions on a branch of a branch-cyclic peptide (direction down). + \param nterminal if true only nterminal fragment ions are drawn, if false only cterminal fragment ions are drawn + \param rotationid id of a sequence rotation + \param labels labels of fragment ions + \param parameters a pointer to parameters of the application + \param theoreticalspectrum a theoretical spectrum + \param centerx x coordinate of a center of the ring + \param topmargin top margin in pixels + \param horizontalstep horizontal step (determine width of blocks) + \param verticalstep vertical step (determine height of blocks) + \param visiblerotationid id of a rotation whose fragment ions are visualized + \param branchstart starting position of a branch +*/ +void generateBranchLabelsDown(bool nterminal, int rotationid, unordered_set& labels, cParameters* parameters, cTheoreticalSpectrum* theoreticalspectrum, int centerx, int topmargin, int horizontalstep, int verticalstep, int visiblerotationid, int branchstart); + + +/** + \brief Generate labels of fragment ions on a branch of a branch-cyclic peptide (direction up). + \param nterminal if true only nterminal fragment ions are drawn, if false only cterminal fragment ions are drawn + \param rotationid id of a sequence rotation + \param labels labels of fragment ions + \param parameters a pointer to parameters of the application + \param theoreticalspectrum a theoretical spectrum + \param centerx x coordinate of a center of the ring + \param topmargin top margin in pixels + \param horizontalstep horizontal step (determine width of blocks) + \param verticalstep vertical step (determine height of blocks) + \param visiblerotationid id of a rotation whose fragment ions are visualized + \param branchend end position of a branch +*/ +void generateBranchLabelsUp(bool nterminal, int rotationid, unordered_set& labels, cParameters* parameters, cTheoreticalSpectrum* theoreticalspectrum, int centerx, int topmargin, int horizontalstep, int verticalstep, int visiblerotationid, int branchend); + + +/** + \brief Visualization of a branch-cyclic peptide. +*/ +class cBranchCyclicWidget : public QWidget +{ + Q_OBJECT + +public: + + + /** + \brief The constructor. + */ + cBranchCyclicWidget(); + + + /** + \brief Initialize the widget. + \param parameters a pointer to parameters + \param theoreticalspectrum a pointer to a theoretical spectrum + */ + void initialize(cParameters* parameters, cTheoreticalSpectrum* theoreticalspectrum); + + + /** + \brief Export peptide into a PDF or a PS file. + \param filename filename + \param postscript if true then PS file is generated instead of PDF + */ + void exportToPDF(QString filename, bool postscript); + + + /** + \brief Export peptide scene into a PNG file. + \param filename filename + */ + void exportToPNG(QString filename); + + + /** + \brief Export peptide scene into a SVG file. + \param filename filename + */ + void exportToSVG(QString filename); + + +protected: + + + /** + \brief Handle the paint event. + \param event pointer to QPaintEvent + */ + void paintEvent(QPaintEvent *event); + + +private: + + void paint(QPainter& painter); + + cParameters* parameters; + cTheoreticalSpectrum* theoreticalspectrum; + int visiblerotationid; + int visibletrotationid; + + +private slots: + + void rotationChanged(int index); + + void trotationChanged(int index); + +}; + +#endif \ No newline at end of file diff --git a/CycloBranch/gui/cBricksDatabaseWidget.cpp b/CycloBranch/gui/cBricksDatabaseWidget.cpp index ed58bfa..c2c65d2 100644 --- a/CycloBranch/gui/cBricksDatabaseWidget.cpp +++ b/CycloBranch/gui/cBricksDatabaseWidget.cpp @@ -37,29 +37,41 @@ cBricksDatabaseWidget::cBricksDatabaseWidget(QWidget* parent) { insertrow = new QPushButton(tr("Add Row")); insertrow->setToolTip("Add a new row."); + insertrow->setShortcut(QKeySequence(Qt::Key_Insert)); + removechecked = new QPushButton(tr(" Remove Rows ")); removechecked->setToolTip("Remove selected rows."); + removechecked->setShortcut(QKeySequence(Qt::Key_Delete)); close = new QPushButton(tr("Close")); close->setToolTip("Close the window."); + load = new QPushButton(tr("Load")); load->setToolTip("Load the database of building blocks."); + load->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + save = new QPushButton(QString(" Save ")); save->setToolTip("Save the database of building blocks in the current file. When a file has not been loaded yet, the \"Save As ...\" file dialog is opened."); + saveas = new QPushButton(tr("Save As...")); saveas->setToolTip("Save the database of building blocks into a file."); + saveas->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); rowsfilterline = new QLineEdit(); rowsfilterline->setMinimumWidth(250); rowsfilterline->setToolTip("Text to Find"); + rowsfiltercasesensitive = new QCheckBox(); rowsfiltercasesensitive->setToolTip("Case Sensitive"); + rowsfilterbutton = new QPushButton("Filter"); rowsfilterbutton->setToolTip("Filter Search Results"); rowsfilterbutton->setMinimumWidth(50); + rowsfilterclearbutton = new QPushButton("Clear"); rowsfilterclearbutton->setToolTip("Clear Form and Reset Search Results"); rowsfilterclearbutton->setMinimumWidth(50); + rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); rowsfilterhbox = new QHBoxLayout(); rowsfilterhbox->addWidget(rowsfilterline); @@ -97,6 +109,7 @@ cBricksDatabaseWidget::cBricksDatabaseWidget(QWidget* parent) { database->horizontalHeaderItem(3)->setText("Residue Summary"); database->setHorizontalHeaderItem(4, new QTableWidgetItem()); database->horizontalHeaderItem(4)->setText("Monoisotopic Residue Mass"); + database->setItemDelegateForColumn(4, &columndelegate); database->setHorizontalHeaderItem(5, new QTableWidgetItem()); database->horizontalHeaderItem(5)->setText("Reference(s)"); database->setHorizontalHeaderItem(6, new QTableWidgetItem()); @@ -270,7 +283,7 @@ bool cBricksDatabaseWidget::checkFormula(int row, const string& summary) { return false; } if (database->item(row, 4)) { - database->item(row, 4)->setData(Qt::DisplayRole, to_string(formula.getMass()).c_str()); + database->item(row, 4)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(formula.getMass())); } return true; } @@ -304,6 +317,26 @@ void cBricksDatabaseWidget::keyPressEvent(QKeyEvent *event) { filterRows(); } } + + if (event->key() == Qt::Key_F1) { + #if OS_TYPE == WIN + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/blockseditor.html").absoluteFilePath())); + #else + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/blockseditor.html").absoluteFilePath())); + #endif + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_F)) { + rowsfilterline->setFocus(); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_N)) { + rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked()); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_S)) { + saveDatabase(); + } } @@ -368,7 +401,7 @@ void cBricksDatabaseWidget::loadDatabase() { database->item(i, 3)->setText(bricks[i].getSummary().c_str()); database->setItem(i, 4, widgetitemallocator.getNewItem()); - database->item(i, 4)->setData(Qt::DisplayRole, to_string(bricks[i].getMass()).c_str()); + database->item(i, 4)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(bricks[i].getMass())); database->setItem(i, 5, widgetitemallocator.getNewItem()); database->item(i, 5)->setText(bricks[i].getReferencesAsString().c_str()); diff --git a/CycloBranch/gui/cBricksDatabaseWidget.h b/CycloBranch/gui/cBricksDatabaseWidget.h index 5b5b03b..5f595d3 100644 --- a/CycloBranch/gui/cBricksDatabaseWidget.h +++ b/CycloBranch/gui/cBricksDatabaseWidget.h @@ -8,10 +8,14 @@ #define _CBRICKSDATABASEWIDGET_H #include +#include +#include +#include #include #include "core/utilities.h" #include "core/cBricksDatabase.h" #include "core/cAllocator.h" +#include "gui/cDelegate.h" using namespace std; @@ -93,6 +97,7 @@ class cBricksDatabaseWidget : public QWidget cBricksDatabase bricks; vector headersort; + cDelegate columndelegate; cAllocator widgetitemallocator; diff --git a/CycloBranch/gui/cCyclicWidget.cpp b/CycloBranch/gui/cCyclicWidget.cpp index bffbf38..5f38f81 100644 --- a/CycloBranch/gui/cCyclicWidget.cpp +++ b/CycloBranch/gui/cCyclicWidget.cpp @@ -209,15 +209,33 @@ void generateCyclicLabelsToRight(bool nterminal, int rotationid, int rotationsta double cumulativeangle; string name; int m; - if ((visiblerotationid == -1) || ((parameters->peptidetype == cyclic) && (visiblerotationid == rotationid)) || ((parameters->peptidetype == lasso) && (visiblerotationid == rotationid/6))) { + if ((visiblerotationid == -1) || ((parameters->peptidetype == cyclic) && (visiblerotationid == rotationid)) +#if POLYKETIDE_SIDEROPHORES == 1 + || ((parameters->peptidetype == cyclicpolyketide) && (visiblerotationid == rotationid)) +#endif + || ((parameters->peptidetype == branchcyclic) && (visiblerotationid == rotationid/6))) { for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { - if ((nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) || (!nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal)) { + if ((nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) || (!nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal) +#if POLYKETIDE_SIDEROPHORES == 1 + || (parameters->peptidetype == cyclicpolyketide) +#endif + ) { m = 0; for (int j = fragmentstart; j < fragmentend; j++) { if ((branchstart == -1) || (branchend == -1) || ((branchstart >= 0) && (j < branchstart)) || ((branchend >= 0) && (j >= branchend))) { if (theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].series[j] > 0) { name = theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.substr(0, theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.rfind('_') + 1); - name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); +#if POLYKETIDE_SIDEROPHORES == 1 + if (parameters->peptidetype == cyclicpolyketide) { + name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(0, 2) + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(2); + } + else { +#endif + name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); +#if POLYKETIDE_SIDEROPHORES == 1 + } +#endif + cumulativeangle = angle*(double)((rotationstart + m + 1) % numberofringblocks) + angle/(double)2; if (cumulativeangle < pi/2) { QPoint p3(centerx + sin(cumulativeangle)*(radius + linesize) - sin(pi/2 - cumulativeangle)*cornerlinesize, centery - sin(pi/2 - cumulativeangle)*(radius + linesize) - sin(cumulativeangle)*cornerlinesize); @@ -249,15 +267,32 @@ void generateCyclicLabelsToLeft(bool nterminal, int rotationid, int rotationstar double cumulativeangle; string name; int m; - if ((visiblerotationid == -1) || ((parameters->peptidetype == cyclic) && (visiblerotationid == rotationid)) || ((parameters->peptidetype == lasso) && (visiblerotationid == rotationid/6))) { + if ((visiblerotationid == -1) || ((parameters->peptidetype == cyclic) && (visiblerotationid == rotationid)) +#if POLYKETIDE_SIDEROPHORES == 1 + || ((parameters->peptidetype == cyclicpolyketide) && (visiblerotationid == rotationid)) +#endif + || ((parameters->peptidetype == branchcyclic) && (visiblerotationid == rotationid/6))) { for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { - if ((nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) || (!nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal)) { + if ((nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) || (!nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal) +#if POLYKETIDE_SIDEROPHORES == 1 + || (parameters->peptidetype == cyclicpolyketide) +#endif + ) { m = 0; for (int j = fragmentstart; j < fragmentend; j++) { if ((branchstart == -1) || (branchend == -1) || ((branchstart >= 0) && (j < branchstart)) || ((branchend >= 0) && (j >= branchend))) { if (theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].series[j] > 0) { name = theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.substr(0, theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.rfind('_') + 1); - name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); +#if POLYKETIDE_SIDEROPHORES == 1 + if (parameters->peptidetype == cyclicpolyketide) { + name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(0, 2) + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(2); + } + else { +#endif + name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); +#if POLYKETIDE_SIDEROPHORES == 1 + } +#endif cumulativeangle = angle*(double)((2*numberofringblocks - rotationstart + numberofringblocks - m - 1) % numberofringblocks) + angle/(double)2; if (cumulativeangle < pi/2) { QPoint p4(centerx + sin(cumulativeangle)*(radius - linesize) + sin(pi/2 - cumulativeangle)*cornerlinesize, centery - sin(pi/2 - cumulativeangle)*(radius - linesize) + sin(cumulativeangle)*cornerlinesize); diff --git a/CycloBranch/gui/cDelegate.cpp b/CycloBranch/gui/cDelegate.cpp new file mode 100644 index 0000000..052adf2 --- /dev/null +++ b/CycloBranch/gui/cDelegate.cpp @@ -0,0 +1,12 @@ +#include "gui/cDelegate.h" + + +QString cDelegate::displayText(const QVariant &value, const QLocale &locale) const { + if (value.type() == QVariant::Double) { + return locale.toString(value.toDouble(), 'f', 6); + } + else { + return QStyledItemDelegate::displayText(value, locale); + } +} + diff --git a/CycloBranch/gui/cDelegate.h b/CycloBranch/gui/cDelegate.h new file mode 100644 index 0000000..0d5b518 --- /dev/null +++ b/CycloBranch/gui/cDelegate.h @@ -0,0 +1,38 @@ +/** + \file cDelegate.h + \brief A delegate for visualization of doubles in QTableWidget. +*/ + + +#ifndef _CDELEGATE_H +#define _CDELEGATE_H + +#include +#include +#include +#include + + +/** + \brief A delegate for visualization of doubles in QTableWidget. +*/ +class cDelegate: public QStyledItemDelegate { + + Q_OBJECT + +public: + + + /** + \brief Reimplementation of displayText. + \param value a value + \param locale a locale + \retval QString the value as a string + */ + QString displayText(const QVariant &value, const QLocale &locale) const; + +}; + + +#endif + diff --git a/CycloBranch/gui/cDrawPeptideWidget.cpp b/CycloBranch/gui/cDrawPeptideWidget.cpp index 2c659de..a33802d 100644 --- a/CycloBranch/gui/cDrawPeptideWidget.cpp +++ b/CycloBranch/gui/cDrawPeptideWidget.cpp @@ -37,11 +37,15 @@ cDrawPeptideWidget::cDrawPeptideWidget(QWidget* parent) { peptidetypecombobox = new QComboBox(); peptidetypecombobox->setToolTip("Select the type of peptide."); - peptidetypecombobox->setMaximumWidth(150); + peptidetypecombobox->setMaximumWidth(250); peptidetypecombobox->addItem(tr("Linear")); peptidetypecombobox->addItem(tr("Cyclic")); peptidetypecombobox->addItem(tr("Branched")); peptidetypecombobox->addItem(tr("Branch-cyclic")); +#if POLYKETIDE_SIDEROPHORES == 1 + peptidetypecombobox->addItem(tr("Linear oligoketide siderophore")); + peptidetypecombobox->addItem(tr("Cyclic oligoketide siderophore")); +#endif //peptidetypecombobox->addItem(tr("Linear polysaccharide (beta version)")); //peptidetypecombobox->addItem(tr("Other")); drawpeptideformlayout->addRow(tr("Peptide Type: "), peptidetypecombobox); @@ -130,21 +134,21 @@ cDrawPeptideWidget::cDrawPeptideWidget(QWidget* parent) { branchedwidget = new cBranchedWidget(); branchedwidget->initialize(0, 0); - lassowidget = new cLassoWidget(); - lassowidget->initialize(0, 0); + branchcyclicwidget = new cBranchCyclicWidget(); + branchcyclicwidget->initialize(0, 0); vbox = new QVBoxLayout(); vbox->addWidget(drawpeptideformwidget); vbox->addWidget(linearwidget); vbox->addWidget(cyclicwidget); vbox->addWidget(branchedwidget); - vbox->addWidget(lassowidget); + vbox->addWidget(branchcyclicwidget); vbox->setStretchFactor(drawpeptideformwidget, 1); vbox->setStretchFactor(linearwidget, 5); vbox->setStretchFactor(cyclicwidget, 5); vbox->setStretchFactor(branchedwidget, 5); - vbox->setStretchFactor(lassowidget, 5); + vbox->setStretchFactor(branchcyclicwidget, 5); mainbox = new QHBoxLayout(); mainbox->addLayout(vbox); @@ -176,7 +180,7 @@ cDrawPeptideWidget::~cDrawPeptideWidget() { delete linearwidget; delete cyclicwidget; delete branchedwidget; - delete lassowidget; + delete branchcyclicwidget; delete peptidetypecombobox; @@ -242,6 +246,14 @@ void cDrawPeptideWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape) { hide(); } + + if (event->key() == Qt::Key_F1) { + #if OS_TYPE == WIN + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/drawpeptide.html").absoluteFilePath())); + #else + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/drawpeptide.html").absoluteFilePath())); + #endif + } } @@ -250,7 +262,7 @@ void cDrawPeptideWidget::separateBlocksChanged(int state) { sequenceline->setDisabled(true); numberofblocksbackbone->setDisabled(false); backboneblockswidget->setDisabled(false); - if (((peptideType)(peptidetypecombobox->currentIndex()) == branched) || ((peptideType)(peptidetypecombobox->currentIndex()) == lasso)) { + if (((ePeptideType)(peptidetypecombobox->currentIndex()) == branched) || ((ePeptideType)(peptidetypecombobox->currentIndex()) == branchcyclic)) { numberofblocksbranch->setDisabled(false); branchblockswidget->setDisabled(false); branchposition->setDisabled(false); @@ -276,12 +288,18 @@ void cDrawPeptideWidget::separateBlocksChanged(int state) { void cDrawPeptideWidget::numberOfBackboneBlocksChanged(int numberofblocks) { - switch ((peptideType)peptidetypecombobox->currentIndex()) { + switch ((ePeptideType)peptidetypecombobox->currentIndex()) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif numberofblocksbackbone->setRange(1, 100); branchposition->setRange(1, 1); break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif numberofblocksbackbone->setRange(2, 100); branchposition->setRange(1, 1); break; @@ -289,7 +307,7 @@ void cDrawPeptideWidget::numberOfBackboneBlocksChanged(int numberofblocks) { numberofblocksbackbone->setRange(3, 100); branchposition->setRange(2, numberofblocks - 1); break; - case lasso: + case branchcyclic: numberofblocksbackbone->setRange(2, 100); branchposition->setRange(1, numberofblocks); break; @@ -349,14 +367,20 @@ void cDrawPeptideWidget::peptideTypeChanged(int index) { linearwidget->hide(); cyclicwidget->hide(); branchedwidget->hide(); - lassowidget->hide(); + branchcyclicwidget->hide(); - switch ((peptideType)index) { + switch ((ePeptideType)index) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif linearwidget->show(); numberOfBackboneBlocksChanged(max(backboneblocks->count(), 1)); break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif cyclicwidget->show(); numberOfBackboneBlocksChanged(max(backboneblocks->count(), 2)); break; @@ -364,8 +388,8 @@ void cDrawPeptideWidget::peptideTypeChanged(int index) { branchedwidget->show(); numberOfBackboneBlocksChanged(max(backboneblocks->count(), 3)); break; - case lasso: - lassowidget->show(); + case branchcyclic: + branchcyclicwidget->show(); numberOfBackboneBlocksChanged(max(backboneblocks->count(), 2)); break; case linearpolysaccharide: @@ -421,9 +445,13 @@ void cDrawPeptideWidget::blocksChanged() { branchcount--; } - peptideType peptidetype = (peptideType)peptidetypecombobox->currentIndex(); + ePeptideType peptidetype = (ePeptideType)peptidetypecombobox->currentIndex(); - if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) || ((backbonecount > 1) && (peptidetype == cyclic))) { + if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) || ((backbonecount > 1) && (peptidetype == cyclic)) +#if POLYKETIDE_SIDEROPHORES == 1 + || (peptidetype == linearpolyketide) || ((backbonecount > 1) && (peptidetype == cyclicpolyketide)) +#endif + ) { for (int i = 0; i < backbonecount; i++) { if (i > 0) { s += "-"; @@ -439,7 +467,7 @@ void cDrawPeptideWidget::blocksChanged() { } } - if (((backbonecount > branchposition->value()) && (peptidetype == branched)) || ((backbonecount >= branchposition->value()) && (peptidetype == lasso))) { + if (((backbonecount > branchposition->value()) && (peptidetype == branched)) || ((backbonecount >= branchposition->value()) && (peptidetype == branchcyclic))) { for (int i = 0; i < backbonecount; i++) { if (i == branchposition->value() - 1) { s += "\\(["; @@ -509,7 +537,7 @@ void cDrawPeptideWidget::sequenceChanged() { } string errormessage = ""; - peptideType peptidetype = (peptideType)peptidetypecombobox->currentIndex(); + ePeptideType peptidetype = (ePeptideType)peptidetypecombobox->currentIndex(); string sequence = sequenceline->text().toStdString(); int start1, start2; @@ -560,7 +588,11 @@ void cDrawPeptideWidget::sequenceChanged() { b.setComposition(theoreticalspectrum.getCandidate().getComposition(), false); b.explodeToIntComposition(intcomposition); - if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) || (peptidetype == cyclic)) { + if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) || (peptidetype == cyclic) +#if POLYKETIDE_SIDEROPHORES == 1 + || (peptidetype == linearpolyketide) || (peptidetype == cyclicpolyketide) +#endif + ) { numberofblocksbackbone->setValue((int)v.size()); for (int i = 0; i < backboneblocks->count(); i++) { if (i < (int)v.size()) { @@ -573,7 +605,7 @@ void cDrawPeptideWidget::sequenceChanged() { } } - if ((peptidetype == branched) || (peptidetype == lasso)) { + if ((peptidetype == branched) || (peptidetype == branchcyclic)) { branchstart = theoreticalspectrum.getCandidate().getBranchStart(); branchend = theoreticalspectrum.getCandidate().getBranchEnd(); @@ -614,17 +646,23 @@ void cDrawPeptideWidget::sequenceChanged() { void cDrawPeptideWidget::drawPeptide(vector& composition, cBricksDatabase& bricksdb, int branchstart, int branchend) { vector netmp; - vector lassorotations; + vector branchcyclicrotations; int numberofbricks; - switch ((peptideType)peptidetypecombobox->currentIndex()) { + switch ((ePeptideType)peptidetypecombobox->currentIndex()) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif theoreticalspectrum.getCandidate().setCandidate(composition, netmp, 0, 0, 0, -1, -1); theoreticalspectrum.getCandidate().setAcronyms(bricksdb); linearwidget->initialize(0, &theoreticalspectrum); linearwidget->repaint(); break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif theoreticalspectrum.getCandidate().setCandidate(composition, netmp, 0, 0, 0, -1, -1); theoreticalspectrum.getCandidate().setAcronyms(bricksdb); cyclicwidget->initialize(0, &theoreticalspectrum); @@ -637,26 +675,26 @@ void cDrawPeptideWidget::drawPeptide(vector& composition, cBricksDatabas branchedwidget->initialize(0, &theoreticalspectrum); branchedwidget->repaint(); break; - case lasso: + case branchcyclic: theoreticalspectrum.getCandidate().setCandidate(composition, netmp, 0, 0, 0, branchstart, branchend); // normalize the candidate - theoreticalspectrum.getCandidate().getLassoRotations(lassorotations, false); + theoreticalspectrum.getCandidate().getBranchCyclicRotations(branchcyclicrotations, false); numberofbricks = getNumberOfBricks(theoreticalspectrum.getCandidate().getComposition()); - for (int i = 0; i < (int)lassorotations.size(); i++) { - if (lassorotations[i].getBranchEnd() == numberofbricks - 1) { + for (int i = 0; i < (int)branchcyclicrotations.size(); i++) { + if (branchcyclicrotations[i].getBranchEnd() == numberofbricks - 1) { vector v; - v.push_back(lassorotations[i].getComposition()); + v.push_back(branchcyclicrotations[i].getComposition()); vector cpath = theoreticalspectrum.getCandidate().getPath(); - theoreticalspectrum.getCandidate().setCandidate(v, cpath, theoreticalspectrum.getCandidate().getStartModifID(), theoreticalspectrum.getCandidate().getEndModifID(), theoreticalspectrum.getCandidate().getMiddleModifID(), lassorotations[i].getBranchStart(), lassorotations[i].getBranchEnd()); + theoreticalspectrum.getCandidate().setCandidate(v, cpath, theoreticalspectrum.getCandidate().getStartModifID(), theoreticalspectrum.getCandidate().getEndModifID(), theoreticalspectrum.getCandidate().getMiddleModifID(), branchcyclicrotations[i].getBranchStart(), branchcyclicrotations[i].getBranchEnd()); break; } } theoreticalspectrum.getCandidate().setBackboneAcronyms(bricksdb); theoreticalspectrum.getCandidate().setBranchAcronyms(bricksdb); - lassowidget->initialize(0, &theoreticalspectrum); - lassowidget->repaint(); + branchcyclicwidget->initialize(0, &theoreticalspectrum); + branchcyclicwidget->repaint(); break; case linearpolysaccharide: break; diff --git a/CycloBranch/gui/cDrawPeptideWidget.h b/CycloBranch/gui/cDrawPeptideWidget.h index e44ea87..7809599 100644 --- a/CycloBranch/gui/cDrawPeptideWidget.h +++ b/CycloBranch/gui/cDrawPeptideWidget.h @@ -8,10 +8,13 @@ #define _CDRAWPEPTIDEWIDGET_H #include +#include +#include +#include #include "gui/cLinearWidget.h" #include "gui/cCyclicWidget.h" #include "gui/cBranchedWidget.h" -#include "gui/cLassoWidget.h" +#include "gui/cBranchCyclicWidget.h" // forward declaration @@ -114,7 +117,7 @@ class cDrawPeptideWidget : public QWidget cLinearWidget* linearwidget; cCyclicWidget* cyclicwidget; cBranchedWidget* branchedwidget; - cLassoWidget* lassowidget; + cBranchCyclicWidget* branchcyclicwidget; QVBoxLayout* vbox; QHBoxLayout* mainbox; diff --git a/CycloBranch/gui/cFragmentIonsListWidget.cpp b/CycloBranch/gui/cFragmentIonsListWidget.cpp index 8e002e8..09ed03f 100644 --- a/CycloBranch/gui/cFragmentIonsListWidget.cpp +++ b/CycloBranch/gui/cFragmentIonsListWidget.cpp @@ -17,11 +17,11 @@ cFragmentIonsListWidget::cFragmentIonsListWidget(QObject* parent) { list->setSelectionMode(QAbstractItemView::MultiSelection); selectall = new QPushButton("Select All"); - selectall->setToolTip("Select all fragment ion types in the list."); + selectall->setToolTip("Select all ion types in the list."); clearall = new QPushButton("Clear All"); - clearall->setToolTip("Unselect all fragment ion types in the list."); + clearall->setToolTip("Unselect all ion types in the list."); reset = new QPushButton("Reset"); - reset->setToolTip("Reset to a default selection of fragment ions considering selected \"Peptide Type\"."); + reset->setToolTip("Reset to the default seletion of ions."); hbox->addWidget(selectall); hbox->addWidget(clearall); diff --git a/CycloBranch/gui/cGraphWidget.cpp b/CycloBranch/gui/cGraphWidget.cpp index 201f2fc..dd409e2 100644 --- a/CycloBranch/gui/cGraphWidget.cpp +++ b/CycloBranch/gui/cGraphWidget.cpp @@ -67,5 +67,13 @@ void cGraphWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape) { hide(); } + + if (event->key() == Qt::Key_F1) { + #if OS_TYPE == WIN + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/menubar.html").absoluteFilePath())); + #else + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/menubar.html").absoluteFilePath())); + #endif + } } diff --git a/CycloBranch/gui/cGraphWidget.h b/CycloBranch/gui/cGraphWidget.h index 08a04ba..dbcbddb 100644 --- a/CycloBranch/gui/cGraphWidget.h +++ b/CycloBranch/gui/cGraphWidget.h @@ -10,6 +10,9 @@ #include #include #include +#include +#include +#include #include "core/utilities.h" diff --git a/CycloBranch/gui/cHTMLExportDialog.cpp b/CycloBranch/gui/cHTMLExportDialog.cpp new file mode 100644 index 0000000..b74673f --- /dev/null +++ b/CycloBranch/gui/cHTMLExportDialog.cpp @@ -0,0 +1,77 @@ +#include "gui/cHTMLExportDialog.h" + + +cHTMLExportDialog::cHTMLExportDialog(QWidget* parent) { + this->parent = parent; + + checkboxparameters = new QCheckBox(); + checkboxdenovo = new QCheckBox(); + checkboxlogwindow = new QCheckBox(); + checkboxsummaryresultstable = new QCheckBox(); + checkboxsummarypeakstable = new QCheckBox(); + checkboxpeakstable = new QCheckBox(); + checkboxunmatchedexperimental = new QCheckBox(); + checkboxunmatchedtheoretical = new QCheckBox(); + checkboxdetails = new QCheckBox(); + + form1 = new QFormLayout(); + form1->addRow("Parameters", checkboxparameters); + form1->addRow("De Novo Graph", checkboxdenovo); + form1->addRow("Log Window", checkboxlogwindow); + form1->addRow("Output Report Table", checkboxsummaryresultstable); + form1->addRow("Summary Table of Matched Peaks", checkboxsummarypeakstable); + + group1 = new QGroupBox("Summary"); + group1->setLayout(form1); + + form2 = new QFormLayout(); + form2->addRow("Peaks Table", checkboxpeakstable); + form2->addRow("Unmatched Experimental Peaks", checkboxunmatchedexperimental); + form2->addRow("Unmatched Theoretical Peaks", checkboxunmatchedtheoretical); + form2->addRow("Details of Identification", checkboxdetails); + + group2 = new QGroupBox("Individual Rows in Output Report Table"); + group2->setLayout(form2); + + hbox = new QHBoxLayout(); + hbox->addWidget(group1); + hbox->addWidget(group2); + + buttonbox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); + + vbox = new QVBoxLayout(); + vbox->addLayout(hbox); + vbox->addWidget(buttonbox); + + setLayout(vbox); + setWindowTitle("Export HTML report"); + setMinimumWidth(500); + + connect(buttonbox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonbox, SIGNAL(rejected()), this, SLOT(reject())); +} + + +cHTMLExportDialog::~cHTMLExportDialog() { + delete checkboxparameters; + delete checkboxdenovo; + delete checkboxlogwindow; + delete checkboxsummaryresultstable; + delete checkboxsummarypeakstable; + delete checkboxpeakstable; + delete checkboxunmatchedexperimental; + delete checkboxunmatchedtheoretical; + delete checkboxdetails; + + delete form1; + delete form2; + + delete group1; + delete group2; + + delete hbox; + delete buttonbox; + + delete vbox; +} + diff --git a/CycloBranch/gui/cHTMLExportDialog.h b/CycloBranch/gui/cHTMLExportDialog.h new file mode 100644 index 0000000..ed1dd3c --- /dev/null +++ b/CycloBranch/gui/cHTMLExportDialog.h @@ -0,0 +1,111 @@ +/** + \file cHTMLExportDialog.h + \brief The implementation of HTML export dialog. +*/ + + +#ifndef _CHTMLEXPORTDIALOG_H +#define _CHTMLEXPORTDIALOG_H + +#include +#include +#include +#include +#include +#include +#include + + +/** + \brief The implementation of HTML export dialog. +*/ +class cHTMLExportDialog : public QDialog +{ + Q_OBJECT + +private: + + QWidget* parent; + + QFormLayout* form1; + QFormLayout* form2; + + QGroupBox* group1; + QGroupBox* group2; + + QHBoxLayout* hbox; + QDialogButtonBox* buttonbox; + QVBoxLayout* vbox; + +public: + + /** + \brief Export parameters. + */ + QCheckBox* checkboxparameters; + + + /** + \brief Export de novo graph. + */ + QCheckBox* checkboxdenovo; + + + /** + \brief Export log window. + */ + QCheckBox* checkboxlogwindow; + + + /** + \brief Export output report table. + */ + QCheckBox* checkboxsummaryresultstable; + + + /** + \brief Export summary table of matched peaks. + */ + QCheckBox* checkboxsummarypeakstable; + + + /** + \brief Export peakss table. + */ + QCheckBox* checkboxpeakstable; + + + /** + \brief Export unmatched experimental peaks. + */ + QCheckBox* checkboxunmatchedexperimental; + + + /** + \brief Export matched experimental peaks. + */ + QCheckBox* checkboxunmatchedtheoretical; + + + /** + \brief Export details of identification. + */ + QCheckBox* checkboxdetails; + + + /** + \brief The constructor. + \param parent pointer to a parent widget + */ + cHTMLExportDialog(QWidget* parent = (QWidget *)0); + + + /** + \brief The destructor. + */ + ~cHTMLExportDialog(); + +}; + +#endif + diff --git a/CycloBranch/gui/cLinearWidget.cpp b/CycloBranch/gui/cLinearWidget.cpp index b1d7c30..4c116af 100644 --- a/CycloBranch/gui/cLinearWidget.cpp +++ b/CycloBranch/gui/cLinearWidget.cpp @@ -176,18 +176,50 @@ void cLinearWidget::paint(QPainter& painter) { int len = (int)theoreticalspectrum->getVisualCoverage()[0].series.size(); for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { +#if POLYKETIDE_SIDEROPHORES == 1 + if (((parameters->peptidetype == linear) && (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal)) || + ((parameters->peptidetype == linearpolyketide) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2h_ion) + || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2oh_ion)))) + { +#else if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) { +#endif for (int j = 0; j < len; j++) { if (theoreticalspectrum->getVisualCoverage()[i].series[j] > 0) { - name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); +#if POLYKETIDE_SIDEROPHORES == 1 + if (parameters->peptidetype == linearpolyketide) { + name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(0, 2) + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(2); + } + else { +#endif + name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); +#if POLYKETIDE_SIDEROPHORES == 1 + } +#endif insertLabel(labels, leftmargin + horizontalstep/4 + horizontalstep/8 + horizontalstep*j + horizontalstep/2, topmargin - 35, name, false); } } } +#if POLYKETIDE_SIDEROPHORES == 1 + if (((parameters->peptidetype == linear) && (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal)) || + ((parameters->peptidetype == linearpolyketide) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2h_ion) + || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2oh_ion)))) + { +#else if (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal) { +#endif for (int j = len - 1; j >= 0; j--) { if (theoreticalspectrum->getVisualCoverage()[i].series[len - j - 1] > 0) { - name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(len - j) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); +#if POLYKETIDE_SIDEROPHORES == 1 + if (parameters->peptidetype == linearpolyketide) { + name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(0, 2) + to_string(len - j) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(2); + } + else { +#endif + name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(len - j) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); +#if POLYKETIDE_SIDEROPHORES == 1 + } +#endif insertLabel(labels, leftmargin + horizontalstep*(j + 1), topmargin + 35, name, false); } } diff --git a/CycloBranch/gui/cMainThread.cpp b/CycloBranch/gui/cMainThread.cpp index 3204a2b..acd93a2 100644 --- a/CycloBranch/gui/cMainThread.cpp +++ b/CycloBranch/gui/cMainThread.cpp @@ -7,20 +7,32 @@ bool cMainThread::checkModifications(cParameters& parameters, cSequence& sequenc middlemodifid = 0; errormessage = ""; - if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == lasso) || (sequence.getPeptideType() == linearpolysaccharide)) { - - if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == linearpolysaccharide)) { + if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == branchcyclic) || (sequence.getPeptideType() == linearpolysaccharide) +#if POLYKETIDE_SIDEROPHORES == 1 + || (sequence.getPeptideType() == linearpolyketide) +#endif + ) { + + if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == linearpolysaccharide) +#if POLYKETIDE_SIDEROPHORES == 1 + || (sequence.getPeptideType() == linearpolyketide) +#endif + ) { startmodifid = -1; endmodifid = -1; } - if ((sequence.getPeptideType() == branched) || (sequence.getPeptideType() == lasso)) { + if ((sequence.getPeptideType() == branched) || (sequence.getPeptideType() == branchcyclic)) { middlemodifid = -1; } for (int i = 0; i < (int)parameters.searchedmodifications.size(); i++) { - if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == linearpolysaccharide)) { + if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == linearpolysaccharide) +#if POLYKETIDE_SIDEROPHORES == 1 + || (sequence.getPeptideType() == linearpolyketide) +#endif + ) { if (parameters.searchedmodifications[i].name.compare(sequence.getNTterminalModification()) == 0) { startmodifid = i; } @@ -30,7 +42,7 @@ bool cMainThread::checkModifications(cParameters& parameters, cSequence& sequenc } } - if ((sequence.getPeptideType() == branched) || (sequence.getPeptideType() == lasso)) { + if ((sequence.getPeptideType() == branched) || (sequence.getPeptideType() == branchcyclic)) { if (parameters.searchedmodifications[i].name.compare(sequence.getBranchModification()) == 0) { middlemodifid = i; } @@ -146,7 +158,7 @@ void cMainThread::run() { *os << appname.toStdString() << " started at " << time.currentTime().toString().toStdString() << "." << endl << endl; parameters.setOutputStream(*os); - if (parameters.checkAndPrepare() == -1) { + if (parameters.checkAndPrepare(terminatecomputation) == -1) { emitEndSignals(); return; } @@ -174,27 +186,41 @@ void cMainThread::run() { } } - parameters.peaklist.sortbyMass(); - parameters.peaklist.cropMinimumMZRatio(parameters.minimummz, parameters.fragmentmasserrortolerance); - - if ((parameters.mode == denovoengine) || (parameters.mode == singlecomparison) || (parameters.mode == databasesearch)) { - parameters.peaklist.cropMaximumMZRatio(charge(uncharge(parameters.precursormass, parameters.precursorcharge), (parameters.precursorcharge > 0)?1:-1), parameters.precursormasserrortolerance); + bool seriesofspectra = false; + if (parameters.mode == dereplication) { + seriesofspectra = true; } - if (parameters.peaklist.normalizeIntenzity() == -1) { - *os << "Error: the spectrum cannot be normalized because the maximum intensity is <= 0. The format of peaklist is likely incorrect." << endl; + if (parameters.peaklistseries.size() == 0) { + *os << "Error: no peaklist found. The format of peaklist is likely incorrect." << endl; emitEndSignals(); return; } - parameters.peaklist.cropIntenzity(parameters.minimumrelativeintensitythreshold); - //parameters.peaklist.maxHighestPeaksInWindow(10, 50); - *os << "Peaklist:" << endl; - *os << parameters.peaklist.print(); - if (parameters.masserrortolerancefordeisotoping > 0) { - parameters.peaklist.removeIsotopes(parameters.precursorcharge, parameters.masserrortolerancefordeisotoping, this); - } + for (int i = 0; i < (seriesofspectra?parameters.peaklistseries.size():1); i++) { + parameters.peaklistseries[i].sortbyMass(); + parameters.peaklistseries[i].cropMinimumMZRatio(parameters.minimummz, parameters.fragmentmasserrortolerance); + if ((parameters.mode == denovoengine) || (parameters.mode == singlecomparison) || (parameters.mode == databasesearch)) { + parameters.peaklistseries[i].cropMaximumMZRatio(charge(uncharge(parameters.precursormass, parameters.precursorcharge), (parameters.precursorcharge > 0)?1:-1), parameters.precursormasserrortolerance); + } + + if (parameters.peaklistseries[i].normalizeIntenzity() == -1) { + *os << "Error: the spectrum no. " << i + 1 << " cannot be normalized because the maximum intensity is <= 0. The spectrum likely does not contain any peak or the format of peaklist is incorrect." << endl; + emitEndSignals(); + return; + } + parameters.peaklistseries[i].cropIntenzity(parameters.minimumrelativeintensitythreshold); + //parameters.peaklistseries[i].maxHighestPeaksInWindow(10, 50); + + if (parameters.mode != dereplication) { + *os << "Peaklist no. " << i + 1 << ":" << endl; + *os << parameters.peaklistseries[i].print(); + if (parameters.masserrortolerancefordeisotoping > 0) { + parameters.peaklistseries[i].removeIsotopes(parameters.precursorcharge, parameters.masserrortolerancefordeisotoping, this); + } + } + } if ((parameters.mode == denovoengine) || (parameters.mode == singlecomparison) || (parameters.mode == databasesearch)) { int startmodifid, endmodifid, middlemodifid; @@ -355,8 +381,39 @@ void cMainThread::run() { // parse branch of a branched or a branch-cyclic peptide parseBranch(parameters.sequencedatabase[i].getPeptideType(), composition, v, branchstart, branchend); - // set candidate and check precursor mass error + // set candidate c.setCandidate(v, netmp, startmodifid, endmodifid, middlemodifid, branchstart, branchend); + +#if POLYKETIDE_SIDEROPHORES == 1 + + if (!calculatesummaries && ((parameters.sequencedatabase[i].getPeptideType() == linearpolyketide) || (parameters.sequencedatabase[i].getPeptideType() == cyclicpolyketide))) { + + if (!c.checkPolyketideSequence(parameters.bricksdatabase, parameters.sequencedatabase[i].getPeptideType())) { + if (parameters.sequencedatabase[i].getPeptideType() == linearpolyketide) { + *os << "Ignored sequence: " << parameters.sequencedatabase[i].getName() << " " << parameters.sequencedatabase[i].getSequence() << "; the order of building blocks is not correct." << endl; + } + else { + *os << "Ignored sequence: " << parameters.sequencedatabase[i].getName() << " " << parameters.sequencedatabase[i].getSequence() << "; the number or order of building blocks is not correct." << endl; + } + continue; + } + + eResidueLossType leftresiduelosstype = c.getLeftResidueType(parameters.bricksdatabase); + eResidueLossType rightresiduelosstype = c.getRightResidueType(parameters.bricksdatabase); + + if (((leftresiduelosstype == h2) && (c.getStartModifID() > 0) && parameters.searchedmodifications[c.getStartModifID()].cterminal) + || ((leftresiduelosstype == h2o2) && (c.getStartModifID() > 0) && parameters.searchedmodifications[c.getStartModifID()].nterminal) + || ((rightresiduelosstype == h2) && (c.getEndModifID() > 0) && parameters.searchedmodifications[c.getEndModifID()].cterminal) + || ((rightresiduelosstype == h2o2) && (c.getEndModifID() > 0) && parameters.searchedmodifications[c.getEndModifID()].nterminal)) { + *os << "Ignored sequence: " << parameters.sequencedatabase[i].getName() << " " << parameters.sequencedatabase[i].getSequence() << "; the N-terminal modification is attached to C-terminus or vice versa." << endl; + continue; + } + + } + +#endif + + // check the precursor mass error if (!calculatesummaries && !parameters.similaritysearch && !isInPpmMassErrorTolerance(charge(uncharge(parameters.precursormass, parameters.precursorcharge), (parameters.precursorcharge > 0)?1:-1), c.getPrecursorMass(parameters.bricksdatabase, ¶meters), parameters.precursormasserrortolerance)) { continue; } @@ -365,7 +422,7 @@ void cMainThread::run() { candidates.getSet().insert(c); if (calculatesummaries) { - *os << c.getSummaryFormula(parameters, parameters.sequencedatabase[i].getPeptideType()).getSummary() << endl; + *os << i + 1 << " " << c.getSummaryFormula(parameters, parameters.sequencedatabase[i].getPeptideType()).getSummary() << endl; } } @@ -384,11 +441,32 @@ void cMainThread::run() { // database search - MS mode if (parameters.mode == dereplication) { - *os << "Comparing theoretical peaks with the peak list... " << endl; - cTheoreticalSpectrum ts; - ts.compareMSSpectrum(¶meters); + *os << "Comparing theoretical peaks with the experimental peaklist(s)... " << endl; + *os << "Number of experimental peaklists: " << parameters.peaklistseries.size() << endl; + *os << "Processing the peaklist no. : " << endl; + theoreticalspectrumlist->initialize(*os, parameters, &graph); - theoreticalspectrumlist->add(ts); + cTheoreticalSpectrum ts; + ts.setParameters(¶meters); + ts.generateMSSpectrum(); + + for (int i = 0; i < parameters.peaklistseries.size(); i++) { + *os << i + 1 << " "; + if ((i + 1) % 25 == 0) { + *os << endl; + } + + if (terminatecomputation) { + emitEndSignals(); + return; + } + + cTheoreticalSpectrum tstmp; + tstmp = ts; + tstmp.compareMSSpectrum(parameters.peaklistseries[i]); + theoreticalspectrumlist->add(tstmp); + } + *os << " ok" << endl; } diff --git a/CycloBranch/gui/cMainWindow.cpp b/CycloBranch/gui/cMainWindow.cpp index 217ddcf..63c15a9 100644 --- a/CycloBranch/gui/cMainWindow.cpp +++ b/CycloBranch/gui/cMainWindow.cpp @@ -76,6 +76,12 @@ cMainWindow::cMainWindow() { actionDrawPeptide = new QAction(QIcon(":/images/icons/96.png"), tr("Draw &Peptide"), this); actionDrawPeptide->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P)); + actionNorine = new QAction(QIcon(":/images/icons/25.png"), tr("&Norine"), this); + actionNorine->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); + + actionSmilesToMonomers = new QAction(QIcon(":/images/icons/5.png"), tr("Smiles2Monome&rs"), this); + actionSmilesToMonomers->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T)); + actionShowIsomers = new QAction(QIcon(":/images/icons/95.png"), tr("Show &Isomers"), this); actionShowIsomers->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I)); @@ -117,6 +123,9 @@ cMainWindow::cMainWindow() { toolbarTools->addAction(actionSequenceDatabase); toolbarTools->addAction(actionModifications); toolbarTools->addAction(actionDrawPeptide); + toolbarTools->addSeparator(); + toolbarTools->addAction(actionNorine); + toolbarTools->addAction(actionSmilesToMonomers); toolbarView = addToolBar(tr("View")); toolbarView->addAction(actionShowIsomers); @@ -131,14 +140,18 @@ cMainWindow::cMainWindow() { rowsfilterline = new QLineEdit(); rowsfilterline->setMinimumWidth(250); rowsfilterline->setToolTip("Text to Find"); + rowsfiltercasesensitive = new QCheckBox(); rowsfiltercasesensitive->setToolTip("Case Sensitive"); + rowsfilterbutton = new QPushButton("Filter"); rowsfilterbutton->setToolTip("Filter Search Results"); rowsfilterbutton->setMinimumWidth(50); + rowsfilterclearbutton = new QPushButton("Clear"); rowsfilterclearbutton->setToolTip("Clear Form and Reset Search Results"); rowsfilterclearbutton->setMinimumWidth(50); + rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); rowsfilterhbox = new QHBoxLayout(); rowsfilterhbox->addWidget(rowsfilterline); @@ -170,6 +183,7 @@ cMainWindow::cMainWindow() { modificationswidget = new cModificationsWidget(); drawpeptidewidget = new cDrawPeptideWidget(this); parameterswidget = new cParametersWidget(this); + htmlexportdialog = new cHTMLExportDialog(this); // additional key shortcuts // actionOpen->setShortcut(QKeySequence("Ctrl+O")); @@ -188,6 +202,8 @@ cMainWindow::cMainWindow() { connect(actionSequenceDatabase, SIGNAL(triggered()), this, SLOT(showSequenceDatabase())); connect(actionModifications, SIGNAL(triggered()), this, SLOT(showModifications())); connect(actionDrawPeptide, SIGNAL(triggered()), this, SLOT(showDrawPeptideWidget())); + connect(actionNorine, SIGNAL(triggered()), this, SLOT(gotoNorine())); + connect(actionSmilesToMonomers, SIGNAL(triggered()), this, SLOT(gotoSmiles2Monomers())); connect(actionShowIsomers, SIGNAL(triggered()), this, SLOT(updateSpectra())); connect(actionGraph, SIGNAL(triggered()), this, SLOT(showGraph())); connect(actionLog, SIGNAL(triggered()), this, SLOT(showHideLog())); @@ -216,6 +232,9 @@ cMainWindow::cMainWindow() { menuTools->addAction(actionModifications); menuTools->addSeparator(); menuTools->addAction(actionDrawPeptide); + menuTools->addSeparator(); + menuTools->addAction(actionNorine); + menuTools->addAction(actionSmilesToMonomers); menuView->addAction(actionShowIsomers); menuView->addSeparator(); menuView->addAction(actionGraph); @@ -299,6 +318,7 @@ cMainWindow::~cMainWindow() { delete modificationswidget; delete drawpeptidewidget; delete parameterswidget; + delete htmlexportdialog; delete actionOpenResults; delete actionSaveResults; @@ -311,6 +331,8 @@ cMainWindow::~cMainWindow() { delete actionSequenceDatabase; delete actionModifications; delete actionDrawPeptide; + delete actionNorine; + delete actionSmilesToMonomers; delete actionShowIsomers; delete actionGraph; delete actionLog; @@ -339,6 +361,14 @@ void cMainWindow::keyPressEvent(QKeyEvent *event) { } } } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_F)) { + rowsfilterline->setFocus(); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_N)) { + rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked()); + } } @@ -405,7 +435,7 @@ void cMainWindow::reportSpectrum(int id, cTheoreticalSpectrum& theoreticalspectr results->item(row, 3 + dbsearchspecificcolumncount)->setData(Qt::DisplayRole, formula.isPartial()?string(formula.getSummary() + " (partial)").c_str():formula.getSummary().c_str()); results->setItem(row, 4 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); - results->item(row, 4 + dbsearchspecificcolumncount)->setData(Qt::DisplayRole, to_string(formula.getMass()).c_str()); + results->item(row, 4 + dbsearchspecificcolumncount)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(formula.getMass())); results->setItem(row, 5 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->item(row, 5 + dbsearchspecificcolumncount)->setData(Qt::DisplayRole, getNumberOfBricks(theoreticalspectrum.getCandidate().getComposition())); @@ -413,6 +443,10 @@ void cMainWindow::reportSpectrum(int id, cTheoreticalSpectrum& theoreticalspectr switch (parameters.peptidetype) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif + case linearpolysaccharide: results->setItem(row, 6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->item(row, 6 + dbsearchspecificcolumncount)->setText(parameters.searchedmodifications[theoreticalspectrum.getCandidate().getStartModifID()].name.c_str()); results->setItem(row, 7 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); @@ -427,19 +461,16 @@ void cMainWindow::reportSpectrum(int id, cTheoreticalSpectrum& theoreticalspectr results->item(row, 8 + dbsearchspecificcolumncount)->setText(parameters.searchedmodifications[theoreticalspectrum.getCandidate().getEndModifID()].name.c_str()); break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif results->setItem(row, 6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->item(row, 6 + dbsearchspecificcolumncount)->setData(Qt::DisplayRole, theoreticalspectrum.getNumberOfMatchedBricks()); break; - case lasso: + case branchcyclic: results->setItem(row, 6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->item(row, 6 + dbsearchspecificcolumncount)->setText(parameters.searchedmodifications[theoreticalspectrum.getCandidate().getMiddleModifID()].name.c_str()); break; - case linearpolysaccharide: - results->setItem(row, 6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); - results->item(row, 6 + dbsearchspecificcolumncount)->setText(parameters.searchedmodifications[theoreticalspectrum.getCandidate().getStartModifID()].name.c_str()); - results->setItem(row, 7 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); - results->item(row, 7 + dbsearchspecificcolumncount)->setText(parameters.searchedmodifications[theoreticalspectrum.getCandidate().getEndModifID()].name.c_str()); - break; case other: default: break; @@ -449,10 +480,10 @@ void cMainWindow::reportSpectrum(int id, cTheoreticalSpectrum& theoreticalspectr results->item(row, 6 + dbsearchspecificcolumncount + resultsspecificcolumncount)->setData(Qt::DisplayRole, theoreticalspectrum.getNumberOfMatchedPeaks()); results->setItem(row, 7 + dbsearchspecificcolumncount + resultsspecificcolumncount, widgetitemallocator.getNewItem()); - results->item(row, 7 + dbsearchspecificcolumncount + resultsspecificcolumncount)->setData(Qt::DisplayRole, to_string(theoreticalspectrum.getRatioOfMatchedPeaks()*100).c_str()); + results->item(row, 7 + dbsearchspecificcolumncount + resultsspecificcolumncount)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(theoreticalspectrum.getRatioOfMatchedPeaks()*100)); results->setItem(row, 8 + dbsearchspecificcolumncount + resultsspecificcolumncount, widgetitemallocator.getNewItem()); - results->item(row, 8 + dbsearchspecificcolumncount + resultsspecificcolumncount)->setData(Qt::DisplayRole, to_string(theoreticalspectrum.getWeightedIntensityScore()).c_str()); + results->item(row, 8 + dbsearchspecificcolumncount + resultsspecificcolumncount)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(theoreticalspectrum.getWeightedIntensityScore())); for (int i = 0; i < (int)parameters.fragmentionsfortheoreticalspectra.size(); i++) { results->setItem(row, resultsbasecolumncount + dbsearchspecificcolumncount + resultsspecificcolumncount + i, widgetitemallocator.getNewItem()); @@ -479,15 +510,28 @@ void cMainWindow::reportSpectrum(int id, cTheoreticalSpectrum& theoreticalspectr results->item(row, 2)->setData(Qt::DisplayRole, theoreticalspectrum.getNumberOfMatchedPeaks()); results->setItem(row, 3, widgetitemallocator.getNewItem()); - results->item(row, 3)->setData(Qt::DisplayRole, to_string(theoreticalspectrum.getRatioOfMatchedPeaks()*100).c_str()); + results->item(row, 3)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(theoreticalspectrum.getRatioOfMatchedPeaks()*100)); results->setItem(row, 4, widgetitemallocator.getNewItem()); - results->item(row, 4)->setData(Qt::DisplayRole, to_string(theoreticalspectrum.getWeightedIntensityScore()).c_str()); + results->item(row, 4)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(theoreticalspectrum.getWeightedIntensityScore())); + + if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) { + results->setItem(row, 5, widgetitemallocator.getNewItem()); + results->item(row, 5)->setData(Qt::DisplayRole, theoreticalspectrum.getExperimentalSpectrum().getCoordinateX()); + + results->setItem(row, 6, widgetitemallocator.getNewItem()); + results->item(row, 6)->setData(Qt::DisplayRole, theoreticalspectrum.getExperimentalSpectrum().getCoordinateY()); + } } - spectradetails[id].initialize(¶meters, theoreticalspectrum); - spectradetails[id].setWindowTitle(("Theoretical Spectrum No. " + to_string(row+1)).c_str()); + spectradetails[id].initialize(¶meters, theoreticalspectrum, this); + if (parameters.mode == dereplication) { + spectradetails[id].setWindowTitle(("Experimental Spectrum No. " + to_string(row+1)).c_str()); + } + else { + spectradetails[id].setWindowTitle(("Theoretical Spectrum No. " + to_string(row+1)).c_str()); + } } @@ -615,14 +659,13 @@ void cMainWindow::enableButtonsHandlingResults(bool enable) { actionSaveResults->setEnabled(enable); actionExportToCsv->setEnabled(enable); actionExportToHTML->setEnabled(enable); + rowsfilterwidget->setEnabled(enable); if (parameters.mode == dereplication) { actionShowIsomers->setEnabled(false); - rowsfilterwidget->setEnabled(false); } else { actionShowIsomers->setEnabled(enable); - rowsfilterwidget->setEnabled(enable); } } @@ -641,20 +684,24 @@ void cMainWindow::reportSpectra() { switch (parameters.peptidetype) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif + case linearpolysaccharide: resultsspecificcolumncount = 2; break; case branched: resultsspecificcolumncount = 3; break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif resultsspecificcolumncount = 1; break; - case lasso: + case branchcyclic: resultsspecificcolumncount = 1; break; - case linearpolysaccharide: - resultsspecificcolumncount = 2; - break; case other: default: break; @@ -696,6 +743,7 @@ void cMainWindow::reportSpectra() { results->setHorizontalHeaderItem(4 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(4 + dbsearchspecificcolumncount)->setText("Monoisotopic Mass"); + results->setItemDelegateForColumn(4 + dbsearchspecificcolumncount, &columndelegate); results->setHorizontalHeaderItem(5 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(5 + dbsearchspecificcolumncount)->setText("Number of Bricks"); @@ -703,6 +751,7 @@ void cMainWindow::reportSpectra() { switch (parameters.peptidetype) { case linear: + case linearpolysaccharide: results->setHorizontalHeaderItem(6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(6 + dbsearchspecificcolumncount)->setText("N-terminal Modification"); results->setHorizontalHeaderItem(7 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); @@ -717,19 +766,24 @@ void cMainWindow::reportSpectra() { results->horizontalHeaderItem(8 + dbsearchspecificcolumncount)->setText("C-terminal Modification"); break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif results->setHorizontalHeaderItem(6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(6 + dbsearchspecificcolumncount)->setText("Matched Bricks"); break; - case lasso: + case branchcyclic: results->setHorizontalHeaderItem(6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(6 + dbsearchspecificcolumncount)->setText("Branch Modification"); break; - case linearpolysaccharide: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: results->setHorizontalHeaderItem(6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); - results->horizontalHeaderItem(6 + dbsearchspecificcolumncount)->setText("N-terminal Modification"); + results->horizontalHeaderItem(6 + dbsearchspecificcolumncount)->setText("Left Terminal Modification"); results->setHorizontalHeaderItem(7 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); - results->horizontalHeaderItem(7 + dbsearchspecificcolumncount)->setText("C-terminal Modification"); + results->horizontalHeaderItem(7 + dbsearchspecificcolumncount)->setText("Right Terminal Modification"); break; +#endif case other: default: break; @@ -740,13 +794,15 @@ void cMainWindow::reportSpectra() { results->setHorizontalHeaderItem(7 + dbsearchspecificcolumncount + resultsspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(7 + dbsearchspecificcolumncount + resultsspecificcolumncount)->setText("Ratio of Matched Peaks [%]"); + results->setItemDelegateForColumn(7 + dbsearchspecificcolumncount + resultsspecificcolumncount, &columndelegate); results->setHorizontalHeaderItem(8 + dbsearchspecificcolumncount + resultsspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(8 + dbsearchspecificcolumncount + resultsspecificcolumncount)->setText("Sum of Relative Intensities"); + results->setItemDelegateForColumn(8 + dbsearchspecificcolumncount + resultsspecificcolumncount, &columndelegate); for (int i = 0; i < (int)parameters.fragmentionsfortheoreticalspectra.size(); i++) { results->setHorizontalHeaderItem(resultsbasecolumncount + dbsearchspecificcolumncount + resultsspecificcolumncount + i, widgetitemallocator.getNewItem()); - results->horizontalHeaderItem(resultsbasecolumncount + dbsearchspecificcolumncount + resultsspecificcolumncount + i)->setText(parameters.fragmentdefinitions[(fragmentIonType)parameters.fragmentionsfortheoreticalspectra[i]].name.c_str()); + results->horizontalHeaderItem(resultsbasecolumncount + dbsearchspecificcolumncount + resultsspecificcolumncount + i)->setText(parameters.fragmentdefinitions[(eFragmentIonType)parameters.fragmentionsfortheoreticalspectra[i]].name.c_str()); } if ((parameters.peptidetype == cyclic) && parameters.enablescrambling) { @@ -758,17 +814,37 @@ void cMainWindow::reportSpectra() { if (parameters.mode == dereplication) { - results->setColumnCount(5); + if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) { + results->setColumnCount(7); + } + else { + results->setColumnCount(5); + } + results->setHorizontalHeaderItem(0, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(0)->setText("*"); + results->setHorizontalHeaderItem(1, widgetitemallocator.getNewItem()); - results->horizontalHeaderItem(1)->setText("Result ID"); + results->horizontalHeaderItem(1)->setText("Spectrum ID"); + results->setHorizontalHeaderItem(2, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(2)->setText("Matched Peaks"); + results->setHorizontalHeaderItem(3, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(3)->setText("Ratio of Matched Peaks [%]"); + results->setItemDelegateForColumn(3, &columndelegate); + results->setHorizontalHeaderItem(4, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(4)->setText("Sum of Relative Intensities"); + results->setItemDelegateForColumn(4, &columndelegate); + + if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) { + results->setHorizontalHeaderItem(5, widgetitemallocator.getNewItem()); + results->horizontalHeaderItem(5)->setText("Coordinate X"); + + results->setHorizontalHeaderItem(6, widgetitemallocator.getNewItem()); + results->horizontalHeaderItem(6)->setText("Coordinate Y"); + } } @@ -882,7 +958,7 @@ void cMainWindow::exportToCsv() { if (!filename.isEmpty()) { lastdirexporttocsv = filename; - QProgressDialog progress("Exporting the CSV file...", /*"Cancel"*/0, 0, results->rowCount(), this); + QProgressDialog progress("Exporting CSV file...", /*"Cancel"*/0, 0, results->rowCount(), this); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -933,12 +1009,16 @@ void cMainWindow::exportToCsv() { void cMainWindow::exportToHTML() { + if (htmlexportdialog->exec() != QDialog::Accepted) { + return; + } + QString filename = QFileDialog::getSaveFileName(this, tr("Export to HTML"), lastdirexporttohtml, tr("HTML Files (*.htm *.html)")); - if (!filename.isEmpty()) { + if (!filename.isEmpty()) { lastdirexporttohtml = filename; - - QProgressDialog progress("Exporting the HTML report...", /*"Cancel"*/0, 0, results->rowCount(), this); + + QProgressDialog progress("Exporting HTML report...", /*"Cancel"*/0, 0, results->rowCount(), this); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -959,83 +1039,187 @@ void cMainWindow::exportToHTML() { out << "\n"; out << "\n"; out << "" << QString(title.c_str()) << "\n"; - out << "\n"; - - out << ""; + + out << "\n"; + out << "\n"; + out << "\n"; + out << ""; out << "\n"; out << "\n"; out << "

" << QString(title.c_str()) << "

\n"; - out << "

Results

\n"; + if (htmlexportdialog->checkboxparameters->isChecked()) { + out << "

Parameters

\n"; + out << "

\n" << parameters.printToString().c_str() << "

\n"; + out << "
\n"; + } - out << "

Hint: Click on a row to expand details about a peptide sequence candidate.

"; + if (htmlexportdialog->checkboxdenovo->isChecked() && (parameters.mode == denovoengine)) { + out << "

De Novo Graph

\n"; + out << "

\n" << graph->getHTML().c_str() << "

\n"; + out << "
\n"; + } - out << "

\n\n"; - for (int i = 0; i < results->columnCount(); i++) { - out << "\n"; + if (htmlexportdialog->checkboxlogwindow->isChecked()) { + out << "

Log Window

\n"; + out << "

\n" << logWindow->toPlainText() << "

\n"; + out << "
\n"; } - out << "\n"; - int spectrumindex; - for (int i = 0; i < results->rowCount(); i++) { + if (htmlexportdialog->checkboxsummaryresultstable->isChecked()) { + out << "

Output Report Table

\n"; - if (results->isRowHidden(i)) { - continue; + out << "

" << results->horizontalHeaderItem(i)->text() << "
\n\n"; + for (int i = 0; i < results->columnCount(); i++) { + out << "\n"; } + out << "\n"; - spectrumindex = results->item(i, 1)->data(Qt::DisplayRole).toInt() - 1; + for (int i = 0; i < results->rowCount(); i++) { - out << "\n"; + if (results->isRowHidden(i)) { + continue; + } + + out << "\n"; - matchedrow = false; - if (results->item(i, 0)->data(Qt::DisplayRole).toString().compare("*") == 0) { - matchedrow = true; + matchedrow = false; + if (results->item(i, 0)->data(Qt::DisplayRole).toString().compare("*") == 0) { + matchedrow = true; + } + + for (int j = 0; j < results->columnCount(); j++) { + out << "" << results->item(i, j)->data(Qt::DisplayRole).toString() << "\n"; + } + + out << "\n"; + } + out << "
" << results->horizontalHeaderItem(i)->text() << "

\n"; + out << "

\n"; + } - for (int j = 0; j < results->columnCount(); j++) { - out << "checkboxsummarypeakstable->isChecked()) { + out << "

Summary Table of Matched Peaks

\n"; + + out << "

"; + + int columncount; + string tdwidth; + if (parameters.mode == dereplication) { + if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) { + columncount = 11; + } + else { + columncount = 9; } - out << ">" << results->item(i, j)->data(Qt::DisplayRole).toString() << "\n"; + } + else { + columncount = 7; } - out << "\n"; + tdwidth = to_string(100/columncount); - out << ""; - out << "

" << spectradetails[spectrumindex].getTheoreticalSpectrum().getCoverageBySeries().c_str(); - out << "
" << spectradetails[spectrumindex].getDetailsAsHTMLString().c_str() << "

\n"; + if (parameters.mode == dereplication) { + if ((parameters.peaklistfileformat == mis) || (parameters.peaklistfileformat == imzML)) { + out << ""; + out << ""; + } + out << ""; + } + else { + out << ""; + } - out << "\n"; + out << ""; + out << ""; + out << ""; + out << ""; + + if (parameters.mode == dereplication) { + out << ""; + out << ""; + out << ""; + } + else { + out << ""; + } + + out << ""; + + int spectrumindex; + for (int i = 0; i < results->rowCount(); i++) { + + if (results->isRowHidden(i)) { + continue; + } + + spectrumindex = results->item(i, 1)->data(Qt::DisplayRole).toInt() - 1; + + if (spectradetails[spectrumindex].getTheoreticalSpectrum().getNumberOfMatchedPeaks() == 0) { + continue; + } + + out << spectradetails[spectrumindex].getPartialPeaksTableAsHTMLString(spectrumindex).c_str(); + + } + + out << "
columnCount(); - out << "\">\n"; + out << "IDCoordinate XCoordinate YIon TypeFragment Type
Theoretical m/zExperimental m/zIntensity [%]Error [ppm]Summary FormulaNameReferenceSequence

"; + out << "

\n"; - progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} } - out << "

\n"; - out << "

Parameters

\n"; + if (htmlexportdialog->checkboxdetails->isChecked() || htmlexportdialog->checkboxpeakstable->isChecked()) { + out << "

Individual Rows in Output Report Table

\n"; + + int spectrumindex; + for (int i = 0; i < results->rowCount(); i++) { - out << "

\n" << parameters.printToString().c_str() << "

"; + if (results->isRowHidden(i)) { + continue; + } - if (parameters.mode == denovoengine) { + spectrumindex = results->item(i, 1)->data(Qt::DisplayRole).toInt() - 1; - out << "

De Novo Graph

\n"; + if ((spectradetails[spectrumindex].getTheoreticalSpectrum().getNumberOfMatchedPeaks() == 0) && !htmlexportdialog->checkboxunmatchedtheoretical->isChecked() && !htmlexportdialog->checkboxunmatchedexperimental->isChecked()) { + continue; + } - out << "

\n" << graph->getHTML().c_str() << "

"; + out << "

ID: "; + out << spectrumindex + 1; + out << "

\n"; + if (htmlexportdialog->checkboxpeakstable->isChecked()) { + out << "

"; + out << spectradetails[spectrumindex].getPeaksTableAsHTMLString(htmlexportdialog->checkboxunmatchedtheoretical->isChecked(), htmlexportdialog->checkboxunmatchedexperimental->isChecked()).c_str(); + out << "

\n"; + } + + if (htmlexportdialog->checkboxdetails->isChecked()) { + out << ""; + out << "

"; + out << spectradetails[spectrumindex].getDetailsAsHTMLString().c_str(); + out << spectradetails[spectrumindex].getTheoreticalSpectrum().getCoverageBySeries().c_str(); + out << "

"; + out << "
\n"; + } + + out << "

\n"; + + progress.setValue(i); + //if (progress.wasCanceled()) { + // break; + //} + } + } out << "\n"; @@ -1194,11 +1378,9 @@ void cMainWindow::openResultsFile() { if (parameters.mode == dereplication) { actionShowIsomers->setEnabled(false); - rowsfilterwidget->setEnabled(false); } else { actionShowIsomers->setEnabled(true); - rowsfilterwidget->setEnabled(true); } // load theoretical spectra @@ -1315,6 +1497,16 @@ void cMainWindow::resetFilter() { } +void cMainWindow::gotoNorine() { + QDesktopServices::openUrl(QUrl("http://bioinfo.lifl.fr/norine/")); +} + + +void cMainWindow::gotoSmiles2Monomers() { + QDesktopServices::openUrl(QUrl("http://bioinfo.lifl.fr/norine/smiles2monomers.jsp")); +} + + /* void cMainWindow::showContextMenu(const QPoint &pt) { QMenu *menu = logWindow->createStandardContextMenu(); diff --git a/CycloBranch/gui/cMainWindow.h b/CycloBranch/gui/cMainWindow.h index 259d309..503cac3 100644 --- a/CycloBranch/gui/cMainWindow.h +++ b/CycloBranch/gui/cMainWindow.h @@ -12,6 +12,7 @@ #include #include #include "core/utilities.h" +#include "core/cAllocator.h" #include "core/cTheoreticalSpectrum.h" #include "gui/cAboutWidget.h" #include "gui/cGraphWidget.h" @@ -22,7 +23,8 @@ #include "gui/cModificationsWidget.h" #include "gui/cDrawPeptideWidget.h" #include "gui/cMainThread.h" -#include "core/cAllocator.h" +#include "gui/cDelegate.h" +#include "gui/cHTMLExportDialog.h" // forward declaration @@ -95,6 +97,8 @@ class cMainWindow : public QMainWindow QAction* actionSequenceDatabase; QAction* actionModifications; QAction *actionDrawPeptide; + QAction *actionNorine; + QAction *actionSmilesToMonomers; QAction* actionShowIsomers; QAction* actionGraph; QAction* actionLog; @@ -125,12 +129,14 @@ class cMainWindow : public QMainWindow cModificationsWidget* modificationswidget; cDrawPeptideWidget* drawpeptidewidget; cParametersWidget* parameterswidget; + cHTMLExportDialog* htmlexportdialog; int resultsbasecolumncount; int resultsspecificcolumncount; int dbsearchspecificcolumncount; vector resultsheadersort; + cDelegate columndelegate; QString lastdirexporttocsv; QString lastdirexporttohtml; @@ -218,6 +224,10 @@ private slots: void resetFilter(); + void gotoNorine(); + + void gotoSmiles2Monomers(); + //void showContextMenu(const QPoint &pt); signals: diff --git a/CycloBranch/gui/cModificationsWidget.cpp b/CycloBranch/gui/cModificationsWidget.cpp index 2b3b1f2..2581d28 100644 --- a/CycloBranch/gui/cModificationsWidget.cpp +++ b/CycloBranch/gui/cModificationsWidget.cpp @@ -25,29 +25,41 @@ cModificationsWidget::cModificationsWidget(QWidget* parent) { insertrow = new QPushButton(tr("Add Row")); insertrow->setToolTip("Add a new row."); + insertrow->setShortcut(QKeySequence(Qt::Key_Insert)); + removechecked = new QPushButton(tr(" Remove Rows ")); removechecked->setToolTip("Remove selected rows."); + removechecked->setShortcut(QKeySequence(Qt::Key_Delete)); close = new QPushButton(tr("Close")); close->setToolTip("Close the window."); + load = new QPushButton(tr("Load")); load->setToolTip("Load modifications."); + load->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + save = new QPushButton(QString(" Save ")); save->setToolTip("Save modifications in the current file. When a file has not been loaded yet, the \"Save As ...\" file dialog is opened."); + saveas = new QPushButton(tr("Save As...")); saveas->setToolTip("Save modifications into a file."); + saveas->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); rowsfilterline = new QLineEdit(); rowsfilterline->setMinimumWidth(250); rowsfilterline->setToolTip("Text to Find"); + rowsfiltercasesensitive = new QCheckBox(); rowsfiltercasesensitive->setToolTip("Case Sensitive"); + rowsfilterbutton = new QPushButton("Filter"); rowsfilterbutton->setToolTip("Filter Search Results"); rowsfilterbutton->setMinimumWidth(50); + rowsfilterclearbutton = new QPushButton("Clear"); rowsfilterclearbutton->setToolTip("Clear Form and Reset Search Results"); rowsfilterclearbutton->setMinimumWidth(50); + rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); rowsfilterhbox = new QHBoxLayout(); rowsfilterhbox->addWidget(rowsfilterline); @@ -80,6 +92,7 @@ cModificationsWidget::cModificationsWidget(QWidget* parent) { database->setHorizontalHeaderItem(1, new QTableWidgetItem("Name")); database->setHorizontalHeaderItem(2, new QTableWidgetItem("Summary Formula")); database->setHorizontalHeaderItem(3, new QTableWidgetItem("Monoisotopic Mass")); + database->setItemDelegateForColumn(3, &columndelegate); database->setHorizontalHeaderItem(4, new QTableWidgetItem("N-terminal")); database->setHorizontalHeaderItem(5, new QTableWidgetItem("C-terminal")); database->horizontalHeader()->setStretchLastSection(true); @@ -235,7 +248,7 @@ bool cModificationsWidget::checkFormula(int row, const string& summary) { return false; } if (database->item(row, 3)) { - database->item(row, 3)->setData(Qt::DisplayRole, to_string(formula.getMass()).c_str()); + database->item(row, 3)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(formula.getMass())); } return true; } @@ -269,6 +282,26 @@ void cModificationsWidget::keyPressEvent(QKeyEvent *event) { filterRows(); } } + + if (event->key() == Qt::Key_F1) { + #if OS_TYPE == WIN + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/modificationseditor.html").absoluteFilePath())); + #else + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/modificationseditor.html").absoluteFilePath())); + #endif + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_F)) { + rowsfilterline->setFocus(); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_N)) { + rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked()); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_S)) { + saveDatabase(); + } } @@ -330,7 +363,7 @@ void cModificationsWidget::loadDatabase() { database->item(i, 2)->setText(modifications[i].summary.c_str()); database->setItem(i, 3, widgetitemallocator.getNewItem()); - database->item(i, 3)->setData(Qt::DisplayRole, to_string(modifications[i].massdifference).c_str()); + database->item(i, 3)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(modifications[i].massdifference)); checkbox = new QCheckBox(); connect(checkbox, SIGNAL(stateChanged(int)), this, SLOT(checkBoxModified(int))); diff --git a/CycloBranch/gui/cModificationsWidget.h b/CycloBranch/gui/cModificationsWidget.h index ff9fd69..39a4be5 100644 --- a/CycloBranch/gui/cModificationsWidget.h +++ b/CycloBranch/gui/cModificationsWidget.h @@ -8,11 +8,16 @@ #define _CMODIFICATIONSWIDGET_H #include +#include +#include +#include #include #include "core/utilities.h" #include "core/cFragmentIons.h" #include "core/cSummaryFormula.h" #include "core/cAllocator.h" +#include "gui/cDelegate.h" + using namespace std; @@ -85,6 +90,7 @@ class cModificationsWidget : public QWidget vector modifications; vector headersort; + cDelegate columndelegate; cAllocator widgetitemallocator; diff --git a/CycloBranch/gui/cParametersWidget.cpp b/CycloBranch/gui/cParametersWidget.cpp index dff9ca3..9a95e53 100644 --- a/CycloBranch/gui/cParametersWidget.cpp +++ b/CycloBranch/gui/cParametersWidget.cpp @@ -35,12 +35,17 @@ cParametersWidget::cParametersWidget(QWidget* parent) { stdbuttons->button(QDialogButtonBox::Ok)->setToolTip("Accept changes and hide window."); stdbuttons->button(QDialogButtonBox::Apply)->setToolTip("Accept changes and keep window opened."); stdbuttons->button(QDialogButtonBox::Cancel)->setToolTip("Drop changes and hide window."); + load = new QPushButton(tr("Load")); load->setToolTip("Load settings from a file (*.ini)."); + load->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + save = new QPushButton(QString("Save")); save->setToolTip("Save settings in the current file (*.ini). When a file has not been loaded yet, the \"Save As ...\" file dialog is opened."); + saveas = new QPushButton(tr("Save As...")); saveas->setToolTip("Save settings into a file (*.ini)."); + saveas->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); buttons = new QHBoxLayout(); buttons->addWidget(stdbuttons); @@ -58,6 +63,10 @@ cParametersWidget::cParametersWidget(QWidget* parent) { peptidetype->addItem(tr("Cyclic")); peptidetype->addItem(tr("Branched")); peptidetype->addItem(tr("Branch-cyclic")); +#if POLYKETIDE_SIDEROPHORES == 1 + peptidetype->addItem(tr("Linear oligoketide siderophore")); + peptidetype->addItem(tr("Cyclic oligoketide siderophore")); +#endif peptidetype->addItem(tr("Linear polysaccharide (beta version)")); //peptidetype->addItem(tr("Other")); peaklistformlayout->addRow(tr("Peptide Type: "), peptidetype); @@ -65,12 +74,13 @@ cParametersWidget::cParametersWidget(QWidget* parent) { peaklistline = new QLineEdit(); peaklistbutton = new QPushButton("Select"); #if OS_TYPE != WIN - peaklistline->setToolTip("Select the peaklist. Following formats are supported: txt, mgf, mzML, mzXML."); - peaklistbutton->setToolTip("Select the peaklist. Following formats are supported: txt, mgf, mzML, mzXML."); + peaklistline->setToolTip("Select the peaklist. Following formats are supported: txt, mgf, mzML, mzXML, imzML."); + peaklistbutton->setToolTip("Select the peaklist. Following formats are supported: txt, mgf, mzML, mzXML, imzML."); #else - peaklistline->setToolTip("Select the peaklist. Following formats are supported: txt, mgf, mzML, mzXML, baf."); - peaklistbutton->setToolTip("Select the peaklist. Following formats are supported: txt, mgf, mzML, mzXML, baf."); + peaklistline->setToolTip("Select the peaklist. Following formats are supported: txt, mgf, mzML, mzXML, baf, mis, imzML."); + peaklistbutton->setToolTip("Select the peaklist. Following formats are supported: txt, mgf, mzML, mzXML, baf, mis, imzML."); #endif + peaklistbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P)); peaklistlayout = new QHBoxLayout(); peaklistlayout->addWidget(peaklistline); peaklistlayout->addWidget(peaklistbutton); @@ -102,20 +112,20 @@ cParametersWidget::cParametersWidget(QWidget* parent) { peaklistformlayout->addRow(tr("Precursor m/z Error Tolerance: "), precursormasserrortolerance); fragmentmasserrortolerance = new QDoubleSpinBox(); - fragmentmasserrortolerance->setToolTip("Enter the fragment m/z error tolerance in ppm."); + fragmentmasserrortolerance->setToolTip("Enter the m/z error tolerance in MS mode or the fragment m/z error tolerance in MS/MS mode [ppm]."); fragmentmasserrortolerance->setDecimals(3); fragmentmasserrortolerance->setRange(0, 10000); fragmentmasserrortolerance->setSingleStep(1); fragmentmasserrortolerance->setSuffix(" ppm"); - peaklistformlayout->addRow(tr("Fragment m/z Error Tolerance: "), fragmentmasserrortolerance); + peaklistformlayout->addRow(tr("m/z Error Tolerance: "), fragmentmasserrortolerance); masserrortolerancefordeisotoping = new QDoubleSpinBox(); - masserrortolerancefordeisotoping->setToolTip("Enter the fragment m/z error tolerance for deisotoping in ppm (the same value like \"Fragment m/z Error Tolerance\" is recommended by default; 0 = the deisotoping is disabled)."); + masserrortolerancefordeisotoping->setToolTip("Enter the m/z error tolerance for deisotoping in MS mode or the fragment m/z error tolerance for deisotoping in MS/MS mode [ppm]\n(the same value like \"m/z Error Tolerance\" is recommended by default; 0 = the deisotoping is disabled)."); masserrortolerancefordeisotoping->setDecimals(3); masserrortolerancefordeisotoping->setRange(0, 10000); masserrortolerancefordeisotoping->setSingleStep(1); masserrortolerancefordeisotoping->setSuffix(" ppm"); - peaklistformlayout->addRow(tr("Fragment m/z Error Tolerance for Deisotoping: "), masserrortolerancefordeisotoping); + 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."); @@ -141,6 +151,7 @@ cParametersWidget::cParametersWidget(QWidget* parent) { brickdatabaseline->setToolTip("Select the txt file containing a list of building blocks."); brickdatabasebutton = new QPushButton("Select"); brickdatabasebutton->setToolTip("Select the txt file containing a list of building blocks."); + brickdatabasebutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); brickdatabaselayout = new QHBoxLayout(); brickdatabaselayout->addWidget(brickdatabaseline); brickdatabaselayout->addWidget(brickdatabasebutton); @@ -179,6 +190,7 @@ cParametersWidget::cParametersWidget(QWidget* parent) { modificationsline->setToolTip("Select the txt file containing a list of modifications."); modificationsbutton = new QPushButton("Select"); modificationsbutton->setToolTip("Select the txt file containing a list of modifications."); + modificationsbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); modificationslayout = new QHBoxLayout(); modificationslayout->addWidget(modificationsline); modificationslayout->addWidget(modificationsbutton); @@ -231,6 +243,7 @@ cParametersWidget::cParametersWidget(QWidget* parent) { sequencedatabaseline->setToolTip("Select the txt file containing a database of sequences."); sequencedatabasebutton = new QPushButton("Select"); sequencedatabasebutton->setToolTip("Select the txt file containing a database of sequences."); + sequencedatabasebutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T)); sequencedatabaselayout = new QHBoxLayout(); sequencedatabaselayout->addWidget(sequencedatabaseline); sequencedatabaselayout->addWidget(sequencedatabasebutton); @@ -266,8 +279,8 @@ cParametersWidget::cParametersWidget(QWidget* parent) { applicationformlayout->addRow(tr("Peptide Sequence Tag: "), sequencetag); fragmentiontypes = new cFragmentIonsListWidget(this); - fragmentiontypes->setToolTip("Select fragment ion types which will be generated in theoretical spectra of peptide sequence candidates."); - applicationformlayout->addRow(tr("Fragment Ion Types in Theoretical Spectra: "), fragmentiontypes); + fragmentiontypes->setToolTip("Select ion types which will be generated in theoretical spectra."); + 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)."); @@ -285,6 +298,7 @@ cParametersWidget::cParametersWidget(QWidget* parent) { searchedsequencebutton = new QPushButton("Edit"); searchedsequencebutton->setMinimumWidth(50); searchedsequencebutton->setToolTip("Edit the sequence using the 'Draw Peptide' tool."); + searchedsequencebutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); searchedsequencelayout = new QHBoxLayout(); searchedsequencelayout->addWidget(searchedsequenceline); searchedsequencelayout->addWidget(searchedsequencebutton); @@ -314,7 +328,6 @@ cParametersWidget::cParametersWidget(QWidget* parent) { vlayout2 = new QVBoxLayout(); vlayout2->addWidget(applicationgroupbox); vlayout2->addWidget(searchedsequencegroupbox); - hlayout = new QHBoxLayout(); hlayout->setContentsMargins(0, 0, 0, 0); @@ -322,10 +335,11 @@ cParametersWidget::cParametersWidget(QWidget* parent) { hlayout->addLayout(vlayout2); hlayoutwidget = new QWidget(); + hlayoutwidget->setMinimumWidth(1250); hlayoutwidget->setLayout(hlayout); hlayoutscroll = new QScrollArea(); - hlayoutscroll->setWidgetResizable(true); + hlayoutscroll->setWidgetResizable(false); hlayoutscroll->setFrameShape(QFrame::NoFrame); hlayoutscroll->setWidget(hlayoutwidget); @@ -466,7 +480,7 @@ void cParametersWidget::setAndRestoreParameters(cParameters& parameters) { this->parameters = parameters; this->parameters.bricksdatabase.clear(); - this->parameters.peaklist.clear(); + this->parameters.peaklistseries.clear(); this->parameters.fragmentionsfordenovograph.clear(); this->parameters.sequencetag = this->parameters.originalsequencetag; this->parameters.searchedsequence = this->parameters.originalsearchedsequence; @@ -496,6 +510,22 @@ void cParametersWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape) { restoreParameters(); } + + if ((event->key() == Qt::Key_Enter) || (event->key() == Qt::Key_Return)) { + updateParametersAndHide(); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_S)) { + saveSettings(); + } + + if (event->key() == Qt::Key_F1) { + #if OS_TYPE == WIN + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/basicconfiguration.html").absoluteFilePath())); + #else + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/basicconfiguration.html").absoluteFilePath())); + #endif + } } @@ -634,9 +664,9 @@ void cParametersWidget::saveSettingsAs() { void cParametersWidget::peaklistButtonReleased() { #if OS_TYPE != WIN - QString filename = QFileDialog::getOpenFileName(this, tr("Select Peaklist..."), lastdirselectpeaklist, tr("Peak Lists (*.txt *.mgf *.mzML *.mzXML)")); + 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)")); + QString filename = QFileDialog::getOpenFileName(this, tr("Select Peaklist..."), lastdirselectpeaklist, tr("Peak Lists (*.txt *.mgf *.mzML *.mzXML *.baf *.mis *.imzML)")); #endif if (!filename.isEmpty()) { @@ -687,14 +717,14 @@ bool cParametersWidget::updateParameters() { return false; } - if ((brickdatabaseline->text().toStdString().compare("") == 0) && (((modeType)mode->currentIndex() == denovoengine) || ((modeType)mode->currentIndex() == singlecomparison) || ((modeType)mode->currentIndex() == databasesearch))) { + if ((brickdatabaseline->text().toStdString().compare("") == 0) && (((eModeType)mode->currentIndex() == denovoengine) || ((eModeType)mode->currentIndex() == singlecomparison) || ((eModeType)mode->currentIndex() == databasesearch))) { errstr = "A database of building blocks must be specified!"; msgBox.setText(errstr); msgBox.exec(); return false; } - if ((sequencedatabaseline->text().toStdString().compare("") == 0) && (((modeType)mode->currentIndex() == databasesearch) || ((modeType)mode->currentIndex() == dereplication))) { + if ((sequencedatabaseline->text().toStdString().compare("") == 0) && (((eModeType)mode->currentIndex() == databasesearch) || ((eModeType)mode->currentIndex() == dereplication))) { errstr = "A sequence database must be specified!"; msgBox.setText(errstr); msgBox.exec(); @@ -709,7 +739,7 @@ bool cParametersWidget::updateParameters() { } /* - if ((maximumbricksincombinationmiddle->value() < 2) && ((modeType)mode->currentIndex() == denovoengine) && (((peptideType)peptidetype->currentIndex() == branched) || ((peptideType)peptidetype->currentIndex() == lasso))) { + if ((maximumbricksincombinationmiddle->value() < 2) && ((eModeType)mode->currentIndex() == denovoengine) && (((ePeptideType)peptidetype->currentIndex() == branched) || ((ePeptideType)peptidetype->currentIndex() == branchcyclic))) { errstr = "'Maximum Number of Combined Blocks (middle)' must be at least 2 when a branched or a branch-cyclic peptide is searched! (One block represents a branched residue, the other block(s) corresponds to a branch.)"; msgBox.setText(errstr); msgBox.exec(); @@ -717,7 +747,7 @@ bool cParametersWidget::updateParameters() { } */ - parameters.peptidetype = (peptideType)peptidetype->currentIndex(); + parameters.peptidetype = (ePeptideType)peptidetype->currentIndex(); parameters.peaklistfilename = peaklistline->text().toStdString(); parameters.precursormass = precursormass->value(); parameters.precursoradduct = precursoradduct->text().toStdString(); @@ -743,10 +773,10 @@ bool cParametersWidget::updateParameters() { parameters.enablescrambling = enablescrambling->isChecked(); parameters.similaritysearch = similaritysearch->isChecked(); - parameters.mode = (modeType)mode->currentIndex(); + parameters.mode = (eModeType)mode->currentIndex(); parameters.sequencedatabasefilename = sequencedatabaseline->text().toStdString(); parameters.maximumnumberofthreads = maximumnumberofthreads->value(); - parameters.scoretype = (scoreType)scoretype->currentIndex(); + parameters.scoretype = (eScoreType)scoretype->currentIndex(); parameters.hitsreported = hitsreported->value(); parameters.sequencetag = sequencetag->text().toStdString(); parameters.originalsequencetag = parameters.sequencetag; @@ -754,22 +784,26 @@ bool cParametersWidget::updateParameters() { parameters.fragmentionsfortheoreticalspectra.clear(); int start; - if ((modeType)mode->currentIndex() == dereplication) { + if ((eModeType)mode->currentIndex() == dereplication) { start = ms_hplus; } else { - switch ((peptideType)peptidetype->currentIndex()) + switch ((ePeptideType)peptidetype->currentIndex()) { case linear: case branched: - start = a_ion; - break; case cyclic: + case branchcyclic: start = a_ion; break; - case lasso: - start = a_ion; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + start = l1h_ion; + break; + case cyclicpolyketide: + start = l0h_ion; break; +#endif case linearpolysaccharide: start = ms_nterminal_ion_hplus; break; @@ -781,7 +815,7 @@ bool cParametersWidget::updateParameters() { for (int i = 0; i < fragmentiontypes->getList()->count(); i++) { if (fragmentiontypes->getList()->item(i)->isSelected()) { - parameters.fragmentionsfortheoreticalspectra.push_back((fragmentIonType)(i + start)); + parameters.fragmentionsfortheoreticalspectra.push_back((eFragmentIonType)(i + start)); } } @@ -850,14 +884,18 @@ void cParametersWidget::restoreParameters() { { case linear: case branched: - start = a_ion; - break; case cyclic: + case branchcyclic: start = a_ion; break; - case lasso: - start = a_ion; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + start = l1h_ion; break; + case cyclicpolyketide: + start = l0h_ion; + break; +#endif case linearpolysaccharide: start = ms_nterminal_ion_hplus; break; @@ -894,7 +932,7 @@ void cParametersWidget::updateSettingsWhenPeptideTypeChanged(int index) { resetFragmentIonTypes(); - switch ((peptideType)index) + switch ((ePeptideType)index) { case linear: modificationsline->setDisabled(false); @@ -926,7 +964,7 @@ void cParametersWidget::updateSettingsWhenPeptideTypeChanged(int index) { searchedsequenceCtermmodif->setDisabled(false); searchedsequenceTmodif->setDisabled(false); break; - case lasso: + case branchcyclic: modificationsline->setDisabled(false); modificationsbutton->setDisabled(false); cyclicnterminus->setDisabled(true); @@ -936,6 +974,28 @@ void cParametersWidget::updateSettingsWhenPeptideTypeChanged(int index) { searchedsequenceCtermmodif->setDisabled(true); searchedsequenceTmodif->setDisabled(false); break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + modificationsline->setDisabled(false); + modificationsbutton->setDisabled(false); + cyclicnterminus->setDisabled(true); + cycliccterminus->setDisabled(true); + enablescrambling->setDisabled(true); + searchedsequenceNtermmodif->setDisabled(false); + searchedsequenceCtermmodif->setDisabled(false); + searchedsequenceTmodif->setDisabled(true); + break; + case cyclicpolyketide: + modificationsline->setDisabled(true); + modificationsbutton->setDisabled(true); + cyclicnterminus->setDisabled(true); + cycliccterminus->setDisabled(true); + enablescrambling->setDisabled(true); + searchedsequenceNtermmodif->setDisabled(true); + searchedsequenceCtermmodif->setDisabled(true); + searchedsequenceTmodif->setDisabled(true); + break; +#endif case linearpolysaccharide: modificationsline->setDisabled(false); modificationsbutton->setDisabled(false); @@ -955,7 +1015,7 @@ void cParametersWidget::updateSettingsWhenPeptideTypeChanged(int index) { void cParametersWidget::updateSettingsWhenModeChanged(int index) { - switch ((modeType)index) + switch ((eModeType)index) { case denovoengine: peptidetype->setDisabled(false); @@ -1095,15 +1155,14 @@ void cParametersWidget::updateSettingsWhenModeChanged(int index) { void cParametersWidget::resetFragmentIonTypes() { fragmentiontypes->getList()->clear(); - fragmentIonType start, end; - - - if ((modeType)mode->currentIndex() == dereplication) { + eFragmentIonType start, end; + + if ((eModeType)mode->currentIndex() == dereplication) { start = ms_hplus; - end = ms_MFe4H; + end = ms_MGa4H; } else { - switch ((peptideType)peptidetype->currentIndex()) { + switch ((ePeptideType)peptidetype->currentIndex()) { case linear: case branched: start = a_ion; @@ -1113,10 +1172,20 @@ void cParametersWidget::resetFragmentIonTypes() { start = a_ion; end = c_ion_dehydrated_and_deamidated; break; - case lasso: + case branchcyclic: start = a_ion; end = z_ion_dehydrated_and_deamidated; break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + start = l1h_ion; + end = r2oh_ion_co_loss_dehydrated_and_deamidated; + break; + case cyclicpolyketide: + start = l0h_ion; + end = l2h_ion_co_loss_dehydrated_and_deamidated; + break; +#endif case linearpolysaccharide: start = ms_nterminal_ion_hplus; end = ms_cterminal_ion_kplus; @@ -1129,33 +1198,47 @@ void cParametersWidget::resetFragmentIonTypes() { for (int i = (int)start; i <= (int)end; i++) { - fragmentiontypes->getList()->addItem(tr(parameters.fragmentdefinitions[(fragmentIonType)i].name.c_str())); + fragmentiontypes->getList()->addItem(tr(parameters.fragmentdefinitions[(eFragmentIonType)i].name.c_str())); - if ((modeType)mode->currentIndex() == dereplication) { - if ((fragmentIonType)i == ms_hplus) { + if ((eModeType)mode->currentIndex() == dereplication) { + if ((eFragmentIonType)i == ms_hplus) { fragmentiontypes->getList()->item(i-start)->setSelected(true); } } else { - switch ((peptideType)peptidetype->currentIndex()) { + switch ((ePeptideType)peptidetype->currentIndex()) { case linear: case branched: - if (((fragmentIonType)i == b_ion) || ((fragmentIonType)i == y_ion)) { + if (((eFragmentIonType)i == b_ion) || ((eFragmentIonType)i == y_ion)) { fragmentiontypes->getList()->item(i-start)->setSelected(true); } break; case cyclic: - if ((fragmentIonType)i == b_ion) { + if ((eFragmentIonType)i == b_ion) { + fragmentiontypes->getList()->item(i-start)->setSelected(true); + } + break; + case branchcyclic: + if (((eFragmentIonType)i == b_ion) || ((eFragmentIonType)i == y_ion)) { + fragmentiontypes->getList()->item(i-start)->setSelected(true); + } + break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + if (((eFragmentIonType)i == l1h_ion) || ((eFragmentIonType)i == l2h_ion) || ((eFragmentIonType)i == r1h_ion) || ((eFragmentIonType)i == r2h_ion) || + ((eFragmentIonType)i == l1oh_ion) || ((eFragmentIonType)i == l2oh_ion) || ((eFragmentIonType)i == r1oh_ion) || ((eFragmentIonType)i == r2oh_ion) + ) { fragmentiontypes->getList()->item(i-start)->setSelected(true); } break; - case lasso: - if (((fragmentIonType)i == b_ion) || ((fragmentIonType)i == y_ion)) { + case cyclicpolyketide: + if (((eFragmentIonType)i == l0h_ion) || ((eFragmentIonType)i == l1h_ion) || ((eFragmentIonType)i == l2h_ion)) { fragmentiontypes->getList()->item(i-start)->setSelected(true); } break; +#endif case linearpolysaccharide: - if (((fragmentIonType)i == ms_nterminal_ion_hplus) || ((fragmentIonType)i == ms_cterminal_ion_hplus)) { + if (((eFragmentIonType)i == ms_nterminal_ion_hplus) || ((eFragmentIonType)i == ms_cterminal_ion_hplus)) { fragmentiontypes->getList()->item(i-start)->setSelected(true); } break; diff --git a/CycloBranch/gui/cParametersWidget.h b/CycloBranch/gui/cParametersWidget.h index 46bff4d..c4f15c5 100644 --- a/CycloBranch/gui/cParametersWidget.h +++ b/CycloBranch/gui/cParametersWidget.h @@ -11,6 +11,9 @@ #include #include +#include +#include +#include #include #include diff --git a/CycloBranch/gui/cSequenceDatabaseWidget.cpp b/CycloBranch/gui/cSequenceDatabaseWidget.cpp index 963bf63..5760ddb 100644 --- a/CycloBranch/gui/cSequenceDatabaseWidget.cpp +++ b/CycloBranch/gui/cSequenceDatabaseWidget.cpp @@ -27,29 +27,41 @@ cSequenceDatabaseWidget::cSequenceDatabaseWidget(QWidget* parent) { insertrow = new QPushButton(tr("Add Row")); insertrow->setToolTip("Add a new row."); + insertrow->setShortcut(QKeySequence(Qt::Key_Insert)); + removechecked = new QPushButton(tr(" Remove Rows ")); removechecked->setToolTip("Remove selected rows."); + removechecked->setShortcut(QKeySequence(Qt::Key_Delete)); close = new QPushButton(tr("Close")); close->setToolTip("Close the window."); + load = new QPushButton(tr("Load")); load->setToolTip("Load the database of sequences."); + load->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + save = new QPushButton(QString(" Save ")); save->setToolTip("Save the database of sequences in the current file. When a file has not been loaded yet, the \"Save As ...\" file dialog is opened."); + saveas = new QPushButton(tr("Save As...")); saveas->setToolTip("Save the database of sequences into a file."); + saveas->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); rowsfilterline = new QLineEdit(); rowsfilterline->setMinimumWidth(250); rowsfilterline->setToolTip("Text to Find"); + rowsfiltercasesensitive = new QCheckBox(); rowsfiltercasesensitive->setToolTip("Case Sensitive"); + rowsfilterbutton = new QPushButton("Filter"); rowsfilterbutton->setToolTip("Filter Search Results"); rowsfilterbutton->setMinimumWidth(50); + rowsfilterclearbutton = new QPushButton("Clear"); rowsfilterclearbutton->setToolTip("Clear Form and Reset Search Results"); rowsfilterclearbutton->setMinimumWidth(50); + rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); rowsfilterhbox = new QHBoxLayout(); rowsfilterhbox->addWidget(rowsfilterline); @@ -83,6 +95,7 @@ cSequenceDatabaseWidget::cSequenceDatabaseWidget(QWidget* parent) { database->setHorizontalHeaderItem(2, new QTableWidgetItem("Name")); database->setHorizontalHeaderItem(3, new QTableWidgetItem("Summary Formula")); database->setHorizontalHeaderItem(4, new QTableWidgetItem("Monoisotopic Mass")); + database->setItemDelegateForColumn(4, &columndelegate); database->setHorizontalHeaderItem(5, new QTableWidgetItem("Sequence")); database->setHorizontalHeaderItem(6, new QTableWidgetItem("N-terminal Modification")); database->setHorizontalHeaderItem(7, new QTableWidgetItem("C-terminal Modification")); @@ -262,7 +275,7 @@ bool cSequenceDatabaseWidget::checkFormula(int row, const string& summary) { return false; } if (database->item(row, 4)) { - database->item(row, 4)->setData(Qt::DisplayRole, to_string(formula.getMass()).c_str()); + database->item(row, 4)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(formula.getMass())); } return true; } @@ -276,19 +289,25 @@ bool cSequenceDatabaseWidget::checkSequence(int row) { regex rx; // [^\\[\\]]+ is used instead of .+ to prevent from a too complex regex error - switch ((peptideType)((QComboBox *)database->cellWidget(row, 1))->currentIndex()) + switch ((ePeptideType)((QComboBox *)database->cellWidget(row, 1))->currentIndex()) { case linear: case linearpolysaccharide: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*$"; break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+$"; break; case branched: rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*\\\\\\(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+\\\\\\)\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*$"; break; - case lasso: + case branchcyclic: rx = "(^(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*)?\\\\\\(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+\\\\\\)\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*$|^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*\\\\\\(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+\\\\\\)(\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*)?$)"; break; case other: @@ -305,7 +324,7 @@ bool cSequenceDatabaseWidget::checkSequence(int row) { errstr += ". The format of sequence '"; errstr += database->item(row, 5)->text().toStdString().c_str(); errstr += "' does not correspond to the sequence type '"; - errstr += getStringFromPeptideType((peptideType)((QComboBox *)database->cellWidget(row, 1))->currentIndex()).c_str(); + errstr += getStringFromPeptideType((ePeptideType)((QComboBox *)database->cellWidget(row, 1))->currentIndex()).c_str(); errstr += "'."; msgBox.setText(errstr); msgBox.exec(); @@ -358,6 +377,26 @@ void cSequenceDatabaseWidget::keyPressEvent(QKeyEvent *event) { filterRows(); } } + + if (event->key() == Qt::Key_F1) { + #if OS_TYPE == WIN + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/sequenceeditor.html").absoluteFilePath())); + #else + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/sequenceeditor.html").absoluteFilePath())); + #endif + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_F)) { + rowsfilterline->setFocus(); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_N)) { + rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked()); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_S)) { + saveDatabase(); + } } @@ -414,7 +453,7 @@ void cSequenceDatabaseWidget::loadDatabase() { QComboBox* combo = new QComboBox(); for (int j = 0; j <= (int)other; j++) { - combo->addItem(QString(getStringFromPeptideType((peptideType)j).c_str())); + combo->addItem(QString(getStringFromPeptideType((ePeptideType)j).c_str())); } combo->setCurrentIndex((int)sequences[i].getPeptideType()); connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBoxModified(int))); @@ -428,7 +467,7 @@ void cSequenceDatabaseWidget::loadDatabase() { formula.setFormula(sequences[i].getSummaryFormula()); database->setItem(i, 4, widgetitemallocator.getNewItem()); - database->item(i, 4)->setData(Qt::DisplayRole, to_string(formula.getMass()).c_str()); + database->item(i, 4)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(formula.getMass())); database->setItem(i, 5, widgetitemallocator.getNewItem()); database->item(i, 5)->setText(sequences[i].getSequence().c_str()); @@ -518,7 +557,7 @@ bool cSequenceDatabaseWidget::saveDatabase() { // nothing to do break; case 1: - seq.setPeptideType((peptideType)(((QComboBox *)database->cellWidget(i,j))->currentIndex())); + seq.setPeptideType((ePeptideType)(((QComboBox *)database->cellWidget(i,j))->currentIndex())); break; case 2: s = database->item(i,j)->text().toStdString(); @@ -606,7 +645,7 @@ void cSequenceDatabaseWidget::addRow() { QComboBox* combo = new QComboBox(); for (int i = 0; i <= (int)other; i++) { - combo->addItem(QString(getStringFromPeptideType((peptideType)i).c_str())); + combo->addItem(QString(getStringFromPeptideType((ePeptideType)i).c_str())); } combo->setCurrentIndex((int)other); connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBoxModified(int))); diff --git a/CycloBranch/gui/cSequenceDatabaseWidget.h b/CycloBranch/gui/cSequenceDatabaseWidget.h index e206bcb..01c2881 100644 --- a/CycloBranch/gui/cSequenceDatabaseWidget.h +++ b/CycloBranch/gui/cSequenceDatabaseWidget.h @@ -8,10 +8,15 @@ #define _CSEQUENCEDATABASEWIDGET_H #include +#include +#include +#include #include #include "core/utilities.h" #include "core/cSequenceDatabase.h" #include "core/cAllocator.h" +#include "gui/cDelegate.h" + using namespace std; using namespace boost; @@ -93,6 +98,7 @@ class cSequenceDatabaseWidget : public QWidget cSequenceDatabase sequences; vector headersort; + cDelegate columndelegate; cAllocator widgetitemallocator; diff --git a/CycloBranch/gui/cSpectrumDetailWidget.cpp b/CycloBranch/gui/cSpectrumDetailWidget.cpp index 875e075..76268a6 100644 --- a/CycloBranch/gui/cSpectrumDetailWidget.cpp +++ b/CycloBranch/gui/cSpectrumDetailWidget.cpp @@ -1,6 +1,5 @@ #include "gui/cSpectrumDetailWidget.h" -#include #include #include #include @@ -21,6 +20,7 @@ cSpectrumDetailWidget::cSpectrumDetailWidget() { + parent = 0; parameters = 0; preparedToShow = false; theoreticalspectrum = new cTheoreticalSpectrum(); @@ -39,7 +39,7 @@ cSpectrumDetailWidget& cSpectrumDetailWidget::operator=(const cSpectrumDetailWid theoreticalspectrum = new cTheoreticalSpectrum(); if (parameters && sd.theoreticalspectrum) { - initialize(parameters, *sd.theoreticalspectrum); + initialize(parameters, *sd.theoreticalspectrum, sd.parent); } if (parameters && sd.preparedToShow) { @@ -52,7 +52,8 @@ cSpectrumDetailWidget& cSpectrumDetailWidget::operator=(const cSpectrumDetailWid } -void cSpectrumDetailWidget::initialize(cParameters* parameters, cTheoreticalSpectrum& theoreticalspectrum) { +void cSpectrumDetailWidget::initialize(cParameters* parameters, cTheoreticalSpectrum& theoreticalspectrum, QWidget* parent) { + this->parent = parent; this->parameters = parameters; *this->theoreticalspectrum = theoreticalspectrum; } @@ -74,8 +75,73 @@ string cSpectrumDetailWidget::getDetailsAsHTMLString() { s += theoreticalspectrum->getCandidate().getAcronymPeptideNameWithHTMLReferences(); s += "

"; s += "Full Peptide Name:
"; - s += theoreticalspectrum->getCandidate().getRealPeptideName() + "
"; + s += theoreticalspectrum->getCandidate().getRealPeptideName(); + string lname = parameters->searchedmodifications[theoreticalspectrum->getCandidate().getStartModifID()].name; + if (lname.empty()) { + lname = "-"; + } + else { + lname += " (" + to_string(parameters->searchedmodifications[theoreticalspectrum->getCandidate().getStartModifID()].massdifference) + " Da)"; + } + + string bname = parameters->searchedmodifications[theoreticalspectrum->getCandidate().getMiddleModifID()].name; + if (bname.empty()) { + bname = "-"; + } + else { + bname += " (" + to_string(parameters->searchedmodifications[theoreticalspectrum->getCandidate().getMiddleModifID()].massdifference) + " Da)"; + } + + string rname = parameters->searchedmodifications[theoreticalspectrum->getCandidate().getEndModifID()].name; + if (rname.empty()) { + rname = "-"; + } + else { + rname += " (" + to_string(parameters->searchedmodifications[theoreticalspectrum->getCandidate().getEndModifID()].massdifference) + " Da)"; + } + + switch (parameters->peptidetype) + { + case linear: + s += "

"; + s += "N-terminal Modification: " + lname + "
"; + s += "C-terminal Modification: " + rname + "
"; + break; + case cyclic: + s += "
"; + break; + case branched: + s += "

"; + s += "N-terminal Modification: " + lname + "
"; + s += "Branch Modification: " + bname + "
"; + s += "C-terminal Modification: " + rname + "
"; + break; + case branchcyclic: + s += "

"; + s += "Branch Modification: " + bname + "
"; + break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + s += "

"; + s += "Left Modification: " + lname + "
"; + s += "Right Modification: " + rname + "
"; + break; + case cyclicpolyketide: + s += "
"; + break; +#endif + case linearpolysaccharide: + s += "

"; + s += "N-terminal Modification: " + lname + "
"; + s += "C-terminal Modification: " + rname + "
"; + break; + case other: + break; + default: + break; + } + if ((int)theoreticalspectrum->getCandidate().getPathAsString().size() > 0) { s += "
"; s += "Path in the De Novo Graph:
"; @@ -86,8 +152,271 @@ string cSpectrumDetailWidget::getDetailsAsHTMLString() { } - s += "Unmatched Measured Peaks:
" + theoreticalspectrum->getUnmatchedPeaks() + "

"; - s += "Theoretical Peaks:
" + theoreticalspectrum->getTheoreticalPeaks()->print(true); + } + + return s; +} + + +string cSpectrumDetailWidget::getPeaksTableAsHTMLString(bool unmatchedtheoreticalpeaks, bool unmatchedexperimentalpeaks) { + string s = ""; + int rowcount, columncount, thpeakscount; + int secondspace, langle, rangle, tmp1, tmp2; + cPeaksList* thpeaks; + cPeak* peak; + bool isred; + string tdwidth; + + if (theoreticalspectrum && parameters) { + + s += ""; + + if (parameters->mode == dereplication) { + columncount = 8; + } + else { + columncount = 6; + } + + tdwidth = to_string(100/columncount); + + if (parameters->mode == dereplication) { + s += ""; + } + else { + s += ""; + } + + s += ""; + s += ""; + s += ""; + s += ""; + + if (parameters->mode == dereplication) { + s += ""; + s += ""; + s += ""; + } + else { + s += ""; + } + + 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(); + } + + rowcount = thpeakscount + theoreticalspectrum->getUnmatchedPeaks()->size(); + + // theoretical peaks + for (int i = 0; i < thpeakscount; i++) { + peak = &((*thpeaks)[i]); + + if (peak->matchedmz > 0) { + isred = true; + } + else { + isred = false; + } + + if (!isred && !unmatchedtheoreticalpeaks) { + continue; + } + + s += ""; + + if (parameters->mode == dereplication) { + secondspace = (int)peak->description.find(' ', peak->description.find(' ') + 1); + s += printHTMLTableCell(peak->description.substr(0, secondspace), isred); + } + else { + s += printHTMLTableCell(peak->description.substr(0, peak->description.find(':')), isred); + } + + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->mzratio)), isred); + + if (peak->matchedmz > 0) { + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedmz)), isred); + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedintensity)), isred); + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedppm)), isred); + } + else { + s += ""; + } + + if (parameters->mode == dereplication) { + s += printHTMLTableCell(peak->description.substr(peak->description.rfind('(') + 1, peak->description.rfind(')') - peak->description.rfind('(') - 1), isred); + + langle = (int)peak->description.rfind('<'); + rangle = (int)peak->description.find('>'); + if ((langle != string::npos) && (rangle != string::npos)) { + s += printHTMLTableCell(peak->description.substr(rangle + 1, langle - rangle - 1), isred); + + tmp1 = (int)peak->description.find('<'); + tmp2 = (int)peak->description.rfind('>'); + s += printHTMLTableCell(peak->description.substr(tmp1, rangle - tmp1 + 1) + "view" + peak->description.substr(langle, tmp2 - langle + 1), isred); + } + else { + s += printHTMLTableCell(peak->description.substr(secondspace + 1, peak->description.rfind('(') - secondspace - 2), isred); + s += ""; + } + } + else { + if (peak->description.find(':') + 2 < peak->description.size()) { + s += printHTMLTableCell(peak->description.substr(peak->description.find(':') + 2), isred); + } + else { + s += ""; + } + } + + s += ""; + } + + // unmatched experimental peaks + if (unmatchedexperimentalpeaks) { + for (int i = thpeakscount; i < thpeakscount + theoreticalspectrum->getUnmatchedPeaks()->size(); i++) { + s += ""; + peak = &((*(theoreticalspectrum->getUnmatchedPeaks()))[i - thpeakscount]); + s += ""; + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->mzratio)), false); + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->intensity)), false); + s += ""; + if (parameters->mode == dereplication) { + s += ""; + } + s += ""; + } + } + + s += "
Ion TypeFragment TypeTheoretical m/zExperimental m/zIntensity [%]Error [ppm]Summary FormulaNameReferenceSequence
"; + + if (parameters->mode == dereplication) { + delete thpeaks; + } + + } + + return s; +} + + +string cSpectrumDetailWidget::getPartialPeaksTableAsHTMLString(int id) { + string s = ""; + int thpeakscount; + int secondspace, langle, rangle, tmp1, tmp2; + cPeaksList* thpeaks; + cPeak* peak; + bool isred; + + if (theoreticalspectrum && parameters) { + + 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(); + } + + // theoretical peaks + for (int i = 0; i < thpeakscount; i++) { + peak = &((*thpeaks)[i]); + + if (peak->matchedmz > 0) { + isred = true; + } + else { + isred = false; + } + + if (!isred) { + continue; + } + + s += ""; + s += ""; + s += to_string(id + 1); + s += ""; + + if (parameters->mode == dereplication) { + if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) { + s += ""; + s += to_string(theoreticalspectrum->getExperimentalSpectrum().getCoordinateX()); + s += ""; + s += ""; + s += to_string(theoreticalspectrum->getExperimentalSpectrum().getCoordinateY()); + s += ""; + } + secondspace = (int)peak->description.find(' ', peak->description.find(' ') + 1); + s += printHTMLTableCell(peak->description.substr(0, secondspace), isred); + } + else { + s += printHTMLTableCell(peak->description.substr(0, peak->description.find(':')), isred); + } + + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->mzratio)), isred); + + if (peak->matchedmz > 0) { + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedmz)), isred); + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedintensity)), isred); + s += printHTMLTableCell(to_string(cropPrecisionToSixDecimals(peak->matchedppm)), isred); + } + else { + s += ""; + } + + if (parameters->mode == dereplication) { + s += printHTMLTableCell(peak->description.substr(peak->description.rfind('(') + 1, peak->description.rfind(')') - peak->description.rfind('(') - 1), isred); + + langle = (int)peak->description.rfind('<'); + rangle = (int)peak->description.find('>'); + if ((langle != string::npos) && (rangle != string::npos)) { + s += printHTMLTableCell(peak->description.substr(rangle + 1, langle - rangle - 1), isred); + + tmp1 = (int)peak->description.find('<'); + tmp2 = (int)peak->description.rfind('>'); + s += printHTMLTableCell(peak->description.substr(tmp1, rangle - tmp1 + 1) + "view" + peak->description.substr(langle, tmp2 - langle + 1), isred); + } + else { + s += printHTMLTableCell(peak->description.substr(secondspace + 1, peak->description.rfind('(') - secondspace - 2), isred); + s += ""; + } + } + else { + if (peak->description.find(':') + 2 < peak->description.size()) { + s += printHTMLTableCell(peak->description.substr(peak->description.find(':') + 2), isred); + } + else { + s += ""; + } + } + + s += ""; + } + + if (parameters->mode == dereplication) { + delete thpeaks; + } } @@ -103,9 +432,33 @@ cSpectrumDetailWidget::~cSpectrumDetailWidget() { delete spectrumscene; - delete textedit; delete textbrowser; + //QProgressDialog progress("Clearing the peaklist...", /*"Cancel"*/0, 0, peakstable->rowCount(), this); + //cEventFilter filter; + //progress.installEventFilter(&filter); + //progress.setMinimumDuration(0); + //progress.setWindowModality(Qt::WindowModal); + + widgetitemallocator.reset(); + + if (parameters->mode == dereplication) { + for (int i = 0; i < peakstable->rowCount(); i++) { + if (peakstable->cellWidget(i, 7)) { + delete peakstable->cellWidget(i, 7); + } + + //progress.setValue(i); + //if (progress.wasCanceled()) { + // break; + //} + } + } + + //progress.setValue(peakstable->rowCount()); + + delete peakstable; + delete labelmz; delete minmz; delete maxmz; @@ -129,16 +482,22 @@ cSpectrumDetailWidget::~cSpectrumDetailWidget() { switch (parameters->peptidetype) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif delete linearwidget; break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif delete cyclicwidget; break; case branched: delete branchedwidget; break; - case lasso: - delete lassowidget; + case branchcyclic: + delete branchcyclicwidget; break; case linearpolysaccharide: break; @@ -179,7 +538,7 @@ void cSpectrumDetailWidget::closeEvent(QCloseEvent *event) { } -void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { +void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) { if (!preparedToShow) { @@ -197,16 +556,22 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { switch (peptidetype) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif linearwidget = new cLinearWidget(); break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif cyclicwidget = new cCyclicWidget(); break; case branched: branchedwidget = new cBranchedWidget(); break; - case lasso: - lassowidget = new cLassoWidget(); + case branchcyclic: + branchcyclicwidget = new cBranchCyclicWidget(); break; case linearpolysaccharide: break; @@ -223,11 +588,17 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { toolbarExport->setMovable(false); toolbarExport->setFloatable(false); + 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); + 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_E)); - actionExportSpectrum->setToolTip("Export Image (Ctrl + E)"); + actionExportSpectrum->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I)); + actionExportSpectrum->setToolTip("Export Image (Ctrl + I)"); toolbarExport->addAction(actionExportSpectrum); - connect(actionExportSpectrum, SIGNAL(triggered()), this, SLOT(openExportDialog())); + connect(actionExportSpectrum, SIGNAL(triggered()), this, SLOT(openExportImageDialog())); toolbarFind = addToolBar(tr("Find")); @@ -287,14 +658,14 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { actionHideMatched->setToolTip("Hide Matched Peaks (Ctrl + M)"); actionHideMatched->setCheckable(true); toolbarHide->addAction(actionHideMatched); - connect(actionHideMatched, SIGNAL(toggled(bool)), spectrumscene, SLOT(hideMatchedPeaks(bool))); + connect(actionHideMatched, SIGNAL(toggled(bool)), this, SLOT(hideMatchedPeaks(bool))); 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); - connect(actionHideUnmatched, SIGNAL(toggled(bool)), spectrumscene, SLOT(hideUnmatchedPeaks(bool))); + connect(actionHideUnmatched, SIGNAL(toggled(bool)), this, SLOT(hideUnmatchedPeaks(bool))); actionHideScrambled = new QAction(QIcon(":/images/icons/80.png"), tr("Hide Scrambled Peaks"), this); actionHideScrambled->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); @@ -308,23 +679,19 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { if ((parameters->peptidetype == cyclic) && parameters->enablescrambling) { actionHideScrambled->setEnabled(true); - connect(actionHideScrambled, SIGNAL(toggled(bool)), spectrumscene, SLOT(hideScrambledPeaks(bool))); + connect(actionHideScrambled, SIGNAL(toggled(bool)), this, SLOT(hideScrambledPeaks(bool))); } } - textedit = new QTextEdit(); - textedit->setReadOnly(true); - textedit->setFont(QFont("Courier", 9)); - textedit->setLineWrapMode(QTextEdit::NoWrap); - textbrowser = new QTextBrowser(); textbrowser->setReadOnly(true); textbrowser->setFont(QFont("Courier", 9)); textbrowser->setLineWrapMode(QTextEdit::NoWrap); textbrowser->setAcceptRichText(true); textbrowser->setOpenExternalLinks(true); - + + peakstable = new QTableWidget(0, 0, this); labelmz = new QLabel(tr("View m/z (from - to): ")); @@ -411,7 +778,11 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { if (parameters && ((parameters->mode == denovoengine) || (parameters->mode == singlecomparison) || (parameters->mode == databasesearch))) { // cyclic +#if POLYKETIDE_SIDEROPHORES == 1 + if (theoreticalspectrum && ((parameters->peptidetype == cyclic) || (parameters->peptidetype == cyclicpolyketide))) { +#else if (theoreticalspectrum && (parameters->peptidetype == cyclic)) { +#endif int r = (int)theoreticalspectrum->getCandidate().getAcronyms().size(); int hint = (int)theoreticalspectrum->getVisualCoverage().size()/(2*r); @@ -455,7 +826,7 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { } // branch-cyclic - if (parameters && theoreticalspectrum && (parameters->peptidetype == lasso)) { + if (parameters && theoreticalspectrum && (parameters->peptidetype == branchcyclic)) { int r = (int)theoreticalspectrum->getCandidate().getAcronyms().size() - (int)theoreticalspectrum->getCandidate().getBranchSize(); int hint = (int)theoreticalspectrum->getVisualCoverage().size()/(2*r); @@ -471,7 +842,7 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { connect(rotation, SIGNAL(currentIndexChanged(int)), spectrumscene, SLOT(rotationChanged(int))); connect(rotation, SIGNAL(currentIndexChanged(QString)), spectrumscene, SLOT(rotationChanged(QString))); - connect(rotation, SIGNAL(currentIndexChanged(int)), lassowidget, SLOT(rotationChanged(int))); + connect(rotation, SIGNAL(currentIndexChanged(int)), branchcyclicwidget, SLOT(rotationChanged(int))); toolbarRotation = addToolBar(tr("Ring break up point")); toolbarRotation->addWidget(widgetrotation); @@ -487,7 +858,7 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { trotation->addItem(tr("6 (right-to-top)")); connect(trotation, SIGNAL(currentIndexChanged(int)), spectrumscene, SLOT(trotationChanged(int))); - connect(trotation, SIGNAL(currentIndexChanged(int)), lassowidget, SLOT(trotationChanged(int))); + connect(trotation, SIGNAL(currentIndexChanged(int)), branchcyclicwidget, SLOT(trotationChanged(int))); toolbarTrotation = addToolBar(tr("Linearized sequence")); toolbarTrotation->addWidget(widgettrotation); @@ -498,7 +869,7 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { } hsplitter1->addWidget(spectrumscene); - hsplitter2->addWidget(textbrowser); + hsplitter2->addWidget(peakstable); QList sizes; sizes.push_back(100); @@ -509,16 +880,22 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { switch (peptidetype) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif hsplitter1->addWidget(linearwidget); break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif hsplitter1->addWidget(cyclicwidget); break; case branched: hsplitter1->addWidget(branchedwidget); break; - case lasso: - hsplitter1->addWidget(lassowidget); + case branchcyclic: + hsplitter1->addWidget(branchcyclicwidget); break; case linearpolysaccharide: break; @@ -528,7 +905,7 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { break; } - hsplitter2->addWidget(textedit); + hsplitter2->addWidget(textbrowser); hsplitter1->setSizes(sizes); hsplitter2->setSizes(sizes); @@ -555,16 +932,22 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { switch (peptidetype) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif linearwidget->initialize(parameters, theoreticalspectrum); break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif cyclicwidget->initialize(parameters, theoreticalspectrum); break; case branched: branchedwidget->initialize(parameters, theoreticalspectrum); break; - case lasso: - lassowidget->initialize(parameters, theoreticalspectrum); + case branchcyclic: + branchcyclicwidget->initialize(parameters, theoreticalspectrum); break; case linearpolysaccharide: break; @@ -574,30 +957,36 @@ void cSpectrumDetailWidget::prepareToShow(peptideType peptidetype) { break; } - textedit->setHtml(theoreticalspectrum->getCoverageBySeries().c_str()); + textbrowser->setHtml((getDetailsAsHTMLString() + theoreticalspectrum->getCoverageBySeries()).c_str()); } spectrumscene->initialize(parameters, theoreticalspectrum); - textbrowser->setHtml(getDetailsAsHTMLString().c_str()); + + preparePeaksTable(); } preparedToShow = true; + } } -void cSpectrumDetailWidget::findAll(const QString& str, QTextDocument::FindFlags opt) { +void cSpectrumDetailWidget::findAll(const QString& str, QTextDocument::FindFlags opt, bool errormessage) { currentfinditem = 0; + peakstable->clearSelection(); + tablematches.clear(); + // textbrowser QList extraSelections; - textbrowser->moveCursor(QTextCursor::Start); QColor color = QColor(Qt::yellow); + textbrowser->moveCursor(QTextCursor::Start); + while (textbrowser->find(str, opt)) { QTextEdit::ExtraSelection extra; extra.format.setBackground(color); @@ -608,31 +997,57 @@ void cSpectrumDetailWidget::findAll(const QString& str, QTextDocument::FindFlags textbrowser->setExtraSelections(extraSelections); - - // textedit - extraSelections.clear(); - textedit->moveCursor(QTextCursor::Start); - while (textedit->find(str, opt)) { - QTextEdit::ExtraSelection extra; - extra.format.setBackground(color); - - extra.cursor = textedit->textCursor(); - extraSelections.append(extra); + // table + cTablePosition tpos; + for (int i = 0; i < peakstable->rowCount(); i++) { + + if (peakstable->isRowHidden(i)) { + continue; + } + + for (int j = 0; j < peakstable->columnCount(); j++) { + if (!peakstable->item(i, j)) { + continue; + } + + peakstable->item(i, j)->setBackgroundColor(Qt::white); + + if (str.isEmpty()) { + continue; + } + + if (opt & QTextDocument::FindWholeWords) { + if (peakstable->item(i, j)->text().compare(str, (opt & QTextDocument::FindCaseSensitively)?Qt::CaseSensitive:Qt::CaseInsensitive) == 0) { + tpos.row = i; + tpos.column = j; + tablematches.push_back(tpos); + peakstable->item(i, j)->setBackgroundColor(color); + } + } + else { + if (peakstable->item(i, j)->text().contains(str, (opt & QTextDocument::FindCaseSensitively)?Qt::CaseSensitive:Qt::CaseInsensitive)) { + tpos.row = i; + tpos.column = j; + tablematches.push_back(tpos); + peakstable->item(i, j)->setBackgroundColor(color); + } + } + } } - - textedit->setExtraSelections(extraSelections); - if (textbrowser->extraSelections().size() + textedit->extraSelections().size() == 0) { + if (textbrowser->extraSelections().size() + (int)tablematches.size() == 0) { actionPrevious->setDisabled(true); actionNext->setDisabled(true); - QMessageBox msgBox; - QString errstr = "No results were found."; - msgBox.setWindowTitle("Find Text"); - msgBox.setText(errstr); - msgBox.exec(); + if (errormessage) { + QMessageBox msgBox; + QString errstr = "No results were found."; + msgBox.setWindowTitle("Find Text"); + msgBox.setText(errstr); + msgBox.exec(); + } } else { actionPrevious->setDisabled(false); @@ -641,15 +1056,16 @@ void cSpectrumDetailWidget::findAll(const QString& str, QTextDocument::FindFlags // order changed because of setFocus() - if (textedit->extraSelections().size() > 0) { - textedit->setTextCursor(textedit->extraSelections().at(0).cursor); - textedit->setFocus(); + if (textbrowser->extraSelections().size() > 0) { + textbrowser->setFocus(); + textbrowser->setTextCursor(textbrowser->extraSelections().at(0).cursor); } - if (textbrowser->extraSelections().size() > 0) { - textbrowser->setTextCursor(textbrowser->extraSelections().at(0).cursor); - textbrowser->setFocus(); + if (tablematches.size() > 0) { + peakstable->setFocus(); + peakstable->scrollToItem(peakstable->item(tablematches[0].row, tablematches[0].column)); + peakstable->item(tablematches[0].row, tablematches[0].column)->setSelected(true); } } @@ -676,6 +1092,216 @@ void cSpectrumDetailWidget::keyPressEvent(QKeyEvent *event) { } +void cSpectrumDetailWidget::preparePeaksTable() { + + peakstable->setEditTriggers(QAbstractItemView::NoEditTriggers); + peakstable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); + peakstable->horizontalHeader()->setSectionsMovable(true); + //peakstable->setSelectionMode(QAbstractItemView::SingleSelection); + + if (parameters->mode == dereplication) { + peakstable->setColumnCount(8); + } + else { + peakstable->setColumnCount(6); + } + + for (int i = 0; i < peakstable->columnCount(); i++) { + peakstable->setHorizontalHeaderItem(i, widgetitemallocator.getNewItem()); + } + + peakstable->horizontalHeaderItem(1)->setText("Theoretical m/z"); + peakstable->setItemDelegateForColumn(1, &columndelegate); + + peakstable->horizontalHeaderItem(2)->setText("Experimental m/z"); + peakstable->setItemDelegateForColumn(2, &columndelegate); + + peakstable->horizontalHeaderItem(3)->setText("Intensity [%]"); + peakstable->setItemDelegateForColumn(3, &columndelegate); + + peakstable->horizontalHeaderItem(4)->setText("Error [ppm]"); + peakstable->setItemDelegateForColumn(4, &columndelegate); + + if (parameters->mode == dereplication) { + peakstable->horizontalHeaderItem(0)->setText("Ion Type"); + peakstable->horizontalHeaderItem(5)->setText("Summary Formula"); + peakstable->horizontalHeaderItem(6)->setText("Name"); + peakstable->horizontalHeaderItem(7)->setText("Reference"); + } + else { + peakstable->horizontalHeaderItem(0)->setText("Fragment Type"); + peakstable->horizontalHeaderItem(5)->setText("Sequence"); + } + + connect(peakstable->horizontalHeader(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(headerItemDoubleClicked(int))); + + cPeaksList* thpeaks; + int thpeakscount; + cPeak* peak; + int secondspace, langle, rangle, tmp1, tmp2; + 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(); + } + + peakstable->setRowCount(thpeakscount + theoreticalspectrum->getUnmatchedPeaks()->size()); + + QProgressDialog progress("Preparing the peaklist...", /*"Cancel"*/0, 0, thpeakscount + theoreticalspectrum->getUnmatchedPeaks()->size(), parent); + cEventFilter filter; + progress.installEventFilter(&filter); + progress.setMinimumDuration(0); + progress.setWindowModality(Qt::WindowModal); + + // theoretical peaks + for (int i = 0; i < thpeakscount; i++) { + peakstable->setRowHeight(i, 20); + peak = &((*thpeaks)[i]); + + if (peak->matchedmz > 0) { + brush.setColor(QColor(255, 0, 0)); + } + else { + brush.setColor(QColor(0, 0, 0)); + } + + if (parameters->mode == dereplication) { + secondspace = (int)peak->description.find(' ', peak->description.find(' ') + 1); + + peakstable->setItem(i, 0, widgetitemallocator.getNewItem()); + peakstable->item(i, 0)->setForeground(brush); + peakstable->item(i, 0)->setText(peak->description.substr(0, secondspace).c_str()); + } + else { + peakstable->setItem(i, 0, widgetitemallocator.getNewItem()); + peakstable->item(i, 0)->setForeground(brush); + peakstable->item(i, 0)->setText(peak->description.substr(0, peak->description.find(':')).c_str()); + } + + peakstable->setItem(i, 1, widgetitemallocator.getNewItem()); + peakstable->item(i, 1)->setForeground(brush); + peakstable->item(i, 1)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->mzratio)); + + if (peak->matchedmz > 0) { + peakstable->setItem(i, 2, widgetitemallocator.getNewItem()); + peakstable->item(i, 2)->setForeground(brush); + peakstable->item(i, 2)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->matchedmz)); + + peakstable->setItem(i, 3, widgetitemallocator.getNewItem()); + peakstable->item(i, 3)->setForeground(brush); + peakstable->item(i, 3)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->matchedintensity)); + + peakstable->setItem(i, 4, widgetitemallocator.getNewItem()); + peakstable->item(i, 4)->setForeground(brush); + peakstable->item(i, 4)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->matchedppm)); + } + + if (parameters->mode == dereplication) { + peakstable->setItem(i, 5, widgetitemallocator.getNewItem()); + peakstable->item(i, 5)->setForeground(brush); + peakstable->item(i, 5)->setText(peak->description.substr(peak->description.rfind('(') + 1, peak->description.rfind(')') - peak->description.rfind('(') - 1).c_str()); + + peakstable->setItem(i, 6, widgetitemallocator.getNewItem()); + peakstable->item(i, 6)->setForeground(brush); + langle = (int)peak->description.rfind('<'); + rangle = (int)peak->description.find('>'); + if ((langle != string::npos) && (rangle != string::npos)) { + peakstable->item(i, 6)->setText(peak->description.substr(rangle + 1, langle - rangle - 1).c_str()); + + tmp1 = (int)peak->description.find('<'); + tmp2 = (int)peak->description.rfind('>'); + peakstable->setCellWidget(i, 7, new QLabel((peak->description.substr(tmp1, rangle - tmp1 + 1) + "view" + peak->description.substr(langle, tmp2 - langle + 1)).c_str())); + ((QLabel *)peakstable->cellWidget(i, 7))->setTextFormat(Qt::RichText); + ((QLabel *)peakstable->cellWidget(i, 7))->setTextInteractionFlags(Qt::TextBrowserInteraction); + ((QLabel *)peakstable->cellWidget(i, 7))->setOpenExternalLinks(true); + } + else { + peakstable->item(i, 6)->setText(peak->description.substr(secondspace + 1, peak->description.rfind('(') - secondspace - 2).c_str()); + } + } + else { + if (peak->description.find(':') + 2 < peak->description.size()) { + peakstable->setItem(i, 5, widgetitemallocator.getNewItem()); + peakstable->item(i, 5)->setForeground(brush); + peakstable->item(i, 5)->setText(peak->description.substr(peak->description.find(':') + 2).c_str()); + } + } + + progress.setValue(i); + //if (progress.wasCanceled()) { + // break; + //} + } + + // unmatched experimental peaks + for (int i = thpeakscount; i < thpeakscount + theoreticalspectrum->getUnmatchedPeaks()->size(); i++) { + peakstable->setRowHeight(i, 20); + peak = &((*(theoreticalspectrum->getUnmatchedPeaks()))[i - thpeakscount]); + + peakstable->setItem(i, 2, widgetitemallocator.getNewItem()); + peakstable->item(i, 2)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->mzratio)); + + peakstable->setItem(i, 3, widgetitemallocator.getNewItem()); + peakstable->item(i, 3)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->intensity)); + + progress.setValue(i); + //if (progress.wasCanceled()) { + // break; + //} + } + + peakstableheadersort.resize(peakstable->columnCount()); + for (int i = 0; i < peakstable->columnCount(); i++) { + peakstableheadersort[i] = -1; + } + + for (int i = 0; i < peakstable->columnCount(); i++) { + peakstable->resizeColumnToContents(i); + } + + progress.setValue(thpeakscount + theoreticalspectrum->getUnmatchedPeaks()->size()); + + tablematches.clear(); + + if (parameters->mode == dereplication) { + delete thpeaks; + } + +} + + +string cSpectrumDetailWidget::printHTMLTableCell(string text, bool red) { + string s; + + s += ""; + + if (red) { + s += ""; + } + + s += text; + + if (red) { + s += ""; + } + + s += ""; + + return s; +} + + void cSpectrumDetailWidget::updateMZInterval(double minmz, double maxmz) { this->minmz->setValue(minmz); this->maxmz->setValue(maxmz); @@ -743,8 +1369,11 @@ void cSpectrumDetailWidget::exportPeptide() { regex rx; bool selected = false; - switch ((peptideType)parameters->peptidetype) { + switch ((ePeptideType)parameters->peptidetype) { case linear: +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: +#endif rx = ".+\\.pdf$"; if (!selected && (regex_search(filename.toStdString(), rx))) { linearwidget->exportToPDF(filename, false); @@ -772,6 +1401,9 @@ void cSpectrumDetailWidget::exportPeptide() { } break; case cyclic: +#if POLYKETIDE_SIDEROPHORES == 1 + case cyclicpolyketide: +#endif rx = ".+\\.pdf$"; if (!selected && (regex_search(filename.toStdString(), rx))) { cyclicwidget->exportToPDF(filename, false); @@ -825,30 +1457,30 @@ void cSpectrumDetailWidget::exportPeptide() { selected = true; } break; - case lasso: + case branchcyclic: rx = ".+\\.pdf$"; if (!selected && (regex_search(filename.toStdString(), rx))) { - lassowidget->exportToPDF(filename, false); + branchcyclicwidget->exportToPDF(filename, false); selected = true; } #if OS_TYPE == WIN rx = ".+\\.ps$"; if (!selected && (regex_search(filename.toStdString(), rx))) { - lassowidget->exportToPDF(filename, true); + branchcyclicwidget->exportToPDF(filename, true); selected = true; } #endif rx = ".+\\.png$"; if (!selected && (regex_search(filename.toStdString(), rx))) { - lassowidget->exportToPNG(filename); + branchcyclicwidget->exportToPNG(filename); selected = true; } rx = ".+\\.svg$"; if (!selected && (regex_search(filename.toStdString(), rx))) { - lassowidget->exportToSVG(filename); + branchcyclicwidget->exportToSVG(filename); selected = true; } break; @@ -875,7 +1507,7 @@ void cSpectrumDetailWidget::openFindDialog() { } -void cSpectrumDetailWidget::openExportDialog() { +void cSpectrumDetailWidget::openExportImageDialog() { if (parameters && ((parameters->mode == denovoengine) || (parameters->mode == singlecomparison) || (parameters->mode == databasesearch))) { exportdialog->exec(); } @@ -885,32 +1517,188 @@ void cSpectrumDetailWidget::openExportDialog() { } +void cSpectrumDetailWidget::exportTableToCSV() { + QString filename = QFileDialog::getSaveFileName(this, tr("Export Table to CSV..."), "./", "Files (*.csv)"); + + if (!filename.isEmpty()) { + + QProgressDialog progress("Exporting the CSV file...", /*"Cancel"*/0, 0, peakstable->rowCount(), this); + cEventFilter filter; + progress.installEventFilter(&filter); + progress.setMinimumDuration(0); + progress.setWindowModality(Qt::WindowModal); + + QFile file(filename); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + return; + } + + QTextStream out(&file); + + for (int i = 0; i < peakstable->columnCount(); i++) { + out << "\"" << peakstable->horizontalHeaderItem(i)->text() << "\""; + if (i < peakstable->columnCount() - 1) { + out << ","; + } + } + out << endl; + + for (int i = 0; i < peakstable->rowCount(); i++) { + + if (peakstable->isRowHidden(i)) { + continue; + } + + for (int j = 0; j < peakstable->columnCount(); j++) { + if (peakstable->item(i, j)) { + out << "\"" << peakstable->item(i, j)->data(Qt::DisplayRole).toString() << "\""; + if (j < peakstable->columnCount() - 1) { + out << ","; + } + } + else if (peakstable->cellWidget(i, j)) { + out << "\"" << ((QLabel *)(peakstable->cellWidget(i, j)))->text() << "\""; + if (j < peakstable->columnCount() - 1) { + out << ","; + } + } + else { + if (j < peakstable->columnCount() - 1) { + out << ","; + } + } + } + out << endl; + + progress.setValue(i); + //if (progress.wasCanceled()) { + // break; + //} + } + + file.close(); + + progress.setValue(peakstable->rowCount()); + + } +} + + void cSpectrumDetailWidget::movePrevious() { - int count = textbrowser->extraSelections().size() + textedit->extraSelections().size(); + if (currentfinditem < (int)tablematches.size()) { + peakstable->clearSelection(); + } + + int count = (int)tablematches.size() + textbrowser->extraSelections().size(); currentfinditem = (currentfinditem + count - 1)%count; - if (currentfinditem < textbrowser->extraSelections().size()) { - textbrowser->setFocus(); - textbrowser->setTextCursor(textbrowser->extraSelections().at(currentfinditem).cursor); + if (currentfinditem < (int)tablematches.size()) { + peakstable->setFocus(); + peakstable->scrollToItem(peakstable->item(tablematches[currentfinditem].row, tablematches[currentfinditem].column)); + peakstable->item(tablematches[currentfinditem].row, tablematches[currentfinditem].column)->setSelected(true); } else { - textedit->setFocus(); - textedit->setTextCursor(textedit->extraSelections().at(currentfinditem - textbrowser->extraSelections().size()).cursor); + textbrowser->setFocus(); + textbrowser->setTextCursor(textbrowser->extraSelections().at(currentfinditem - (int)tablematches.size()).cursor); } } void cSpectrumDetailWidget::moveNext() { - int count = textbrowser->extraSelections().size() + textedit->extraSelections().size(); + if (currentfinditem < (int)tablematches.size()) { + peakstable->clearSelection(); + } + + int count = (int)tablematches.size() + textbrowser->extraSelections().size(); currentfinditem = (currentfinditem + 1)%count; - if (currentfinditem < textbrowser->extraSelections().size()) { + if (currentfinditem < (int)tablematches.size()) { + peakstable->setFocus(); + peakstable->scrollToItem(peakstable->item(tablematches[currentfinditem].row, tablematches[currentfinditem].column)); + peakstable->item(tablematches[currentfinditem].row, tablematches[currentfinditem].column)->setSelected(true); + } + else { textbrowser->setFocus(); - textbrowser->setTextCursor(textbrowser->extraSelections().at(currentfinditem).cursor); + textbrowser->setTextCursor(textbrowser->extraSelections().at(currentfinditem - (int)tablematches.size()).cursor); + } +} + + +void cSpectrumDetailWidget::headerItemDoubleClicked(int index) { + findAll("", 0, false); + + if (peakstableheadersort[index] == -1) { + peakstable->sortByColumn(index, Qt::DescendingOrder); + peakstableheadersort[index] = 0; + return; + } + + if (peakstableheadersort[index] == 0) { + peakstable->sortByColumn(index, Qt::AscendingOrder); + peakstableheadersort[index] = 1; } else { - textedit->setFocus(); - textedit->setTextCursor(textedit->extraSelections().at(currentfinditem - textbrowser->extraSelections().size()).cursor); + peakstable->sortByColumn(index, Qt::DescendingOrder); + peakstableheadersort[index] = 0; } } + +void cSpectrumDetailWidget::filterPeaksTable() { + findAll("", 0, false); + + int rowcount = peakstable->rowCount(); + int i; + bool hide; + cPeaksList* thpeaks = theoreticalspectrum->getTheoreticalPeaks(); + + QProgressDialog progress("Updating...", /*"Cancel"*/0, 0, rowcount, this); + cEventFilter filter; + progress.installEventFilter(&filter); + progress.setMinimumDuration(0); + progress.setWindowModality(Qt::WindowModal); + + bool hm = actionHideMatched->isChecked(); + bool hu = actionHideUnmatched->isChecked(); + bool hs = actionHideScrambled->isChecked(); + + for (i = 0; i < rowcount; i++) { + hide = false; + + if (hm && peakstable->item(i, 1) && peakstable->item(i, 2)) { + hide = true; + } + + if (hu && ((peakstable->item(i, 1) == 0) || (peakstable->item(i, 2) == 0))) { + hide = true; + } + + if (hs && peakstable->item(i, 0) && peakstable->item(i, 0)->text().contains("scrambled")) { + hide = true; + } + + peakstable->setRowHidden(i, hide); + progress.setValue(i); + } + + progress.setValue(rowcount); +} + + +void cSpectrumDetailWidget::hideMatchedPeaks(bool hide) { + spectrumscene->hideMatchedPeaks(hide); + filterPeaksTable(); +} + + +void cSpectrumDetailWidget::hideUnmatchedPeaks(bool hide) { + spectrumscene->hideUnmatchedPeaks(hide); + filterPeaksTable(); +} + + +void cSpectrumDetailWidget::hideScrambledPeaks(bool hide) { + spectrumscene->hideScrambledPeaks(hide); + filterPeaksTable(); +} + diff --git a/CycloBranch/gui/cSpectrumDetailWidget.h b/CycloBranch/gui/cSpectrumDetailWidget.h index 2595315..c093264 100644 --- a/CycloBranch/gui/cSpectrumDetailWidget.h +++ b/CycloBranch/gui/cSpectrumDetailWidget.h @@ -10,18 +10,24 @@ #include #include #include +#include +#include +#include +#include +#include "core/cAllocator.h" #include "core/cTheoreticalSpectrum.h" #include "gui/cLinearWidget.h" #include "gui/cCyclicWidget.h" #include "gui/cBranchedWidget.h" -#include "gui/cLassoWidget.h" +#include "gui/cBranchCyclicWidget.h" #include "gui/cSpectrumSceneWidget.h" #include "gui/cFindDialog.h" #include "gui/cExportDialog.h" +#include "gui/cEventFilter.h" +#include "gui/cDelegate.h" // forward declaration -class QTextEdit; class QTextBrowser; class QHBoxLayout; class QVBoxLayout; @@ -36,6 +42,29 @@ class QAction; class QLabel; +/** + \brief Position in QTableWidget. +*/ +struct cTablePosition { + /** + \brief A number of a row. + */ + int row; + + + /** + \brief A number of a column. + */ + int column; + + + cTablePosition() { + row = 0; + column = 0; + } +}; + + /** \brief The class representing a widget for visualisation of a detail of a spectrum (opened after doubleclick on a row when results are reported). */ @@ -83,8 +112,9 @@ class cSpectrumDetailWidget : public QMainWindow \brief Initialize the widget. \param parameters a pointer to parameters \param theoreticalspectrum a reference to a theoretical spectrum + \param parent pointer to a parent widget */ - void initialize(cParameters* parameters, cTheoreticalSpectrum& theoreticalspectrum); + void initialize(cParameters* parameters, cTheoreticalSpectrum& theoreticalspectrum, QWidget* parent); /** @@ -101,19 +131,37 @@ class cSpectrumDetailWidget : public QMainWindow string getDetailsAsHTMLString(); + /** + \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 + \retval string a table of peaks as a HTML string + */ + string getPeaksTableAsHTMLString(bool unmatchedtheoreticalpeaks, bool unmatchedexperimentalpeaks); + + + /** + \brief Get a partial table of peaks as a HTML string. + \param id identifier of a spectrum + \retval string a partial table of peaks as a HTML string + */ + string getPartialPeaksTableAsHTMLString(int id); + + /** \brief Prepare the widget to show. \param peptidetype a type of peptide */ - void prepareToShow(peptideType peptidetype); + void prepareToShow(ePeptideType peptidetype); /** \brief Find all occurrences of \a str and highlight them. \param str search string \param opt search options + \param errormessage if true, an error message in a popup window is shown when no results are matched */ - void findAll(const QString& str, QTextDocument::FindFlags opt = 0); + void findAll(const QString& str, QTextDocument::FindFlags opt = 0, bool errormessage = true); /** @@ -134,6 +182,8 @@ class cSpectrumDetailWidget : public QMainWindow private: + QWidget* parent; + QToolBar* toolbarExport; QToolBar* toolbarFind; QToolBar* toolbarZoom; @@ -142,6 +192,7 @@ class cSpectrumDetailWidget : public QMainWindow QToolBar* toolbarRotation; QToolBar* toolbarTrotation; + QAction* actionExportTable; QAction* actionExportSpectrum; QAction* actionFind; QAction* actionPrevious; @@ -176,12 +227,18 @@ class cSpectrumDetailWidget : public QMainWindow QLabel* labeltrotation; QComboBox* trotation; - QTextEdit* textedit; QTextBrowser* textbrowser; + + QTableWidget* peakstable; + vector peakstableheadersort; + cAllocator widgetitemallocator; + vector tablematches; + cDelegate columndelegate; + cLinearWidget* linearwidget; cCyclicWidget* cyclicwidget; cBranchedWidget* branchedwidget; - cLassoWidget* lassowidget; + cBranchCyclicWidget* branchcyclicwidget; cSpectrumSceneWidget* spectrumscene; @@ -195,6 +252,11 @@ class cSpectrumDetailWidget : public QMainWindow int currentfinditem; + void preparePeaksTable(); + + string printHTMLTableCell(string text, bool red); + + signals: /** @@ -217,12 +279,25 @@ private slots: void openFindDialog(); - void openExportDialog(); + void openExportImageDialog(); + + void exportTableToCSV(); void movePrevious(); void moveNext(); + void headerItemDoubleClicked(int); + + void filterPeaksTable(); + + void hideMatchedPeaks(bool hide); + + void hideUnmatchedPeaks(bool hide); + + void hideScrambledPeaks(bool hide); + }; -#endif \ No newline at end of file +#endif + diff --git a/CycloBranch/gui/cSpectrumSceneWidget.cpp b/CycloBranch/gui/cSpectrumSceneWidget.cpp index fe11e10..66c261d 100644 --- a/CycloBranch/gui/cSpectrumSceneWidget.cpp +++ b/CycloBranch/gui/cSpectrumSceneWidget.cpp @@ -152,6 +152,42 @@ void cSpectrumSceneWidget::exportToPNG(QString filename) { } +void cSpectrumSceneWidget::hideUnmatchedPeaks(bool state) { + if (state == false) { + hideunmatched = false; + } + else { + hideunmatched = true; + } + + redrawScene(); +} + + +void cSpectrumSceneWidget::hideMatchedPeaks(bool state) { + if (state == false) { + hidematched = false; + } + else { + hidematched = true; + } + + redrawScene(); +} + + +void cSpectrumSceneWidget::hideScrambledPeaks(bool state) { + if (state == false) { + hidescrambled = false; + } + else { + hidescrambled = true; + } + + redrawScene(); +} + + void cSpectrumSceneWidget::wheelEvent(QWheelEvent *event) { if (event->delta() > 0) { zoomIn(); @@ -372,7 +408,7 @@ void cSpectrumSceneWidget::redrawScene() { if (parameters->peptidetype == branched) { coloredtrotationstring = " " + to_string(coloredtrotationid + 1) + "_"; } - if (parameters->peptidetype == lasso) { + if (parameters->peptidetype == branchcyclic) { coloredtrotationstring = "_" + to_string(coloredtrotationid + 1) + "_"; } } @@ -402,7 +438,7 @@ void cSpectrumSceneWidget::redrawScene() { hits.pop_back(); } - if ((parameters->peptidetype == lasso) && (((coloredrotationid != -1) && (hits.back().find(coloredrotationstring) == string::npos)) || ((coloredtrotationid != -1) && (hits.back().find(coloredtrotationstring) == string::npos)))) { + if ((parameters->peptidetype == branchcyclic) && (((coloredrotationid != -1) && (hits.back().find(coloredrotationstring) == string::npos)) || ((coloredtrotationid != -1) && (hits.back().find(coloredtrotationstring) == string::npos)))) { hits.pop_back(); } @@ -429,7 +465,7 @@ void cSpectrumSceneWidget::redrawScene() { hits.pop_back(); } - if ((parameters->peptidetype == lasso) && (((coloredrotationid != -1) && (hits.back().find(coloredrotationstring) == string::npos)) || ((coloredtrotationid != -1) && (hits.back().find(coloredtrotationstring) == string::npos)))) { + if ((parameters->peptidetype == branchcyclic) && (((coloredrotationid != -1) && (hits.back().find(coloredrotationstring) == string::npos)) || ((coloredtrotationid != -1) && (hits.back().find(coloredtrotationstring) == string::npos)))) { hits.pop_back(); } } @@ -524,6 +560,8 @@ void cSpectrumSceneWidget::updateZoomGroup() { qstr += QString::number(getMZRatioFromXPosition((pressedx < currentx)?pressedx:currentx, origwidth)); qstr += "-"; qstr += QString::number(getMZRatioFromXPosition((pressedx < currentx)?currentx:pressedx, origwidth)); + qstr += "\ndiff: "; + qstr += QString::number(getMZRatioFromXPosition((pressedx < currentx)?currentx:pressedx, origwidth) - getMZRatioFromXPosition((pressedx < currentx)?pressedx:currentx, origwidth)); zoomsimpletextitem->setFont(myFont); zoomsimpletextitem->setText(qstr); @@ -533,42 +571,6 @@ void cSpectrumSceneWidget::updateZoomGroup() { } -void cSpectrumSceneWidget::hideUnmatchedPeaks(bool state) { - if (state == false) { - hideunmatched = false; - } - else { - hideunmatched = true; - } - - redrawScene(); -} - - -void cSpectrumSceneWidget::hideMatchedPeaks(bool state) { - if (state == false) { - hidematched = false; - } - else { - hidematched = true; - } - - redrawScene(); -} - - -void cSpectrumSceneWidget::hideScrambledPeaks(bool state) { - if (state == false) { - hidescrambled = false; - } - else { - hidescrambled = true; - } - - redrawScene(); -} - - void cSpectrumSceneWidget::zoomIn() { if (currentscale < 32) { currentscale += factor; diff --git a/CycloBranch/gui/cSpectrumSceneWidget.h b/CycloBranch/gui/cSpectrumSceneWidget.h index 83fc912..611a64b 100644 --- a/CycloBranch/gui/cSpectrumSceneWidget.h +++ b/CycloBranch/gui/cSpectrumSceneWidget.h @@ -79,6 +79,27 @@ class cSpectrumSceneWidget : public QGraphicsView void exportToPNG(QString filename); + /** + \brief Hide/Show unmatched peaks. + \param state the peaks are hidden when \a state is true + */ + void hideUnmatchedPeaks(bool state); + + + /** + \brief Hide/Show matched peaks. + \param state the peaks are hidden when \a state is true + */ + void hideMatchedPeaks(bool state); + + + /** + \brief Hide/Show scrambled peaks. + \param state the peaks are hidden when \a state is true + */ + void hideScrambledPeaks(bool state); + + protected: @@ -181,12 +202,6 @@ class cSpectrumSceneWidget : public QGraphicsView private slots: - void hideUnmatchedPeaks(bool state); - - void hideMatchedPeaks(bool state); - - void hideScrambledPeaks(bool state); - void zoomIn(); void zoomOut(); diff --git a/CycloBranch/images.qrc b/CycloBranch/images.qrc index 1361d37..a67a20b 100644 --- a/CycloBranch/images.qrc +++ b/CycloBranch/images.qrc @@ -31,5 +31,7 @@ images/icons/65.png images/icons/56.png images/icons/66.png + images/icons/5.png + images/icons/25.png diff --git a/CycloBranch/images/icons/25.png b/CycloBranch/images/icons/25.png new file mode 100644 index 0000000..dfe63cb Binary files /dev/null and b/CycloBranch/images/icons/25.png differ diff --git a/CycloBranch/images/icons/5.png b/CycloBranch/images/icons/5.png new file mode 100644 index 0000000..0b0d70b Binary files /dev/null and b/CycloBranch/images/icons/5.png differ diff --git a/CycloBranch/images/splash.cdr b/CycloBranch/images/splash.cdr index dabcc46..5579311 100644 Binary files a/CycloBranch/images/splash.cdr and b/CycloBranch/images/splash.cdr differ diff --git a/CycloBranch/images/splash.png b/CycloBranch/images/splash.png index d7789d2..d68602c 100644 Binary files a/CycloBranch/images/splash.png and b/CycloBranch/images/splash.png differ diff --git a/CycloBranch/main.cpp b/CycloBranch/main.cpp index 563dfe6..67a5703 100644 --- a/CycloBranch/main.cpp +++ b/CycloBranch/main.cpp @@ -25,8 +25,8 @@ int main(int argc, char** argv) { chdir(installdir.toStdString().c_str()); #endif qRegisterMetaType("cParameters"); - qRegisterMetaType >("vector"); - qRegisterMetaType("peptideType"); + qRegisterMetaType >("vector"); + qRegisterMetaType("ePeptideType"); qRegisterMetaType >("vector"); qRegisterMetaType("string"); qRegisterMetaType("cFragmentIons"); @@ -35,7 +35,7 @@ int main(int argc, char** argv) { QSplashScreen splash(pixmap); if(!pixmap.isNull()) { splash.show(); - splash.showMessage(QObject::tr(QString(appname + " " + appversion + " is starting ...").toStdString().c_str()), Qt::AlignLeft | Qt::AlignBottom, Qt::black); + splash.showMessage(QObject::tr(QString(appname + " " + appversion + " is starting ...").toStdString().c_str()), Qt::AlignCenter | Qt::AlignBottom, Qt::black); for (int i = 0; i < 50; i++) { if (!splash.isVisible()) { break; diff --git a/CycloBranch/parallel/cGraphReaderThread.cpp b/CycloBranch/parallel/cGraphReaderThread.cpp index fb488f2..75b5dcb 100644 --- a/CycloBranch/parallel/cGraphReaderThread.cpp +++ b/CycloBranch/parallel/cGraphReaderThread.cpp @@ -9,6 +9,7 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate int finish; int size; bool cycle; + int bid; if (*terminatecomputation) { return -1; @@ -18,7 +19,7 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate return 0; } - if ((parameters->peptidetype == lasso) && (startmodifID > 0) && (middlemodifID > 0)) { + if ((parameters->peptidetype == branchcyclic) && (startmodifID > 0) && (middlemodifID > 0)) { return 0; } @@ -32,7 +33,7 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate } // accumulation of middle modifications is not allowed - if (((parameters->peptidetype == branched) || (parameters->peptidetype == lasso)) && (middlemodifID != 0) && ((*graph)[nodeid][i].middlemodifID != 0)) { + if (((parameters->peptidetype == branched) || (parameters->peptidetype == branchcyclic)) && (middlemodifID != 0) && ((*graph)[nodeid][i].middlemodifID != 0)) { continue; } @@ -53,7 +54,7 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate ne.edgeid = i; perspectivepath.push_back(ne); - if ((parameters->peptidetype == branched) || (parameters->peptidetype == lasso)) { + if ((parameters->peptidetype == branched) || (parameters->peptidetype == branchcyclic)) { tmpmiddlemodifID = max(middlemodifID, (*graph)[nodeid][i].middlemodifID); if (tmpmiddlemodifID != middlemodifID) { middlepos = (int)composition.size(); @@ -74,19 +75,125 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate } else { cCandidate candidate(composition, perspectivepath, startmodifID, endmodifID, middlemodifID, middlepos); + + if (!cterminalstartingnode && (((parameters->peptidetype == linear) && !parameters->cyclicnterminus && !parameters->cycliccterminus) || (parameters->peptidetype == branched) || (parameters->peptidetype == linearpolysaccharide))) { + if (candidate.hasLastBrickArtificial(*bricksdatabasewithcombinations) && (composition.size() > 0)) { + bid = atoi(composition.back().c_str()) + 1; // offset of -H2O brick + composition.pop_back(); + composition.push_back(to_string(bid)); + candidate.setCandidate(composition, perspectivepath, startmodifID, endmodifID, middlemodifID, middlepos); + } + } + + if ((parameters->peptidetype == linear) && parameters->cyclicnterminus && candidate.hasLastBrickArtificial(*bricksdatabasewithcombinations) && (composition.size() > 0)) { + if (!cterminalstartingnode) { + bid = atoi(composition.back().c_str()) + 1; // offset of -H2O brick + } + else { + bid = atoi(composition.back().c_str()) + 2; // offset of +H2O brick + } + composition.pop_back(); + composition.push_back(to_string(bid)); + candidate.setCandidate(composition, perspectivepath, startmodifID, endmodifID, middlemodifID, middlepos); + } + +#if POLYKETIDE_SIDEROPHORES == 1 + if ((parameters->peptidetype == linearpolyketide) && candidate.hasLastBrickArtificial(*bricksdatabasewithcombinations) && (composition.size() > 0) && (perspectivepath.size() > 0)) { - if (!cterminalstartingnode && (((parameters->peptidetype == linear) && !parameters->cyclicnterminus && !parameters->cycliccterminus) || (parameters->peptidetype == branched) || (parameters->peptidetype == linearpolysaccharide))) { - if ((candidate.hasLastBrickArtificial(*bricksdatabasewithcombinations)) && (composition.size() > 0)) { - int bid = atoi(composition.back().c_str()) + 1; + if ((*graph)[perspectivepath[0].nodeid].checkIonAnnotation(l1h_ion)) { + switch (candidate.getResidueLossType(*bricksdatabasewithcombinations)) + { + case water: + bid = atoi(composition.back().c_str()) + 1; // offset of -H2O brick + break; + case h2: + bid = atoi(composition.back().c_str()) + 3; // offset of -H2 brick + break; + case h2o2: + bid = atoi(composition.back().c_str()) + 8; // offset of -H2O2 brick + break; + default: + bid = atoi(composition.back().c_str()); // nop + break; + } composition.pop_back(); composition.push_back(to_string(bid)); candidate.setCandidate(composition, perspectivepath, startmodifID, endmodifID, middlemodifID, middlepos); } + + if ((*graph)[perspectivepath[0].nodeid].checkIonAnnotation(l2h_ion)) { + switch (candidate.getResidueLossType(*bricksdatabasewithcombinations)) + { + case water: + bid = atoi(composition.back().c_str()) + 4; // offset of -O brick + break; + case h2: + bid = atoi(composition.back().c_str()); // nop + break; + case h2o2: + bid = atoi(composition.back().c_str()) + 6; // offset of -O2 brick + break; + default: + bid = atoi(composition.back().c_str()); // nop + break; + } + composition.pop_back(); + composition.push_back(to_string(bid)); + candidate.setCandidate(composition, perspectivepath, startmodifID, endmodifID, middlemodifID, middlepos); + } + + if ((*graph)[perspectivepath[0].nodeid].checkIonAnnotation(l1oh_ion)) { + switch (candidate.getResidueLossType(*bricksdatabasewithcombinations)) + { + case water: + bid = atoi(composition.back().c_str()) + 3; // offset of -H2 brick + break; + case h2: + bid = atoi(composition.back().c_str()) + 7; // offset of -H2+O brick + break; + case h2o2: + bid = atoi(composition.back().c_str()) + 1; // offset of -H2O brick + break; + default: + bid = atoi(composition.back().c_str()); // nop + break; + } + composition.pop_back(); + composition.push_back(to_string(bid)); + candidate.setCandidate(composition, perspectivepath, startmodifID, endmodifID, middlemodifID, middlepos); + } + + if ((*graph)[perspectivepath[0].nodeid].checkIonAnnotation(l2oh_ion)) { + switch (candidate.getResidueLossType(*bricksdatabasewithcombinations)) + { + case water: + bid = atoi(composition.back().c_str()); // nop + break; + case h2: + bid = atoi(composition.back().c_str()) + 5; // offset of +O brick + break; + case h2o2: + bid = atoi(composition.back().c_str()) + 4; // offset of -O brick + break; + default: + bid = atoi(composition.back().c_str()); // nop + break; + } + composition.pop_back(); + composition.push_back(to_string(bid)); + candidate.setCandidate(composition, perspectivepath, startmodifID, endmodifID, middlemodifID, middlepos); + } + } +#endif - if ((candidate.getComposition().compare("") != 0) && (!candidate.hasOnlyArtificialBricks(*bricksdatabasewithcombinations))) { + if ((candidate.getComposition().compare("") != 0) && !candidate.hasOnlyArtificialBricks(*bricksdatabasewithcombinations) && !candidate.hasLastBrickInvalid(*bricksdatabasewithcombinations)) { - if (isInPpmMassErrorTolerance(precursormass, candidate.getPrecursorMass(*bricksdatabasewithcombinations, parameters), parameters->precursormasserrortolerance)) { + if (isInPpmMassErrorTolerance(precursormass, candidate.getPrecursorMass(*bricksdatabasewithcombinations, parameters), parameters->precursormasserrortolerance) +#if POLYKETIDE_SIDEROPHORES == 1 + && (((parameters->peptidetype != linearpolyketide) && (parameters->peptidetype != cyclicpolyketide)) || candidate.checkPolyketideBlocks(*bricksdatabasewithcombinations, parameters->peptidetype)) +#endif + ) { cCandidateSet result; @@ -94,7 +201,7 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate candidate.revertComposition(); } - if ((parameters->peptidetype == branched) || (parameters->peptidetype == lasso)) { + if ((parameters->peptidetype == branched) || (parameters->peptidetype == branchcyclic)) { result.getSet().clear(); candidate.prepareBranchedCandidates(result, parameters->peptidetype, terminatecomputation); if (scanmode == 0) { @@ -206,7 +313,7 @@ void cGraphReaderThread::run() { } } break; - case lasso: + case branchcyclic: for (int i = 1; i <= lastsystemnode; i++) { if (i - 1/*2*/ > 0) { startmodifID = i - 1/*2*/; @@ -219,6 +326,27 @@ void cGraphReaderThread::run() { } } break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + for (int i = 1; i <= lastsystemnode; i++) { + if (i - 4 > 0) { + startmodifID = i - 4; + } + if (getCandidatesIter(false, candidates, i, composition, unchargedprecursormass, startmodifID, 0, 0, -1, perspectivepath, (*graph)[i].getMZRatio(), terminatecomputation) == -1) { + // terminated + return; + } + } + break; + case cyclicpolyketide: + for (int i = 1; i <= lastsystemnode; i++) { + if (getCandidatesIter(false, candidates, i, composition, unchargedprecursormass, 0, 0, 0, -1, perspectivepath, (*graph)[i].getMZRatio(), terminatecomputation) == -1) { + // terminated + return; + } + } + break; +#endif case linearpolysaccharide: for (int i = 1; i <= lastsystemnode; i++) { if (i - 1 > 0) { diff --git a/CycloBranch/parallel/cSpectrumComparatorThread.cpp b/CycloBranch/parallel/cSpectrumComparatorThread.cpp index 0a9b202..2a8586a 100644 --- a/CycloBranch/parallel/cSpectrumComparatorThread.cpp +++ b/CycloBranch/parallel/cSpectrumComparatorThread.cpp @@ -139,9 +139,17 @@ void cSpectrumComparatorThread::run() { case branched: theoreticalpeaksrealsize = tsp.compareBranched(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); break; - case lasso: - theoreticalpeaksrealsize = tsp.compareLasso(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); + case branchcyclic: + theoreticalpeaksrealsize = tsp.compareBranchCyclic(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); break; +#if POLYKETIDE_SIDEROPHORES == 1 + case linearpolyketide: + theoreticalpeaksrealsize = tsp.compareLinearPolyketideSiderophore(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); + break; + case cyclicpolyketide: + theoreticalpeaksrealsize = tsp.compareCyclicPolyketideSiderophore(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); + break; +#endif case linearpolysaccharide: theoreticalpeaksrealsize = tsp.compareLinearPolysaccharide(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); break; diff --git a/CycloBranch/readme-linux-compile.txt b/CycloBranch/readme-linux-compile.txt index d47dbc1..7b36dcb 100644 --- a/CycloBranch/readme-linux-compile.txt +++ b/CycloBranch/readme-linux-compile.txt @@ -1,6 +1,7 @@ 1) Required packages: g++ libboost-all-dev +libxerces-c-dev qt5-default libqt5svg5* diff --git a/CycloBranch/readme-macosx-compile.txt b/CycloBranch/readme-macosx-compile.txt index 5a71b33..f4b5269 100644 --- a/CycloBranch/readme-macosx-compile.txt +++ b/CycloBranch/readme-macosx-compile.txt @@ -6,6 +6,7 @@ Tested on OS X Mountain Lion: - download and install Qt 5.2.1 - download and install brew and type "brew doctor" - install boost 1.57.0 using "brew install boost" +- install xerces-c 3.1.1 using "brew install xerces-c" - install gcc using "brew install gcc" 2) Execute the following commands in the directory where CycloBranch is unpacked: diff --git a/readme.txt b/readme.txt index 43fa1a7..2969cd9 100644 --- a/readme.txt +++ b/readme.txt @@ -1,3 +1,3 @@ CycloBranch.sln - project for MS Visual Studio 2012 -- requires Qt 5.2.1 and Boost 1.57 installed +- requires Qt 5.2.1, boost 1.57 and xerces-c 3.1.1 installed