diff --git a/CycloBranch.sln b/CycloBranch.sln
new file mode 100644
index 0000000..cae5bf9
--- /dev/null
+++ b/CycloBranch.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CycloBranch", "CycloBranch\CycloBranch.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.Build.0 = Debug|Win32
+ {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.ActiveCfg = Debug|x64
+ {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.Build.0 = Debug|x64
+ {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.ActiveCfg = Release|Win32
+ {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.Build.0 = Release|Win32
+ {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|x64
+ {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/CycloBranch/CycloBranch.vcxproj b/CycloBranch/CycloBranch.vcxproj
new file mode 100644
index 0000000..58c9984
--- /dev/null
+++ b/CycloBranch/CycloBranch.vcxproj
@@ -0,0 +1,562 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {B12702AD-ABFB-343A-A199-8E24837244A3}
+ Qt4VSv1.0
+ CycloBranch
+
+
+
+ Application
+ v110
+
+
+ Application
+ v110
+
+
+ Application
+ v110
+
+
+ Application
+ v110
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>11.0.50727.1
+
+
+ $(SolutionDir)$(Platform)\$(Configuration)\
+
+
+ $(SolutionDir)$(Platform)\$(Configuration)\
+
+
+ $(SolutionDir)$(Platform)\$(Configuration)\
+
+
+ $(SolutionDir)$(Platform)\$(Configuration)\
+ false
+
+
+
+ UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)
+ .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)
+ Disabled
+ ProgramDatabase
+ MultiThreadedDebugDLL
+ false
+
+
+ Windows
+ $(OutDir)\$(ProjectName).exe
+ $(QTDIR)\lib;%(AdditionalLibraryDirectories)
+ true
+ qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Widgetsd.lib;%(AdditionalDependencies)
+
+
+
+
+ UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)
+ .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)
+ Disabled
+ ProgramDatabase
+ MultiThreadedDebugDLL
+ false
+
+
+ Windows
+ $(OutDir)\$(ProjectName).exe
+ $(QTDIR)\lib;%(AdditionalLibraryDirectories)
+ true
+ qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Widgetsd.lib;%(AdditionalDependencies)
+
+
+
+
+ UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)
+ .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)
+
+ MultiThreadedDLL
+ false
+
+
+ Windows
+ $(OutDir)\$(ProjectName).exe
+ $(QTDIR)\lib;%(AdditionalLibraryDirectories)
+ false
+ qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;%(AdditionalDependencies)
+
+
+
+
+ UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)
+ .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)
+ ProgramDatabase
+ MultiThreadedDLL
+ true
+ Level3
+ true
+ true
+ true
+ true
+
+
+ Windows
+ $(OutDir)\$(ProjectName).exe
+ $(QTDIR)\lib;%(AdditionalLibraryDirectories)
+ true
+ qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;%(AdditionalDependencies)
+ true
+ true
+ UseLinkTimeCodeGeneration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ 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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ 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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ 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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ 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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+
+
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ Moc%27ing cGraphicalSpectrumWidget.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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ Moc%27ing cGraphicalSpectrumWidget.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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ Moc%27ing cGraphicalSpectrumWidget.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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ Moc%27ing cGraphicalSpectrumWidget.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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+ $(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 "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets"
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CycloBranch/CycloBranch.vcxproj.filters b/CycloBranch/CycloBranch.vcxproj.filters
new file mode 100644
index 0000000..cd10613
--- /dev/null
+++ b/CycloBranch/CycloBranch.vcxproj.filters
@@ -0,0 +1,283 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;cxx;c;def
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h
+
+
+ {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
+ moc;h;cpp
+ False
+
+
+ {50123869-bff2-4b54-9131-0bf502edae17}
+ cpp;moc
+ False
+
+
+ {a1c6ca65-210f-46fd-bdf0-d6b5297a74ff}
+ cpp;moc
+ False
+
+
+ {d9a9fe3c-960f-406f-a2ad-2f11cb56f027}
+
+
+ {bdb0c1fb-0940-4611-a53d-01314629c624}
+
+
+ {8344fcea-7ee5-4f94-88f9-373484a9244f}
+
+
+ {f88212ab-d8b0-416c-855e-cca9b97df52b}
+
+
+ {ca6be5b6-1c11-4f58-9fba-b869dc6b4a7d}
+
+
+ {ede1a4b0-ffbc-4a56-8e82-02552392966b}
+
+
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files\core
+
+
+ Source Files
+
+
+ Source Files\core
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Source Files\gui
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Source Files\gui
+
+
+ Source Files\gui
+
+
+ Source Files\gui
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Source Files\gui
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Source Files\gui
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Source Files\gui
+
+
+ Source Files\core
+
+
+ Source Files\parallel
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Source Files\parallel
+
+
+ Source Files\gui
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Source Files\gui
+
+
+ Source Files\gui
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Source Files\gui
+
+
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\core
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\parallel
+
+
+ Header Files\parallel
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+ Header Files\core
+
+
+
\ No newline at end of file
diff --git a/CycloBranch/CycloBranch.vcxproj.user b/CycloBranch/CycloBranch.vcxproj.user
new file mode 100644
index 0000000..dfe0f79
--- /dev/null
+++ b/CycloBranch/CycloBranch.vcxproj.user
@@ -0,0 +1,25 @@
+
+
+
+ PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
+ C:\Qt\5.1.1\msvc2012_64\
+
+
+ PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
+ C:\Qt\5.1.1\msvc2012_64\
+
+
+ C:\Qt\5.1.1\msvc2012_64
+ PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(PATH)
+
+
+ WindowsLocalDebugger
+
+
+ C:\Qt\5.1.1\msvc2012_64
+ PATH=$(QTDIR)\bin%3b%PATH%%3b"$(PATH)
+ WindowsLocalDebugger
+
+
+
+
\ No newline at end of file
diff --git a/CycloBranch/core/cBrick.cpp b/CycloBranch/core/cBrick.cpp
new file mode 100644
index 0000000..504e093
--- /dev/null
+++ b/CycloBranch/core/cBrick.cpp
@@ -0,0 +1,423 @@
+#include "core/cBrick.h"
+
+
+int getNumberOfBricks(string& composition) {
+ if (composition.size() == 0) {
+ return 0;
+ }
+
+ int count = 0;
+ for (int i = 0; i < (int)composition.size(); i++) {
+ if (composition[i] == '-') {
+ count++;
+ }
+ }
+ return ++count;
+}
+
+
+string stripHTML(string& htmlstring) {
+ string s;
+ bool add = true;
+
+ for (int i = 0; i < (int)htmlstring.size(); i++) {
+ if (htmlstring[i] == '<') {
+ add = false;
+ continue;
+ }
+ if (htmlstring[i] == '>') {
+ add = true;
+ continue;
+ }
+ if (add) {
+ s += htmlstring[i];
+ }
+ }
+ return s;
+}
+
+
+cBrick::cBrick() {
+ clear();
+}
+
+
+void cBrick::clear() {
+ name = "";
+ acronyms.clear();
+ references.clear();
+ summary = "";
+ mass = 0;
+ composition = "";
+ artificial = false;
+}
+
+
+bool cBrick::empty() {
+ if ((name.size() == 0) && (summary.size() == 0) && (mass == 0)) return true;
+ return false;
+}
+
+
+string& cBrick::getName() {
+ return name;
+}
+
+
+void cBrick::setName(string& name) {
+ this->name = name;
+}
+
+
+string& cBrick::getSummary() {
+ return summary;
+}
+
+
+vector& cBrick::getAcronyms() {
+ return acronyms;
+}
+
+
+vector& cBrick::getReferences() {
+ return references;
+}
+
+
+string& cBrick::getComposition() {
+ return composition;
+}
+
+
+string cBrick::getReverseComposition() {
+ string reversename = "";
+ vector blocks;
+ explodeToStringComposition(blocks);
+ for (int i = 0; i < (int)blocks.size(); i++) {
+ reversename += blocks[(int)blocks.size() - i - 1];
+ if (i < (int)blocks.size() - 1) {
+ reversename += '-';
+ }
+ }
+ return reversename;
+}
+
+
+double cBrick::getMass() {
+ return mass;
+}
+
+
+void cBrick::setMass(double mass) {
+ this->mass = mass;
+}
+
+
+void cBrick::setComposition(string& composition, bool normalize) {
+ this->composition = composition;
+ if (normalize) {
+ normalizeComposition();
+ }
+}
+
+
+void cBrick::setSummary(string& summary) {
+ this->summary = summary;
+}
+
+
+void cBrick::setAcronyms(string& acronyms) {
+ string s = "";
+ int i = 0;
+ while (i < (int)acronyms.size()) {
+ if (acronyms[i] == '/') {
+ if (s.compare("") != 0) {
+ this->acronyms.push_back(s);
+ }
+ s = "";
+ }
+ else {
+ s += acronyms[i];
+ }
+ i++;
+ }
+ if (s.compare("") != 0) {
+ this->acronyms.push_back(s);
+ }
+}
+
+
+void cBrick::setReferences(string& references) {
+ string s = "";
+ int i = 0;
+ while (i < (int)references.size()) {
+ if (references[i] == '/') {
+ if (s.compare("") != 0) {
+ this->references.push_back(s);
+ }
+ s = "";
+ }
+ else {
+ s += references[i];
+ }
+ i++;
+ }
+ if (s.compare("") != 0) {
+ this->references.push_back(s);
+ }
+}
+
+
+void cBrick::normalizeComposition() {
+ vector bricks;
+ explodeToIntComposition(bricks);
+ sort(bricks.begin(), bricks.end());
+
+ composition = "";
+ for (int i = 0; i < (int)bricks.size(); i++) {
+ composition += to_string((long long)bricks[i]);
+ if (i < (int)bricks.size() - 1) {
+ composition += "-";
+ }
+ }
+}
+
+
+void cBrick::explodeToIntComposition(vector& bricks) {
+ if (composition.compare("") == 0) {
+ return;
+ }
+
+ bricks.clear();
+ int item;
+ int first = 0;
+ int last = (int)composition.find('-');
+ while (last != string::npos) {
+ item = atoi(composition.substr(first, last - first).c_str());
+ bricks.push_back(item);
+ first = last+1;
+ last = (int)composition.find('-',first);
+ }
+ item = atoi(composition.substr(first).c_str());
+ bricks.push_back(item);
+}
+
+
+void cBrick::explodeToStringComposition(vector& bricks) {
+ if (composition.compare("") == 0) {
+ return;
+ }
+
+ bricks.clear();
+ string item;
+ int first = 0;
+ int last = (int)composition.find('-');
+ while (last != string::npos) {
+ item = composition.substr(first, last - first);
+ bricks.push_back(item);
+ first = last+1;
+ last = (int)composition.find('-',first);
+ }
+ item = composition.substr(first);
+ bricks.push_back(item);
+}
+
+
+string cBrick::getAcronymsAsString() {
+ string s = "";
+ for (int i = 0; i < (int)acronyms.size(); i++) {
+ s += acronyms[i];
+ if (i < (int)acronyms.size() - 1) {
+ s += "/";
+ }
+ }
+ return s;
+}
+
+
+string cBrick::getFirstAcronymAsString() {
+ if (acronyms.size() == 0) {
+ return "";
+ }
+ return acronyms[0];
+}
+
+
+string cBrick::getAcronymsWithReferencesAsHTMLString() {
+ string s = "";
+ regex rx;
+ bool correctreference;
+
+ for (int i = 0; i < (int)acronyms.size(); i++) {
+
+ correctreference = false;
+
+ try {
+
+ // ChemSpider
+ if (!correctreference) {
+ rx = "^CSID: [0-9]+$";
+ if (regex_search(references[i], rx)) {
+ s += "";
+ s += acronyms[i];
+ s += "";
+ correctreference = true;
+ }
+ }
+
+ // PubChem
+ if (!correctreference) {
+ rx = "^CID: [0-9]+$";
+ if (regex_search(references[i], rx)) {
+ s += "";
+ s += acronyms[i];
+ s += "";
+ correctreference = true;
+ }
+ }
+
+ // PDB
+ if (!correctreference) {
+ rx = "^PDB: [A-Z]+$";
+ if (regex_search(references[i], rx)) {
+ s += "";
+ s += acronyms[i];
+ s += "";
+ correctreference = true;
+ }
+ }
+
+ // smiles in ChemSpider
+ if (!correctreference) {
+ rx = " in CSID: [0-9]+$";
+ if (regex_search(references[i], rx)) {
+ s += "";
+ s += acronyms[i];
+ s += "";
+ correctreference = true;
+ }
+ }
+
+ // smiles in PubChem
+ if (!correctreference) {
+ rx = " in CID: [0-9]+$";
+ if (regex_search(references[i], rx)) {
+ s += "";
+ s += acronyms[i];
+ s += "";
+ correctreference = true;
+ }
+ }
+
+ // smiles in Norine
+ if (!correctreference) {
+ rx = " in: NOR";
+ if (regex_search(references[i], rx)) {
+ s += "";
+ s += acronyms[i];
+ s += "";
+ correctreference = true;
+ }
+ }
+
+ }
+ catch (std::regex_error& e) {
+ e;
+ // nothing to do
+ }
+
+ if (!correctreference) {
+ s += acronyms[i];
+ }
+
+ if (i < (int)acronyms.size() - 1) {
+ s += "/";
+ }
+ }
+ return s;
+}
+
+
+void cBrick::setArtificial(bool artificial) {
+ this->artificial = artificial;
+}
+
+
+bool cBrick::isArtificial() {
+ return artificial;
+}
+
+
+void cBrick::store(ofstream& os) {
+ int size;
+
+ size = (int)name.size();
+ os.write((char *)&size, sizeof(int));
+ os.write(name.c_str(), name.size());
+
+ size = (int)acronyms.size();
+ os.write((char *)&size, sizeof(int));
+ for (int i = 0; i < (int)acronyms.size(); i++) {
+ size = (int)acronyms[i].size();
+ os.write((char *)&size, sizeof(int));
+ os.write(acronyms[i].c_str(), acronyms[i].size());
+ }
+
+ size = (int)references.size();
+ os.write((char *)&size, sizeof(int));
+ for (int i = 0; i < (int)references.size(); i++) {
+ size = (int)references[i].size();
+ os.write((char *)&size, sizeof(int));
+ os.write(references[i].c_str(), references[i].size());
+ }
+
+ size = (int)summary.size();
+ os.write((char *)&size, sizeof(int));
+ os.write(summary.c_str(), summary.size());
+
+ os.write((char *)&mass, sizeof(double));
+
+ size = (int)composition.size();
+ os.write((char *)&size, sizeof(int));
+ os.write(composition.c_str(), composition.size());
+
+ os.write((char *)&artificial, sizeof(bool));
+}
+
+
+void cBrick::load(ifstream& is) {
+ int size;
+
+ is.read((char *)&size, sizeof(int));
+ name.resize(size);
+ is.read(&name[0], name.size());
+
+ is.read((char *)&size, sizeof(int));
+ acronyms.resize(size);
+ for (int i = 0; i < (int)acronyms.size(); i++) {
+ is.read((char *)&size, sizeof(int));
+ acronyms[i].resize(size);
+ is.read(&acronyms[i][0], acronyms[i].size());
+ }
+
+ is.read((char *)&size, sizeof(int));
+ references.resize(size);
+ for (int i = 0; i < (int)references.size(); i++) {
+ is.read((char *)&size, sizeof(int));
+ references[i].resize(size);
+ is.read(&references[i][0], references[i].size());
+ }
+
+ is.read((char *)&size, sizeof(int));
+ summary.resize(size);
+ is.read(&summary[0], summary.size());
+
+ is.read((char *)&mass, sizeof(double));
+
+ is.read((char *)&size, sizeof(int));
+ composition.resize(size);
+ is.read(&composition[0], composition.size());
+
+ is.read((char *)&artificial, sizeof(bool));
+}
+
diff --git a/CycloBranch/core/cBrick.h b/CycloBranch/core/cBrick.h
new file mode 100644
index 0000000..d586515
--- /dev/null
+++ b/CycloBranch/core/cBrick.h
@@ -0,0 +1,233 @@
+/**
+ \file cBrick.h
+ \brief The representation of a brick.
+*/
+
+
+#ifndef _CBRICK_H
+#define _CBRICK_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace std;
+
+
+/**
+ \brief Get the number of bricks in a composition.
+ \param composition string containing ids of bricks separated by '-'
+ \retval number number of bricks
+*/
+int getNumberOfBricks(string& composition);
+
+
+/**
+ \brief Strip HTML tags from a HTML string.
+ \param htmlstring reference to a string with HTML tags
+ \retval string stripped string
+*/
+string stripHTML(string& htmlstring);
+
+
+/**
+ \brief The class representing a building block (brick).
+*/
+class cBrick {
+ string name;
+ vector acronyms;
+ vector references;
+ string summary;
+ double mass;
+ string composition;
+ bool artificial;
+
+public:
+
+ /**
+ \brief The constructor.
+ */
+ cBrick();
+
+
+ /**
+ \brief Clear all variables.
+ */
+ void clear();
+
+
+ /**
+ \brief Test whether the brick is empty.
+ \retval true if the brick is empty
+ */
+ bool empty();
+
+
+ /**
+ \brief Access to a string variable which stores a full name of the brick.
+ \retval reference to a string
+ */
+ string& getName();
+
+
+ /**
+ \brief Set a full name of the brick.
+ \param name reference to a string
+ */
+ void setName(string& name);
+
+
+ /**
+ \brief Access to a string variable which stores a summary molecular formula of the brick.
+ \retval reference to a string
+ */
+ string& getSummary();
+
+
+ /**
+ \brief Access to a vector of strings which stores acronyms of all izomers corresponding to the brick.
+ \retval reference to a vector of strings
+ */
+ vector& getAcronyms();
+
+
+ /**
+ \brief Access to a vector of strings which stores references (e.g., to ChemSpider) of all izomers corresponding to the brick.
+ \retval reference to a vector of strings
+ */
+ vector& getReferences();
+
+
+ /**
+ \brief Access to a string containing composition of the brick (ids of bricks separated by '-')
+ \retval reference to a string
+ */
+ string& getComposition();
+
+
+ /**
+ \brief Reverse the composition of the brick.
+ \retval string with reverted composition of bricks (ids of bricks separated by '-')
+ */
+ string getReverseComposition();
+
+
+ /**
+ \brief Get the mass of the brick.
+ \retval double mass
+ */
+ double getMass();
+
+
+ /**
+ \brief Set the mass of the brick.
+ \param mass mass of the brick
+ */
+ void setMass(double mass);
+
+
+ /**
+ \brief Set the composition of the brick.
+ \param composition reference to a string with composition (ids of bricks separated by '-')
+ \param normalize if true then ids of bricks are sorted in ascending order
+ */
+ void setComposition(string& composition, bool normalize);
+
+
+ /**
+ \brief Set the summary molecular formula of the brick.
+ \param summary reference to a string
+ */
+ void setSummary(string& summary);
+
+
+ /**
+ \brief Set acronyms of all izomers corresponding to the brick.
+ \param acronyms reference to a string where the acronyms are separated by '/'
+ */
+ void setAcronyms(string& acronyms);
+
+
+ /**
+ \brief Set references (e.g., to ChemSpider) of all izomers corresponding to the brick.
+ \param references reference to a string where references to izomers are separated by '/'
+ */
+ void setReferences(string& references);
+
+
+ /**
+ \brief Normalize the composition of the brick (ids of bricks are sorted in ascending order).
+ */
+ void normalizeComposition();
+
+
+ /**
+ \brief Explode the composition of the brick into a vector of intergers (ids of subbricks).
+ \param bricks reference to a vector of integers
+ */
+ void explodeToIntComposition(vector& bricks);
+
+
+ /**
+ \brief Explode the composition of the brick into a vector of strings (ids of subbricks).
+ \param bricks reference to a vector of strings
+ */
+ void explodeToStringComposition(vector& bricks);
+
+
+ /**
+ \brief Get all acronyms.
+ \retval string acronyms of all izomers separated by '/'
+ */
+ string getAcronymsAsString();
+
+
+ /**
+ \brief Get the first acronym.
+ \retval string acronym of the first izomer
+ */
+ string getFirstAcronymAsString();
+
+
+ /**
+ \brief Get all acronyms with HTML links to theirs references.
+ \retval string acronyms of all izomers with HTML references separated by '/'
+ */
+ string getAcronymsWithReferencesAsHTMLString();
+
+
+ /**
+ \brief Set a flag determining whether the brick is a calculated mass block or a regular brick.
+ \param artificial true when the brick is a calculated mass block; false when the brick is a regular brick.
+ */
+ void setArtificial(bool artificial);
+
+
+ /**
+ \brief Get a flag determining whether the brick is a calculated mass block or a regular brick.
+ \retval bool true when the brick is a calculated mass block; false when the brick is a regular brick.
+ */
+ bool isArtificial();
+
+
+ /**
+ \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/cBricksDatabase.cpp b/CycloBranch/core/cBricksDatabase.cpp
new file mode 100644
index 0000000..9236a5b
--- /dev/null
+++ b/CycloBranch/core/cBricksDatabase.cpp
@@ -0,0 +1,499 @@
+#include "core/cBricksDatabase.h"
+
+
+#include "gui/cMainThread.h"
+
+
+bool compareBrickMasses(cBrick& a, cBrick& b) {
+ return (a.getMass() < b.getMass());
+}
+
+
+void getNameOfCompositionFromIntVector(string& composition, vector& combarray) {
+ composition = "";
+ for (int i = 0; i < (int)combarray.size(); i++) {
+ if (combarray[i] > 0) {
+ composition += to_string(combarray[i]);
+ }
+ if ((i < (int)combarray.size() - 1) && (combarray[i + 1] > 0)) {
+ composition += "-";
+ }
+ }
+}
+
+
+string& getReversedNameOfCompositionFromStringVector(string& composition, vector& stringcomposition) {
+ composition = "";
+ for (int i = (int)stringcomposition.size() - 1; i >= 0; i--) {
+ composition += stringcomposition[i];
+ if (i > 0) {
+ composition += "-";
+ }
+ }
+ return composition;
+}
+
+
+void generateBricksPermutations(vector& bricks, vector& currentpermutation, vector& permutations) {
+ if (bricks.size() == 0) {
+ string s = "";
+ for (int i = 0; i < (int)currentpermutation.size(); i++) {
+ s += currentpermutation[i];
+ if (i < (int)currentpermutation.size() - 1) {
+ s += "-";
+ }
+ }
+ permutations.push_back(s);
+ }
+ else {
+ for (int i = 0; i < (int)bricks.size(); i++) {
+ currentpermutation.push_back(bricks[i]);
+ vector subbricks = bricks;
+ subbricks.erase(subbricks.begin() + i);
+ generateBricksPermutations(subbricks, currentpermutation, permutations);
+ currentpermutation.pop_back();
+ }
+ }
+}
+
+
+bool cBricksDatabase::nextCombination(vector& combarray, int numberofbasicbricks, int maximumbricksincombination, double maximumcumulativemass) {
+ int pointer = 0;
+ int cyFlag = 0;
+ do {
+ combarray[pointer]++;
+
+ // set combarray[pointer] to the maximum value when outside of the mass range
+ if ((cyFlag == 0) && (combarray[pointer] <= numberofbasicbricks) && (maximumcumulativemass > 0) && (getMassOfComposition(combarray, maximumbricksincombination) > maximumcumulativemass)) {
+ combarray[pointer] = numberofbasicbricks + 1;
+ }
+
+ if (combarray[pointer] <= numberofbasicbricks) {
+
+ if (cyFlag > 0) {
+
+ for (int i = pointer - 1; i >= 0; i--) {
+ combarray[i] = combarray[pointer];
+ }
+
+ // skip combinations outside of the mass range
+ while ((combarray[pointer] <= numberofbasicbricks) && (pointer < maximumbricksincombination - 1) && (maximumcumulativemass > 0) && (getMassOfComposition(combarray, maximumbricksincombination) > maximumcumulativemass)) {
+ pointer++;
+ combarray[pointer]++;
+
+ for (int i = pointer - 1; i >= 0; i--) {
+ combarray[i] = combarray[pointer];
+ }
+ }
+
+ if ((combarray[pointer] > numberofbasicbricks) || ((maximumcumulativemass > 0) && (getMassOfComposition(combarray, maximumbricksincombination) > maximumcumulativemass))) {
+ return false;
+ }
+
+ }
+
+ return true;
+ }
+ else {
+ cyFlag = 1;
+ pointer++;
+ }
+ } while (pointer < maximumbricksincombination);
+
+ return false;
+}
+
+
+cBricksDatabase::cBricksDatabase() {
+ bricks.clear();
+}
+
+
+int cBricksDatabase::loadFromPlainTextStream(ifstream &stream, string& errormessage) {
+ string s;
+ cBrick b;
+ size_t pos;
+ double mass;
+
+ bool error = false;
+ errormessage = "";
+
+ while (stream.good()) {
+ getline(stream,s);
+
+ // skip a comment
+ if ((s.length() > 0) && (s[0] == '#')) {
+ continue;
+ }
+
+ // replaces commas with dots
+ pos = s.find(',');
+ while (pos != string::npos) {
+ s.replace(pos, 1, ".");
+ pos = s.find(',');
+ }
+
+ b.clear();
+
+ // load the name
+ pos = s.find('\t');
+ if (pos != string::npos) {
+ b.setName(s.substr(0, pos));
+ s = s.substr(pos + 1);
+ }
+ else {
+ break;
+ }
+
+ // load acronyms
+ pos = s.find('\t');
+ if (pos != string::npos) {
+ b.setAcronyms(s.substr(0, pos));
+ s = s.substr(pos + 1);
+ }
+ else {
+ break;
+ }
+
+ // load summary
+ pos = s.find('\t');
+ if (pos != string::npos) {
+ b.setSummary(s.substr(0, pos));
+ s = s.substr(pos + 1);
+ }
+ else {
+ break;
+ }
+
+ // load the mass (unused !)
+ pos = s.find('\t');
+ if (pos != string::npos) {
+ sscanf_s(s.substr(0, pos).c_str(), "%lf", &mass);
+ s = s.substr(pos + 1);
+ }
+ else {
+ break;
+ }
+
+ // load references
+ b.setReferences(s);
+
+ // store brick
+ if (!b.empty()) {
+
+ // calculate mass from the summary
+ b.setMass(getMassFromResidueSummary(b.getSummary(), error, errormessage));
+
+ if (error) {
+ break;
+ }
+
+ if (b.getMass() == 0) {
+ error = true;
+ errormessage = "Invalid brick no. " + to_string(size() + 1) + ".\n\n";
+ break;
+ }
+
+ bricks.push_back(b);
+ //cout << b.getSummary() << " " << b.getMass() << endl;
+ }
+ }
+
+ if (error) {
+ return -1;
+ }
+
+ sortbyMass();
+
+ return 0;
+}
+
+
+int cBricksDatabase::size() {
+ return (int)bricks.size();
+}
+
+
+void cBricksDatabase::print(/*ostream &stream*/) {
+ for (int i = 0; i < size(); i++) {
+ printf("%i %s %lf\n", i + 1, bricks[i].getAcronymsAsString().c_str(), bricks[i].getMass());
+ }
+}
+
+
+void cBricksDatabase::sortbyMass() {
+ sort(bricks.begin(), bricks.end(), compareBrickMasses);
+}
+
+
+cBrick& cBricksDatabase::operator[](int position) {
+ return bricks[position];
+}
+
+
+double cBricksDatabase::getMassOfComposition(vector& combarray, int maximumbricksincombination) {
+ double mass = 0;
+ for (int i = 0; i < maximumbricksincombination; i++) {
+ if (combarray[i] > 0) {
+ mass += bricks[combarray[i] - 1].getMass();
+ }
+ }
+ return mass;
+}
+
+
+string cBricksDatabase::getRealName(string& composition) {
+ cBrick b;
+ b.setComposition(composition, false);
+
+ vector items;
+ b.explodeToIntComposition(items);
+
+ string s = "";
+ for (int i = 0; i < (int)items.size(); i++) {
+ s += "[" + bricks[items[i]-1].getName() + "]";
+ if (i < (int)items.size() - 1) {
+ s += "-";
+ }
+ }
+
+ return s;
+}
+
+
+string cBricksDatabase::getAcronymName(string& composition, bool useHTMLReferences) {
+ cBrick b;
+ b.setComposition(composition, false);
+
+ vector items;
+ b.explodeToIntComposition(items);
+
+ string s = "";
+ for (int i = 0; i < (int)items.size(); i++) {
+ s += "[";
+ if (useHTMLReferences) {
+ s += bricks[items[i]-1].getAcronymsWithReferencesAsHTMLString();
+ }
+ else {
+ s += bricks[items[i]-1].getAcronymsAsString();
+ }
+ s += "]";
+ if (i < (int)items.size() - 1) {
+ s += "-";
+ }
+ }
+
+ return s;
+}
+
+
+string cBricksDatabase::getTagName(string& composition) {
+ cBrick b;
+ b.setComposition(composition, false);
+
+ vector items;
+ b.explodeToIntComposition(items);
+
+ string s = "";
+ for (int i = 0; i < (int)items.size(); i++) {
+ s += "[";
+ s += bricks[items[i]-1].getFirstAcronymAsString();
+ s += "]";
+ if (i < (int)items.size() - 1) {
+ s += "-";
+ }
+ }
+
+ return s;
+}
+
+
+string cBricksDatabase::getAcronymNameOfTPeptide(string& tcomposition, bool useHTMLReferences) {
+ string comp = tcomposition;
+
+ int leftbracket = getNumberOfBricks(comp.substr(0, comp.find('(')));
+ comp[comp.find('(')] = '-';
+
+ if (comp[0] == '-') {
+ comp.erase(comp.begin());
+ }
+
+ int rightbracket = getNumberOfBricks(comp.substr(0, comp.find(')'))) - 1;
+ comp[comp.find(')')] = '-';
+
+ if (comp.back() == '-') {
+ comp.erase(comp.end() - 1);
+ }
+
+ cBrick b;
+ b.setComposition(comp, false);
+
+ vector items;
+ b.explodeToIntComposition(items);
+
+ string s = "";
+ for (int i = 0; i < (int)items.size(); i++) {
+
+ if (i == leftbracket) {
+ if (leftbracket > 0) {
+ s += " ";
+ }
+ s += "( ";
+ }
+
+ s += "[";
+ if (useHTMLReferences) {
+ s += bricks[items[i]-1].getAcronymsWithReferencesAsHTMLString();
+ }
+ else {
+ s += bricks[items[i]-1].getAcronymsAsString();
+ }
+ s += "]";
+
+ if (i == rightbracket) {
+ s += " ) ";
+ }
+ else {
+ if ((i < (int)items.size() - 1) && (leftbracket != i + 1)) {
+ s += "-";
+ }
+ }
+
+ }
+
+ return s;
+}
+
+
+string cBricksDatabase::getTagNameOfTPeptide(string& tcomposition) {
+ string comp = tcomposition;
+ int leftbracket = getNumberOfBricks(comp.substr(0, comp.find('(')));
+ comp[comp.find('(')] = '-';
+ int rightbracket = getNumberOfBricks(comp.substr(0, comp.find(')')));
+ comp[comp.find(')')] = '-';
+
+ cBrick b;
+ b.setComposition(comp, false);
+
+ vector items;
+ b.explodeToIntComposition(items);
+
+ string s = "";
+ for (int i = 0; i < (int)items.size(); i++) {
+ s += "[";
+ s += bricks[items[i]-1].getFirstAcronymAsString();
+ s += "]";
+ if (i < (int)items.size() - 1) {
+ if (i == leftbracket - 1) {
+ s += "\\(";
+ }
+ else if (i == rightbracket - 1) {
+ s += "\\)";
+ }
+ else {
+ s += "-";
+ }
+ }
+ }
+
+ return s;
+}
+
+
+void cBricksDatabase::clear() {
+ bricks.clear();
+}
+
+
+bool cBricksDatabase::replaceAcronymsByIDs(string& sequence) {
+ string s = "";
+ string acronym;
+ bool insidebrick = false;
+ bool found = false;
+ //regex rx;
+ //rx = "^\\d*\\.?\\d*$";
+
+ for (int i = 0; i < (int)sequence.size(); i++) {
+ if (sequence[i] == '[') {
+ acronym = "";
+ insidebrick = true;
+ continue;
+ }
+
+ if (sequence[i] == ']') {
+ found = false;
+ for (int j = 0; j < (int)bricks.size(); j++) {
+ for (int k = 0; k < (int)bricks[j].getAcronyms().size(); k++) {
+ if (acronym.compare(bricks[j].getAcronyms()[k]) == 0) {
+ s += to_string(j + 1);
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ break;
+ }
+ }
+
+ // valinomycin oznaci i neco navic pri connect a 1,1,1
+ //if (!found) {
+ // if (regex_search(acronym, rx)) {
+ // found = true;
+ // }
+ //}
+
+ if (!found) {
+ return false;
+ }
+
+ insidebrick = false;
+ continue;
+ }
+
+ if (insidebrick) {
+ acronym += sequence[i];
+ }
+ else {
+ s += sequence[i];
+ }
+ }
+
+ sequence = s;
+
+ return true;
+}
+
+
+void cBricksDatabase::push_back(cBrick& brick) {
+ bricks.push_back(brick);
+}
+
+
+void cBricksDatabase::removeLastBrick() {
+ bricks.pop_back();
+}
+
+
+void cBricksDatabase::store(ofstream& os) {
+ int size;
+
+ size = (int)bricks.size();
+ os.write((char *)&size, sizeof(int));
+
+ for (int i = 0; i < (int)bricks.size(); i++) {
+ bricks[i].store(os);
+ }
+}
+
+
+void cBricksDatabase::load(ifstream& is) {
+ int size;
+
+ is.read((char *)&size, sizeof(int));
+ bricks.resize(size);
+
+ for (int i = 0; i < (int)bricks.size(); i++) {
+ bricks[i].load(is);
+ }
+}
+
diff --git a/CycloBranch/core/cBricksDatabase.h b/CycloBranch/core/cBricksDatabase.h
new file mode 100644
index 0000000..969c17b
--- /dev/null
+++ b/CycloBranch/core/cBricksDatabase.h
@@ -0,0 +1,217 @@
+/**
+ \file cBricksDatabase.h
+ \brief The representation of a database of bricks.
+*/
+
+
+#ifndef _CBRICKSDATABASE_H
+#define _CBRICKSDATABASE_H
+
+#include
+#include
+#include
+#include
+#include
+
+
+#include "core/cBrick.h"
+
+
+using namespace std;
+
+
+class cMainThread;
+
+
+/**
+ \brief Compare masses of two bricks.
+ \param a first brick
+ \param b second brick
+ \retval bool true if the mass of \a a is less than the mass of \a b
+*/
+bool compareBrickMasses(cBrick& a, cBrick& b);
+
+
+/**
+ \brief Convert vector of ids of bricks into a string.
+ \param composition reference to a string where ids of bricks separated by '-' will be stored
+ \param combarray reference to an input integer vector of ids of bricks
+*/
+void getNameOfCompositionFromIntVector(string& composition, vector& combarray);
+
+
+/**
+ \brief Convert vector of ids of bricks into a string having reversed ids of bricks.
+ \param composition reference to a string where ids of bricks separated by '-' will be stored
+ \param stringcomposition reference to an input string vector of ids of bricks
+ \retval string reference to a string where ids of bricks separated by '-' will be stored
+*/
+string& getReversedNameOfCompositionFromStringVector(string& composition, vector& stringcomposition);
+
+
+/**
+ \brief Generate permutations of bricks.
+ \param bricks reference to an input vector of strings (ids of bricks)
+ \param currentpermutation reference to an empty vector of strings (auxiliary parameter)
+ \param permutations reference to an empty output vector of strings where the result will be stored
+*/
+void generateBricksPermutations(vector& bricks, vector& currentpermutation, vector& permutations);
+
+
+/**
+ \brief The class representing a database of building blocks (bricks).
+*/
+class cBricksDatabase {
+
+ vector bricks;
+
+public:
+
+ /**
+ \brief Get next combination of bricks.
+ \param combarray reference to an input/output vector of integers
+ \param numberofbasicbricks initial number of bricks in a database
+ \param maximumbricksincombination maximum number of combined bricks
+ \param maximumcumulativemass maximum cummulative mass of combined bricks
+ \retval bool true when a valid vector is stored in combarray, false when all valid vectors were already generated
+ */
+ bool nextCombination(vector& combarray, int numberofbasicbricks, int maximumbricksincombination, double maximumcumulativemass);
+
+
+ /**
+ \brief The constructor.
+ */
+ cBricksDatabase();
+
+
+ /**
+ \brief Load the database of bricks from a plain text stream.
+ \param stream reference to an input file stream
+ \param errormessage reference to a string where an error message might be stored
+ \retval int 0 when the database was successfully loaded, -1 when an error occurred (\a errormessage is filled up)
+ */
+ int loadFromPlainTextStream(ifstream &stream, string& errormessage);
+
+
+ /**
+ \brief Get the number of bricks in the database.
+ \retval int number of bricks
+ */
+ int size();
+
+
+ /**
+ \brief Print the database of bricks.
+ */
+ void print(/*ostream &stream*/);
+
+
+ /**
+ \brief Sort the database of bricks by mass in ascending order.
+ */
+ void sortbyMass();
+
+
+ /**
+ \brief Overloaded operator [].
+ \param position of the brick in the vector of bricks
+ \retval cBrick reference to a brick
+ */
+ cBrick& operator[](int position);
+
+
+ /**
+ \brief Get the mass of a composition of bricks.
+ \param combarray reference to an input integer vector of ids
+ \param maximumbricksincombination maximum number of bricks in a combination
+ \retval double cumulative mass of the bricks in the \a combarray
+ */
+ double getMassOfComposition(vector& combarray, int maximumbricksincombination);
+
+
+ /**
+ \brief Get the real name of a peptide from a composition.
+ \param composition reference to a string containing ids of bricks separated by '-'
+ \retval string name of the peptide
+ */
+ string getRealName(string& composition);
+
+
+ /**
+ \brief Get the name of a peptide composed from acronyms of bricks.
+ \param composition reference to a string containing ids of bricks separated by '-'
+ \param useHTMLReferences if true then each acronym is converted to a link to its reference (e.g., in ChemSpider)
+ \retval string name of the peptide
+ */
+ string getAcronymName(string& composition, bool useHTMLReferences);
+
+
+ /**
+ \brief Get a peptide sequence tag from a composition.
+ \param composition reference to a string containing ids of bricks separated by '-'
+ \retval string sequence tag
+ */
+ string getTagName(string& composition);
+
+
+ /**
+ \brief Get the name of a branched peptide composed from acronyms of bricks.
+ \param tcomposition reference to a string containing ids of bricks separated by '-', the branch is specified by '(' and ')'; example: 1-2-3(4-5)6-7
+ \param useHTMLReferences if true then each acronym is converted to a link to its reference (e.g., in ChemSpider)
+ \retval string name of the peptide
+ */
+ string getAcronymNameOfTPeptide(string& tcomposition, bool useHTMLReferences);
+
+
+ /**
+ \brief Get a peptide sequence tag of a branched peptide from a composition.
+ \param tcomposition reference to a string containing ids of bricks separated by '-', the branch is specified by '(' and ')'; example: 1-2-3(4-5)6-7
+ \retval string sequence tag
+ */
+ string getTagNameOfTPeptide(string& tcomposition);
+
+
+ /**
+ \brief Clear the vector of bricks.
+ */
+ void clear();
+
+
+ /**
+ \brief Replace acronyms of bricks by ids.
+ \param sequence reference to an input/output string containing acronyms/ids of bricks
+ \retval bool true when the replacement was successful, false when an acronym of a brick is unknown
+ */
+ bool replaceAcronymsByIDs(string& sequence);
+
+
+ /**
+ \brief Push a new brick into the vector of bricks.
+ \param brick an inserted brick
+ */
+ void push_back(cBrick& brick);
+
+
+ /**
+ \brief Remove the last brick from the vector of bricks if possible.
+ */
+ void removeLastBrick();
+
+
+ /**
+ \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
\ No newline at end of file
diff --git a/CycloBranch/core/cCandidate.cpp b/CycloBranch/core/cCandidate.cpp
new file mode 100644
index 0000000..7c87673
--- /dev/null
+++ b/CycloBranch/core/cCandidate.cpp
@@ -0,0 +1,973 @@
+#include "core/cCandidate.h"
+
+#include "core/cCandidateSet.h"
+
+
+void cCandidate::updateInternalComposition() {
+ internalcomposition = "";
+ for (int i = 0; i < (int)composition.size(); i++) {
+ internalcomposition += composition[i];
+ if (i < (int)composition.size() - 1) {
+ internalcomposition += "-";
+ }
+ }
+
+ numberofinternalbricks = getNumberOfBricks(internalcomposition);
+}
+
+
+void cCandidate::getPermutationsIter(cCandidateSet& permutations, vector& currentcandidate, int position, bool* terminatecomputation) {
+ if (*terminatecomputation) {
+ return;
+ }
+
+ vector bricks, currentpermutation;
+ vector localpermutations;
+
+ bricks.clear();
+ localpermutations.clear();
+
+ if (position < (int)composition.size()) {
+ cBrick b;
+ b.setComposition(composition[position], false);
+ b.explodeToStringComposition(bricks);
+ generateBricksPermutations(bricks, currentpermutation, localpermutations);
+
+ for (int k = 0; k < (int)localpermutations.size(); k++) {
+ currentcandidate.push_back(localpermutations[k]);
+ getPermutationsIter(permutations, currentcandidate, position + 1, terminatecomputation);
+ currentcandidate.pop_back();
+ }
+ }
+ else {
+ cCandidate c(currentcandidate, path, startmodifID, endmodifID, middlemodifID, branchstart, branchend);
+ permutations.getSet().insert(c);
+ }
+}
+
+
+void cCandidate::attachSubBranchCandidates(cCandidate& candidate, cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation) {
+ if (*terminatecomputation) {
+ return;
+ }
+
+ int start = candidate.branchstart;
+ int end = candidate.branchend;
+
+ if (peptidetype == branched) {
+ if (start == 0) {
+ start = 1;
+ }
+
+ if (end == candidate.numberofinternalbricks - 1) {
+ end--;
+ }
+ }
+
+ if (end <= start) {
+ return;
+ }
+
+ cCandidate c;
+ for (int i = start; i <= end; i++) {
+ for (int j = i + 1; j <= end; j++) {
+ c = candidate;
+ c.branchstart = i;
+ c.branchend = j;
+ result.getSet().insert(c);
+ }
+ }
+}
+
+
+void cCandidate::attachAllBranches(cCandidate& candidate, cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation) {
+ cCandidate c;
+ int start, end;
+ int cumsize = 0;
+ for (int i = 0; i < (int)candidate.composition.size(); i++) {
+ start = cumsize;
+ cumsize += getNumberOfBricks(candidate.composition[i]);
+ end = cumsize - 1;
+ c = candidate;
+ c.branchstart = start;
+ c.branchend = end;
+ attachSubBranchCandidates(c, result, peptidetype, terminatecomputation);
+ }
+}
+
+
+void cCandidate::getPartialRotations(string& composition, vector& rotations) {
+ cBrick b;
+ string s;
+ vector bricks;
+ b.setComposition(composition, false);
+ b.explodeToStringComposition(bricks);
+
+ int count = (int)bricks.size();
+ for (int i = 0; i < count; i++) {
+ s = "";
+ for (int j = 0; j < count; j++) {
+ s += bricks[(i + j) % count];
+ if (j < count - 1) {
+ s += "-";
+ }
+ }
+ rotations.push_back(s);
+ //cout << s << endl;
+ }
+
+ /*
+ int position;
+ int count = getNumberOfBricks(rotation);
+ for (int i = 0; i < count - 1; i++) {
+ position = (int)rotation.find('-');
+ if (position == string::npos) {
+ cout << "Sequence cannot be rotated." << endl;
+ exit(1);
+ }
+ else {
+ rotation = rotation.substr(position + 1) + "-" + rotation.substr(0, position);
+ rotations.push_back(rotation);
+ }
+ }
+ */
+}
+
+
+void cCandidate::getPartialLassoRotations(string& composition, vector& lassorotations, int branchstart, int branchend) {
+ cBrick b;
+ string s;
+ bool leftbracketput;
+ vector bricks;
+ b.setComposition(composition, false);
+ b.explodeToStringComposition(bricks);
+ int count = (int)bricks.size();
+ for (int i = 0; i < count; i++) {
+ s = "";
+ leftbracketput = false;
+ for (int j = 0; j < count; j++) {
+ if (branchstart == (i + j) % count) {
+ //s += "(";
+ if (j > 0) {
+ s += "-";
+ }
+ leftbracketput = true;
+ }
+ s += bricks[(i + j) % count];
+ if (branchend == (i + j) % count) {
+ if (!leftbracketput) {
+ break;
+ }
+ //s += ")";
+ if (j < count - 1) {
+ s += "-";
+ }
+ }
+ else {
+ if ((j < count - 1) && (branchstart != (i + j + 1) % count)) {
+ s += "-";
+ }
+ }
+ }
+
+ if (leftbracketput) {
+ vector v;
+ 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);
+ //cout << s << endl;
+ }
+ }
+}
+
+
+cCandidate::cCandidate() {
+ clear();
+}
+
+
+cCandidate::cCandidate(vector& composition, vector& path, int startmodifID, int endmodifID, int middlemodifID, int middlepos) {
+ setCandidate(composition, path, startmodifID, endmodifID, middlemodifID, middlepos);
+}
+
+
+cCandidate::cCandidate(vector& composition, vector& path, int startmodifID, int endmodifID, int middlemodifID, int branchstart, int branchend) {
+ setCandidate(composition, path, startmodifID, endmodifID, middlemodifID, branchstart, branchend);
+}
+
+
+void cCandidate::setCandidate(vector& composition, vector& path, int startmodifID, int endmodifID, int middlemodifID, int middlepos) {
+ this->composition = composition;
+ updateInternalComposition();
+
+ this->startmodifID = startmodifID;
+ this->endmodifID = endmodifID;
+ this->middlemodifID = middlemodifID;
+ this->path = path;
+
+ if (middlepos == -1) {
+ middlemodifID = 0;
+ branchstart = -1;
+ branchend = -1;
+ return;
+ }
+
+ branchstart = 0;
+ for (int i = 0; i < middlepos; i++) {
+ branchstart += getNumberOfBricks(composition[i]);
+ }
+ branchend = branchstart + getNumberOfBricks(composition[middlepos]) - 1;
+}
+
+
+void cCandidate::setCandidate(vector& composition, vector& path, int startmodifID, int endmodifID, int middlemodifID, int branchstart, int branchend) {
+ this->composition = composition;
+ updateInternalComposition();
+
+ this->startmodifID = startmodifID;
+ this->endmodifID = endmodifID;
+ this->middlemodifID = middlemodifID;
+ this->branchstart = branchstart;
+ this->branchend = branchend;
+ this->path = path;
+}
+
+
+void cCandidate::clear() {
+ composition.clear();
+ internalcomposition = "";
+ numberofinternalbricks = 0;
+ startmodifID = 0;
+ endmodifID = 0;
+ middlemodifID = 0;
+ branchstart = -1;
+ branchend = -1;
+ path.clear();
+}
+
+
+string& cCandidate::getComposition() {
+ return internalcomposition;
+}
+
+
+void cCandidate::revertComposition() {
+ cBrick b1, b2;
+ int temp;
+
+ for(int i = 0; i < (int)composition.size() / 2; i++) {
+ b1.setComposition(composition[i], false);
+ b2.setComposition(composition[(int)composition.size()-i-1], false);
+ composition[i] = b2.getReverseComposition();
+ composition[(int)composition.size()-i-1] = b1.getReverseComposition();
+ }
+
+ if ((int)composition.size() % 2 == 1) {
+ b1.setComposition(composition[(int)composition.size() / 2], false);
+ composition[(int)composition.size() / 2] = b1.getReverseComposition();
+ }
+
+ updateInternalComposition();
+
+ temp = startmodifID;
+ startmodifID = endmodifID;
+ endmodifID = temp;
+
+ if ((branchstart != -1) && (branchend != -1)) {
+ temp = numberofinternalbricks - branchstart - 1;
+ branchstart = numberofinternalbricks - branchend - 1;
+ branchend = temp;
+ }
+
+}
+
+
+void cCandidate::prepareBranchedCandidate(cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation) {
+ cCandidate c;
+ result.getSet().clear();
+
+ // branching is unknown
+ if ((branchstart == -1) && (branchend == -1)) {
+ attachAllBranches(*this, result, peptidetype, terminatecomputation);
+ }
+ // branching is determined by a modification of the T-branch
+ else {
+ attachSubBranchCandidates(*this, result, peptidetype, terminatecomputation);
+ }
+
+ if (peptidetype == branched) {
+
+ // below, middlemodifID is always > 0 because branchstart == 0 (or branchend == 0)
+
+ // startmodifID and middlemodifID collide on the first detected combination of bricks
+ if (branchstart == 0) {
+ if (startmodifID > 0) {
+ c = *this;
+ c.startmodifID = middlemodifID;
+ c.middlemodifID = startmodifID;
+ attachSubBranchCandidates(c, result, peptidetype, terminatecomputation);
+ }
+ else {
+ c = *this;
+ c.startmodifID = middlemodifID;
+ c.middlemodifID = 0;
+ c.branchstart = -1;
+ c.branchend = -1;
+ attachAllBranches(c, result, peptidetype, terminatecomputation);
+ }
+ }
+
+ // endmodifID and middlemodifID collide on the last detected combination of bricks
+ if (branchend == numberofinternalbricks - 1) {
+ if (endmodifID > 0) {
+ c = *this;
+ c.endmodifID = middlemodifID;
+ c.middlemodifID = endmodifID;
+ attachSubBranchCandidates(c, result, peptidetype, terminatecomputation);
+ }
+ else {
+ c = *this;
+ c.endmodifID = middlemodifID;
+ c.middlemodifID = 0;
+ c.branchstart = -1;
+ c.branchend = -1;
+ attachAllBranches(c, result, peptidetype, terminatecomputation);
+ }
+ }
+
+ }
+
+}
+
+
+string cCandidate::getTComposition() {
+ vector brickscomposition;
+ cBrick b;
+ string s = "";
+
+ b.clear();
+ b.setComposition(internalcomposition, false);
+ b.explodeToStringComposition(brickscomposition);
+ for (int i = 0; i < (int)brickscomposition.size(); i++) {
+ if (branchstart == i) {
+ s += "(";
+ }
+ s += brickscomposition[i];
+ if (branchend == i) {
+ s += ")";
+ }
+ else {
+ if ((i < (int)brickscomposition.size() - 1) && (branchstart != i + 1)) {
+ s += "-";
+ }
+ }
+ }
+ return s;
+}
+
+
+string cCandidate::getRevertedTComposition(bool usebrackets) {
+ cBrick b, b2;
+ vector brickscomposition;
+ b.setComposition(internalcomposition, false);
+ b2.setComposition(b.getReverseComposition(), false);
+ b2.explodeToStringComposition(brickscomposition);
+
+ int bstart = numberofinternalbricks - branchend - 1;
+ int bend = numberofinternalbricks - branchstart - 1;
+
+ string s = "";
+ for (int i = 0; i < (int)brickscomposition.size(); i++) {
+ if (bstart == i) {
+ s += "(";
+ }
+ s += brickscomposition[i];
+ if (bend == i) {
+ s += ")";
+ }
+ else {
+ if ((i < (int)brickscomposition.size() - 1) && (bstart != i + 1)) {
+ s += "-";
+ }
+ }
+ }
+
+ int p11 = (int)s.find('(');
+ int p12 = (int)s.find(')') - p11 + 1;
+ string t = getTComposition();
+ int p21 = (int)t.find('(');
+ int p22 = (int)t.find(')') - p21 + 1;
+ s.replace(p11, p12, t, p21, p22);
+
+ if (!usebrackets) {
+ s[s.find('(')] = '-';
+ s[s.find(')')] = '-';
+
+ if (s[0] == '-') {
+ s.erase(s.begin());
+ }
+
+ if (s[s.size() - 1] == '-') {
+ s.erase(s.end() - 1);
+ }
+ }
+
+ return s;
+}
+
+
+string cCandidate::getAcronymsTComposition(cBricksDatabase& brickdatabase) {
+ vector brickscomposition;
+ cBrick b;
+ string s = "";
+
+ b.clear();
+ b.setComposition(internalcomposition, false);
+ b.explodeToStringComposition(brickscomposition);
+ for (int i = 0; i < (int)brickscomposition.size(); i++) {
+ if (branchstart == i) {
+ s += " ( ";
+ }
+ s += brickdatabase.getAcronymName(brickscomposition[i], true);
+ if (branchend == i) {
+ s += " ) ";
+ }
+ else {
+ if ((i < (int)brickscomposition.size() - 1) && (branchstart != i + 1)) {
+ s += "-";
+ }
+ }
+ }
+ return s;
+}
+
+
+string cCandidate::getRealNameTComposition(cBricksDatabase& brickdatabase) {
+ vector brickscomposition;
+ cBrick b;
+ string s = "";
+
+ b.clear();
+ b.setComposition(internalcomposition, false);
+ b.explodeToStringComposition(brickscomposition);
+ for (int i = 0; i < (int)brickscomposition.size(); i++) {
+ if (branchstart == i) {
+ s += " ( ";
+ }
+ s += brickdatabase.getRealName(brickscomposition[i]);
+ if (branchend == i) {
+ s += " ) ";
+ }
+ else {
+ if ((i < (int)brickscomposition.size() - 1) && (branchstart != i + 1)) {
+ s += "-";
+ }
+ }
+ }
+ return s;
+}
+
+
+int cCandidate::getBranchSize() {
+ if ((branchstart >= 0) && (branchend >= 0)) {
+ return branchend-branchstart;
+ }
+ return 0;
+}
+
+
+int cCandidate::getBranchStart() {
+ return branchstart;
+}
+
+
+int cCandidate::getBranchEnd() {
+ return branchend;
+}
+
+
+void cCandidate::getBackboneAcronyms(cBricksDatabase& bricksdatabase, vector& acronyms) {
+ vector bricks;
+ cBrick b;
+ b.clear();
+ b.setComposition(getComposition(), false);
+ b.explodeToIntComposition(bricks);
+
+ acronyms.clear();
+ for (int i = 0; i < (int)bricks.size(); i++) {
+ if ((branchstart >= 0) && (branchend >= 0) && ((i <= branchstart) || (i > branchend))) {
+ acronyms.push_back(bricksdatabase[bricks[i] - 1].getAcronymsAsString());
+ }
+ }
+}
+
+
+void cCandidate::getBranchAcronyms(cBricksDatabase& bricksdatabase, vector& acronyms) {
+ vector bricks;
+ cBrick b;
+ b.clear();
+ b.setComposition(getComposition(), false);
+ b.explodeToIntComposition(bricks);
+
+ acronyms.clear();
+ for (int i = 0; i < (int)bricks.size(); i++) {
+ if ((branchstart >= 0) && (branchend >= 0) && (i > branchstart) && (i <= branchend)) {
+ acronyms.push_back(bricksdatabase[bricks[i] - 1].getAcronymsAsString());
+ }
+ }
+}
+
+
+void cCandidate::getPermutationsOfBranches(vector& tpermutations) {
+ tpermutations.resize(6);
+ for (int i = 0; i < (int)tpermutations.size(); i++) {
+ tpermutations[i].clear();
+ }
+
+ vector defaultintcomposition, intcomposition, tempintvector;
+ cBrick b;
+ b.clear();
+ b.setComposition(internalcomposition, false);
+ defaultintcomposition.clear();
+ b.explodeToIntComposition(defaultintcomposition);
+
+ // 0 = n-terminal
+ tpermutations[0].id = 0;
+ tpermutations[0].bricks = defaultintcomposition;
+ tpermutations[0].startmodifID = startmodifID;
+ tpermutations[0].endmodifID = endmodifID;
+ tpermutations[0].middlemodifID = middlemodifID;
+ tpermutations[0].tcomposition = getTComposition();
+ tpermutations[0].middlebranchstart = branchstart;
+ tpermutations[0].middlebranchend = branchend;
+
+
+ // first and second branch - revert order and switch
+ intcomposition.clear();
+ tpermutations[1].tcomposition = "";
+
+ // push reverted second branch into intcomposition
+ for (int i = branchend; i >= branchstart; i--) {
+ intcomposition.push_back(defaultintcomposition[i]);
+
+ if (i == branchstart) {
+ if (tpermutations[1].tcomposition.size() > 0) {
+ tpermutations[1].tcomposition.back() = '(';
+ }
+ else {
+ tpermutations[1].tcomposition += '(';
+ }
+ }
+
+ tpermutations[1].tcomposition += to_string(defaultintcomposition[i]) + "-";
+ }
+ tpermutations[1].middlebranchstart = (int)intcomposition.size() - 1;
+
+ // push reverted first branch into intcomposition
+ for (int i = branchstart - 1; i >= 0; i--) {
+ intcomposition.push_back(defaultintcomposition[i]);
+ tpermutations[1].tcomposition += to_string(defaultintcomposition[i]) + "-";
+ }
+ tpermutations[1].middlebranchend = (int)intcomposition.size() - 1;
+ tpermutations[1].tcomposition.back() = ')';
+
+ // push third branch into intcomposition
+ for (int i = branchend + 1; i < (int)defaultintcomposition.size(); i++) {
+ intcomposition.push_back(defaultintcomposition[i]);
+ tpermutations[1].tcomposition += to_string(defaultintcomposition[i]) + "-";
+ }
+
+ // 1 = middle modification type dependent
+ tpermutations[1].id = 1;
+ tpermutations[1].bricks = intcomposition;
+ tpermutations[1].startmodifID = middlemodifID;
+ tpermutations[1].endmodifID = endmodifID;
+ tpermutations[1].middlemodifID = startmodifID;
+ if (tpermutations[1].tcomposition.back() != ')') {
+ tpermutations[1].tcomposition = tpermutations[1].tcomposition.substr(0,tpermutations[1].tcomposition.size() - 1);
+ }
+
+
+ // first and third branch - revert order and switch
+ intcomposition.clear();
+ tpermutations[2].tcomposition = "";
+ int interpos = 0;
+
+ for (int i = (int)defaultintcomposition.size() - 1; i >= 0; i--) {
+
+ if (i == branchend) {
+ if (tpermutations[2].tcomposition.size() > 0) {
+ tpermutations[2].tcomposition.back() = '(';
+ }
+ else {
+ tpermutations[2].tcomposition += '(';
+ }
+ tpermutations[2].middlebranchstart = (int)intcomposition.size();
+ }
+
+ if ((i >= branchstart) && (i <= branchend)) {
+ intcomposition.push_back(defaultintcomposition[branchstart+interpos]);
+ tpermutations[2].tcomposition += to_string(defaultintcomposition[branchstart+interpos]) + "-";
+ interpos++;
+ }
+ else {
+ intcomposition.push_back(defaultintcomposition[i]);
+ tpermutations[2].tcomposition += to_string(defaultintcomposition[i]) + "-";
+ }
+
+ if (i == branchstart) {
+ tpermutations[2].middlebranchend = (int)intcomposition.size() - 1;
+ tpermutations[2].tcomposition.back() = ')';
+ }
+
+ }
+
+ // 2 = c-terminal
+ tpermutations[2].id = 2;
+ tpermutations[2].bricks = intcomposition;
+ tpermutations[2].startmodifID = endmodifID;
+ tpermutations[2].endmodifID = startmodifID;
+ tpermutations[2].middlemodifID = middlemodifID;
+ if (tpermutations[2].tcomposition.back() != ')') {
+ tpermutations[2].tcomposition = tpermutations[2].tcomposition.substr(0,tpermutations[2].tcomposition.size() - 1);
+ }
+
+
+ // second and third branch - switch (3x)
+ for (int i = 0; i < 3; i++) {
+ intcomposition = tpermutations[i].bricks;
+ tempintvector.clear();
+ tpermutations[i+3].tcomposition = "";
+
+ // backup the middle branch
+ for (int j = tpermutations[i].middlebranchstart + 1; j <= tpermutations[i].middlebranchend; j++) {
+ tempintvector.push_back(intcomposition[j]);
+ }
+
+ // begin
+ for (int j = 0; j < tpermutations[i].middlebranchstart; j++) {
+ tpermutations[i+3].tcomposition += to_string(intcomposition[j]) + "-";
+ }
+
+ if (tpermutations[i+3].tcomposition.size() > 0) {
+ tpermutations[i+3].tcomposition.back() = '(';
+ }
+ else {
+ tpermutations[i+3].tcomposition += '(';
+ }
+
+ // new middle start
+ tpermutations[i+3].tcomposition += to_string(intcomposition[tpermutations[i].middlebranchstart]) + "-";
+
+ // new middle
+ for (int j = tpermutations[i].middlebranchend + 1; j < (int)intcomposition.size(); j++) {
+ tpermutations[i+3].tcomposition += to_string(intcomposition[j]) + "-";
+ }
+ tpermutations[i+3].tcomposition.back() = ')';
+
+ // erase the old middle branch
+ intcomposition.erase(intcomposition.begin() + tpermutations[i].middlebranchstart + 1, intcomposition.begin() + tpermutations[i].middlebranchend + 1);
+
+ tpermutations[i+3].middlebranchstart = tpermutations[i].middlebranchstart;
+ tpermutations[i+3].middlebranchend = (int)intcomposition.size() - 1;
+
+ // new end
+ for (int j = 0; j < (int)tempintvector.size(); j++) {
+ intcomposition.push_back(tempintvector[j]);
+ tpermutations[i+3].tcomposition += to_string(tempintvector[j]) + "-";
+ }
+ tpermutations[i+3].id = i + 3;
+ tpermutations[i+3].bricks = intcomposition;
+ tpermutations[i+3].startmodifID = tpermutations[i].startmodifID;
+ tpermutations[i+3].endmodifID = tpermutations[i].middlemodifID;
+ tpermutations[i+3].middlemodifID = tpermutations[i].endmodifID;
+ if (tpermutations[i+3].tcomposition.back() != ')') {
+ tpermutations[i+3].tcomposition = tpermutations[i+3].tcomposition.substr(0,tpermutations[i+3].tcomposition.size() - 1);
+ }
+ }
+ // 3 = n-terminal
+ // 4 = middle modification type dependent
+ // 5 = c-terminal
+
+ /*
+ for (int i = 0; i < 6; i++) {
+ if (tpermutations[i].middlebranchstart == tpermutations[i].middlebranchend) {
+ tpermutations[i].tcomposition[tpermutations[i].tcomposition.find('(')] = '-';
+ tpermutations[i].tcomposition[tpermutations[i].tcomposition.find(')')] = '-';
+ if (tpermutations[i].tcomposition[0] == '-') {
+ tpermutations[i].tcomposition.erase(tpermutations[i].tcomposition.begin());
+ }
+ if (tpermutations[i].tcomposition.back() == '-') {
+ tpermutations[i].tcomposition.erase(tpermutations[i].tcomposition.end() - 1);
+ }
+ tpermutations[i].middlebranchstart = -1;
+ tpermutations[i].middlebranchend = -1;
+ }
+ }
+ */
+}
+
+
+double cCandidate::getPrecursorMass(cBricksDatabase& brickdatabasewithcombinations, cParameters* parameters) {
+ cBrick b;
+ vector bricks;
+ b.setComposition(internalcomposition, false);
+ b.explodeToIntComposition(bricks);
+
+ double mass = 0;
+ switch (parameters->peptidetype)
+ {
+ case linear:
+ case linearpolysaccharide:
+ mass = parameters->fragmentdefinitions[precursor_ion].massdifference + parameters->searchedmodifications[startmodifID].massdifference + parameters->searchedmodifications[endmodifID].massdifference;
+ break;
+ case cyclic:
+ mass = parameters->fragmentdefinitions[cyclic_precursor_ion].massdifference;
+ break;
+ case branched:
+ mass = parameters->fragmentdefinitions[precursor_ion].massdifference + parameters->searchedmodifications[startmodifID].massdifference + parameters->searchedmodifications[endmodifID].massdifference + parameters->searchedmodifications[middlemodifID].massdifference;
+ break;
+ case lasso:
+ mass = parameters->fragmentdefinitions[cyclic_precursor_ion].massdifference + parameters->searchedmodifications[middlemodifID].massdifference;
+ break;
+ }
+
+ for (int i = 0; i < (int)bricks.size(); i++) {
+ mass += brickdatabasewithcombinations[bricks[i] - 1].getMass();
+ }
+
+ return mass;
+
+}
+
+
+bool cCandidate::isEqualTo(cCandidate& candidate) {
+ if ((internalcomposition.compare(candidate.internalcomposition) == 0)
+ && (startmodifID == candidate.startmodifID)
+ && (endmodifID == candidate.endmodifID)
+ && (middlemodifID == candidate.middlemodifID)
+ && (branchstart == candidate.branchstart)
+ && (branchend == candidate.branchend)) {
+ return true;
+ }
+ return false;
+}
+
+
+void cCandidate::getPermutations(cCandidateSet& permutations, bool* terminatecomputation) {
+ vector currentcandidate;
+ permutations.getSet().clear();
+ currentcandidate.clear();
+ getPermutationsIter(permutations, currentcandidate, 0, terminatecomputation);
+}
+
+
+int cCandidate::getStartModifID() {
+ return startmodifID;
+}
+
+
+void cCandidate::setStartModifID(int id) {
+ startmodifID = id;
+}
+
+
+int cCandidate::getEndModifID() {
+ return endmodifID;
+}
+
+
+void cCandidate::setEndModifID(int id) {
+ endmodifID = id;
+}
+
+
+
+int cCandidate::getMiddleModifID() {
+ return middlemodifID;
+}
+
+
+void cCandidate::setMiddleModifID(int id) {
+ middlemodifID = id;
+}
+
+
+bool cCandidate::compare(cCandidate& candidate) {
+ if (getComposition() < candidate.getComposition()) {
+ return true;
+ }
+ if (getComposition() > candidate.getComposition()) {
+ return false;
+ }
+
+ if (startmodifID < candidate.startmodifID) {
+ return true;
+ }
+ if (startmodifID > candidate.startmodifID) {
+ return false;
+ }
+
+ if (endmodifID < candidate.endmodifID) {
+ return true;
+ }
+ if (endmodifID > candidate.endmodifID) {
+ return false;
+ }
+
+ if (middlemodifID < candidate.middlemodifID) {
+ return true;
+ }
+ if (middlemodifID > candidate.middlemodifID) {
+ return false;
+ }
+
+ if (branchstart < candidate.branchstart) {
+ return true;
+ }
+ if (branchstart > candidate.branchstart) {
+ return false;
+ }
+
+ if (branchend < candidate.branchend) {
+ return true;
+ }
+ if (branchend > candidate.branchend) {
+ return false;
+ }
+
+ return false;
+}
+
+
+vector& cCandidate::getPath() {
+ return path;
+}
+
+
+bool cCandidate::hasEqualTPermutations(cCandidate& candidate) {
+ vector tpermutations1, tpermutations2;
+ getPermutationsOfBranches(tpermutations1);
+ candidate.getPermutationsOfBranches(tpermutations2);
+
+ for (int i = 0; i < (int)tpermutations1.size(); i++) {
+ if ((tpermutations1[i].tcomposition.compare(tpermutations2[0].tcomposition) == 0) &&
+ (tpermutations1[i].startmodifID == tpermutations2[0].startmodifID) &&
+ (tpermutations1[i].endmodifID == tpermutations2[0].endmodifID) &&
+ (tpermutations1[i].middlemodifID == tpermutations2[0].middlemodifID) &&
+ (tpermutations1[i].middlebranchstart == tpermutations2[0].middlebranchstart) &&
+ (tpermutations1[i].middlebranchend == tpermutations2[0].middlebranchend)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+bool cCandidate::hasOnlyArtificialBricks(cBricksDatabase& brickdatabasewithcombinations) {
+ if (numberofinternalbricks <= 2) {
+ cBrick b;
+ vector intcomposition;
+ b.setComposition(internalcomposition,false);
+ b.explodeToIntComposition(intcomposition);
+ for (int i = 0; i < (int)intcomposition.size(); i++) {
+ if (!brickdatabasewithcombinations[intcomposition[i] - 1].isArtificial()) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+
+void cCandidate::getRotations(vector& rotations, bool includerevertedrotations) {
+ rotations.clear();
+ //rotations.push_back(composition);
+ getPartialRotations(internalcomposition, rotations);
+
+ if (includerevertedrotations) {
+ cBrick brick;
+ brick.setComposition(internalcomposition, false);
+ //rotations.push_back(reversedcomposition);
+ getPartialRotations(brick.getReverseComposition(), rotations);
+ }
+}
+
+
+void cCandidate::getLassoRotations(vector& lassorotations, bool includerevertedrotations) {
+ lassorotations.clear();
+ getPartialLassoRotations(internalcomposition, lassorotations, branchstart, branchend);
+ if (includerevertedrotations) {
+ getPartialLassoRotations(getRevertedTComposition(false), lassorotations, numberofinternalbricks - branchend - 1, numberofinternalbricks - branchstart - 1);
+ }
+}
+
+
+void cCandidate::store(ofstream& os) {
+ int size;
+
+ os.write((char *)&startmodifID, sizeof(int));
+ os.write((char *)&endmodifID, sizeof(int));
+ os.write((char *)&middlemodifID, sizeof(int));
+ os.write((char *)&branchstart, sizeof(int));
+ os.write((char *)&branchend, sizeof(int));
+
+ size = (int)path.size();
+ os.write((char *)&size, sizeof(int));
+ for (int i = 0; i < (int)path.size(); i++) {
+ path[i].store(os);
+ }
+
+ size = (int)composition.size();
+ os.write((char *)&size, sizeof(int));
+ for (int i = 0; i < (int)composition.size(); i++) {
+ size = (int)composition[i].size();
+ os.write((char *)&size, sizeof(int));
+ os.write(composition[i].c_str(), composition[i].size());
+ }
+
+ size = (int)internalcomposition.size();
+ os.write((char *)&size, sizeof(int));
+ os.write(internalcomposition.c_str(), internalcomposition.size());
+
+ os.write((char *)&numberofinternalbricks, sizeof(int));
+}
+
+
+void cCandidate::load(ifstream& is) {
+ int size;
+
+ is.read((char *)&startmodifID, sizeof(int));
+ is.read((char *)&endmodifID, sizeof(int));
+ is.read((char *)&middlemodifID, sizeof(int));
+ is.read((char *)&branchstart, sizeof(int));
+ is.read((char *)&branchend, sizeof(int));
+
+ is.read((char *)&size, sizeof(int));
+ path.resize(size);
+ for (int i = 0; i < (int)path.size(); i++) {
+ path[i].load(is);
+ }
+
+ is.read((char *)&size, sizeof(int));
+ composition.resize(size);
+ for (int i = 0; i < (int)composition.size(); i++) {
+ is.read((char *)&size, sizeof(int));
+ composition[i].resize(size);
+ is.read(&composition[i][0], composition[i].size());
+ }
+
+ is.read((char *)&size, sizeof(int));
+ internalcomposition.resize(size);
+ is.read(&internalcomposition[0], internalcomposition.size());
+
+ is.read((char *)&numberofinternalbricks, sizeof(int));
+}
+
+
+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
new file mode 100644
index 0000000..4f0df3f
--- /dev/null
+++ b/CycloBranch/core/cCandidate.h
@@ -0,0 +1,472 @@
+/**
+ \file cCandidate.h
+ \brief The representation of a peptide sequence candidate.
+*/
+
+
+#ifndef _CCANDIDATE_H
+#define _CCANDIDATE_H
+
+#include
+#include
+#include
+
+#include "core/cParameters.h"
+#include "core/cFragmentIons.h"
+#include "core/cBricksDatabase.h"
+#include "core/cDeNovoGraphNode.h"
+
+class cCandidateSet;
+
+
+using namespace std;
+
+
+/**
+ \brief An auxiliary structure representing a branch permutation of a branched peptide.
+*/
+struct TRotationInfo {
+
+ /**
+ \brief Id of the rotation.
+ */
+ int id;
+
+
+ /**
+ \brief Vector of ids of bricks.
+ */
+ vector bricks;
+
+
+ /**
+ \brief Position of a brick where a branch of a branched peptide starts.
+ */
+ int middlebranchstart;
+
+
+ /**
+ \brief Position of a brick where a branch of a branched peptide ends.
+ */
+ int middlebranchend;
+
+
+ /**
+ \brief Id of a terminal modification (at the beginning of a spectrum).
+ */
+ int startmodifID;
+
+
+ /**
+ \brief Id of a terminal modification (at the end of a spectrum).
+ */
+ int endmodifID;
+
+
+ /**
+ \brief Id of a terminal modification of a branched peptide (in the middle of a spectrum).
+ */
+ int middlemodifID;
+
+
+ /**
+ \brief Ids of bricks separated by '-', the branch is specified by '(' and ')'; example: 1-2-3(4-5)6-7.
+ */
+ string tcomposition;
+
+
+ /**
+ \brief The constructor.
+ */
+ TRotationInfo() {
+ clear();
+ }
+
+
+ /**
+ \brief Clear the structure.
+ */
+ void clear() {
+ id = 0;
+ bricks.clear();
+ middlebranchstart = 0;
+ middlebranchend = 0;
+ startmodifID = 0;
+ endmodifID = 0;
+ middlemodifID = 0;
+ tcomposition = "";
+ }
+
+
+ /**
+ \brief Test whether \a tcomposition starts with a bracket.
+ \retval bool true when \a tcomposition starts with a bracket
+ */
+ bool startsWithBracket() {
+ if (tcomposition.size() == 0) {
+ return false;
+ }
+ return tcomposition[0] == '(';
+ }
+
+ /**
+ \brief Test whether \a tcomposition ends with a bracket.
+ \retval bool true when \a tcomposition ends with a bracket
+ */
+ bool endsWithBracket() {
+ if (tcomposition.size() == 0) {
+ return false;
+ }
+ return tcomposition.back() == ')';
+ }
+
+};
+
+
+/**
+ \brief The class representing a peptide sequence candidate.
+*/
+class cCandidate {
+
+ int startmodifID;
+ int endmodifID;
+ int middlemodifID;
+ int branchstart;
+ int branchend;
+ vector path;
+
+ vector composition;
+ string internalcomposition;
+ int numberofinternalbricks;
+
+ void updateInternalComposition();
+
+ void getPermutationsIter(cCandidateSet& permutations, vector& currentcandidate, int position, bool* terminatecomputation);
+
+ void attachSubBranchCandidates(cCandidate& candidate, cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation);
+
+ void attachAllBranches(cCandidate& candidate, cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation);
+
+ void getPartialRotations(string& composition, vector& rotations);
+
+ void getPartialLassoRotations(string& composition, vector& lassorotations, int branchstart, int branchend);
+
+public:
+
+ /**
+ \brief The default constructor.
+ */
+ cCandidate();
+
+
+ /**
+ \brief The constructor.
+ \param composition reference to a vector of strings where each string is a sequence of ids of bricks separated by '-' (each string corresponds to an edge in the de novo graph)
+ \param path reference to a path in the de novo graph which corresponds to a peptide sequence candidate
+ \param startmodifID id of a terminal modification (at the beginning of a spectrum)
+ \param endmodifID id of a terminal modification (at the end of a spectrum)
+ \param middlemodifID id of a terminal modification of a branched peptide (in the middle of a spectrum)
+ \param middlepos position in \a composition corresponding to a branch of a branched peptide
+ */
+ cCandidate(vector& composition, vector& path, int startmodifID, int endmodifID, int middlemodifID, int middlepos);
+
+
+ /**
+ \brief The constructor.
+ \param composition reference to a vector of strings where each string is a sequence of ids of bricks separated by '-' (each string corresponds to an edge in the de novo graph)
+ \param path reference to a path in the de novo graph which corresponds to a peptide sequence candidate
+ \param startmodifID id of a terminal modification (at the beginning of a spectrum)
+ \param endmodifID id of a terminal modification (at the end of a spectrum)
+ \param middlemodifID id of a terminal modification of a branched peptide (in the middle of a spectrum)
+ \param branchstart position of a brick where a branch of a branched peptide starts (it is assumed that all strings in \a composition are concatenated)
+ \param branchend position of a brick where a branch of a branched peptide ends (it is assumed that all strings in \a composition are concatenated)
+ */
+ cCandidate(vector& composition, vector& path, int startmodifID, int endmodifID, int middlemodifID, int branchstart, int branchend);
+
+
+ /**
+ \brief Set a peptide sequence candidate.
+ \param composition reference to a vector of strings where each string is a sequence of ids of bricks separated by '-' (each string corresponds to an edge in the de novo graph)
+ \param path reference to a path in the de novo graph which corresponds to a peptide sequence candidate
+ \param startmodifID id of a terminal modification (at the beginning of a spectrum)
+ \param endmodifID id of a terminal modification (at the end of a spectrum)
+ \param middlemodifID id of a terminal modification of a branched peptide (in the middle of a spectrum)
+ \param middlepos position in \a composition corresponding to a branch of a branched peptide
+ */
+ void setCandidate(vector& composition, vector& path, int startmodifID, int endmodifID, int middlemodifID, int middlepos);
+
+
+ /**
+ \brief Set a peptide sequence candidate.
+ \param composition reference to a vector of strings where each string is a sequence of ids of bricks separated by '-' (each string corresponds to an edge in the de novo graph)
+ \param path reference to a path in the de novo graph which corresponds to a peptide sequence candidate
+ \param startmodifID id of a terminal modification (at the beginning of a spectrum)
+ \param endmodifID id of a terminal modification (at the end of a spectrum)
+ \param middlemodifID id of a terminal modification of a branched peptide (in the middle of a spectrum)
+ \param branchstart position of a brick where a branch of a branched peptide starts (it is assumed that all strings in \a composition are concatenated)
+ \param branchend position of a brick where a branch of a branched peptide ends (it is assumed that all strings in \a composition are concatenated)
+ */
+ void setCandidate(vector& composition, vector& path, int startmodifID, int endmodifID, int middlemodifID, int branchstart, int branchend);
+
+
+ /**
+ \brief Clear the candidate.
+ */
+ void clear();
+
+
+ /**
+ \brief Access to the composition of the peptide sequence candidate.
+ \retval reference to a string of ids of bricks separated by '-'
+ */
+ string& getComposition();
+
+
+ /**
+ \brief Reverse the bricks composition of the candidate.
+ */
+ void revertComposition();
+
+
+ /**
+ \brief Prepare candidates of a branched or a lasso peptide.
+ \param result reference to an output set of possible peptide sequence candidates
+ \param peptidetype a type of an analyzed peptide
+ \param terminatecomputation pointer to a variable determining that the computation must be stopped
+ */
+ void prepareBranchedCandidate(cCandidateSet& result, peptideType peptidetype, bool* terminatecomputation);
+
+
+ /**
+ \brief Get a T-composition of a branched peptide.
+ \retval string containing ids of bricks separated by '-', the branch is specified by '(' and ')'; example: 1-2-3(4-5)6-7
+ */
+ string getTComposition();
+
+
+ /**
+ \brief Get a reverted T-composition of a branched peptide.
+ \param usebrackets if true then the branch is separated by '(' and ')' else '-' is used instead of brackets
+ \retval string containing ids of bricks separated by '-', the branch may be specified by '(' and ')'; example: 1-2-3(4-5)6-7
+ */
+ string getRevertedTComposition(bool usebrackets);
+
+
+ /**
+ \brief Get a T-composition of a branched peptide composed from acronyms of bricks.
+ \param brickdatabase reference to the database of bricks
+ \retval string containing acronyms of bricks separated by '-', the branch is specified by '(' and ')'
+ */
+ string getAcronymsTComposition(cBricksDatabase& brickdatabase);
+
+
+ /**
+ \brief Get a T-composition of a branched peptide composed from real names of bricks.
+ \param brickdatabase reference to the database of bricks
+ \retval string containing real names of bricks separated by '-', the branch is specified by '(' and ')'
+ */
+ string getRealNameTComposition(cBricksDatabase& brickdatabase);
+
+
+ /**
+ \brief Get a number of blocks forming a branch.
+ \retval int number of blocks
+ */
+ int getBranchSize();
+
+
+ /**
+ \brief Get starting position of a branch.
+ \retval int starting position of a branch
+ */
+ int getBranchStart();
+
+
+ /**
+ \brief Get end position of a branch.
+ \retval int end position of a branch
+ */
+ int getBranchEnd();
+
+
+ /**
+ \brief Get acronyms of blocks on a backbone of a branched peptide.
+ \param bricksdatabase reference to the database of bricks
+ \param acronyms an output vector of string acronyms
+ */
+ void getBackboneAcronyms(cBricksDatabase& bricksdatabase, vector& acronyms);
+
+
+ /**
+ \brief Get acronyms of blocks on a branch of a branched peptide.
+ \param bricksdatabase reference to the database of bricks
+ \param acronyms an output vector of string acronyms
+ */
+ void getBranchAcronyms(cBricksDatabase& bricksdatabase, vector& acronyms);
+
+
+ /**
+ \brief Get permutations of branches a branched peptide.
+ \param tpermutations reference to an output vector of auxiliary structures where permutations will be stored
+ */
+ void getPermutationsOfBranches(vector& tpermutations);
+
+
+ /**
+ \brief Get the precursor mass of the peptide sequence candidate.
+ \param brickdatabasewithcombinations reference to an input database of bricks with combinations of bricks
+ \param parameters a pointer to the parameters of the application
+ \retval double precursor mass of the candidate
+ */
+ double getPrecursorMass(cBricksDatabase& brickdatabasewithcombinations, cParameters* parameters);
+
+
+ /**
+ \brief Compare two candidates.
+ \param candidate reference to the other candidate
+ \retval bool true when the candidates are equal
+ */
+ bool isEqualTo(cCandidate& candidate);
+
+
+ /**
+ \brief Get a set of candidates with permutations of bricks.
+ \param permutations reference to an output set of candidates
+ \param terminatecomputation pointer to a variable determining that the computation must be stopped
+ */
+ void getPermutations(cCandidateSet& permutations, bool* terminatecomputation);
+
+
+ /**
+ \brief Get id of a terminal modification (at the beginning of a spectrum).
+ \retval int id of a terminal modification
+ */
+ int getStartModifID();
+
+
+ /**
+ \brief Set id of a terminal modification (at the beginning of a spectrum).
+ \param id of a terminal modification
+ */
+ void setStartModifID(int id);
+
+
+ /**
+ \brief Get id of a terminal modification (at the end of a spectrum).
+ \retval int id of a terminal modification
+ */
+ int getEndModifID();
+
+
+ /**
+ \brief Set id of a terminal modification (at the end of a spectrum).
+ \param id of a terminal modification
+ */
+ void setEndModifID(int id);
+
+
+ /**
+ \brief Get id of a terminal modification of a branched peptide (in the middle of a spectrum).
+ \retval int id of a terminal modification
+ */
+ int getMiddleModifID();
+
+
+ /**
+ \brief Set id of a terminal modification of a branched peptide (in the middle of a spectrum).
+ \param id of a terminal modification
+ */
+ void setMiddleModifID(int id);
+
+
+ /**
+ \brief Compare two candidates.
+ \param candidate reference to the other candidate
+ \retval bool true when the other candidate is greater
+ */
+ bool compare(cCandidate& candidate);
+
+
+ /**
+ \brief Get a path in the de novo graph corresponding to the peptide sequence candidate.
+ \retval vector reference to a vector of pairs node and edge
+ */
+ vector& getPath();
+
+
+ /**
+ \brief compare TPermutations of two candidates.
+ \param candidate reference to the second candidate
+ \retval true when candidates have equal TPermutations
+ */
+ bool hasEqualTPermutations(cCandidate& candidate);
+
+
+ /**
+ \brief Check whether the candidate is composed exclusively from artificial bricks.
+ \param brickdatabasewithcombinations reference to an input database of bricks with combinations of bricks
+ \retval bool true when the candidate is composed exclusively from artificial bricks; false when the candidate constains a regular brick
+ */
+ bool hasOnlyArtificialBricks(cBricksDatabase& brickdatabasewithcombinations);
+
+
+ /**
+ \brief Get rotations of a cyclic peptide sequence.
+ \param rotations reference to an output vector containing rotations of a sequence
+ \param includerevertedrotations if true then reverted rotations are also included
+ */
+ void getRotations(vector& rotations, bool includerevertedrotations);
+
+
+ /**
+ \brief Get lasso rotations of a lasso peptide sequence.
+ \param lassorotations reference to an output vector containing lasso rotations of a sequence
+ \param includerevertedrotations if true then reverted lasso rotations are also included
+ */
+ void getLassoRotations(vector& lassorotations, bool includerevertedrotations);
+
+
+ /**
+ \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);
+
+};
+
+
+/**
+ \brief The structure defining a hash function of cCandidate.
+*/
+struct hash_cCandidate {
+
+ /**
+ \brief Hash a peptide sequence candidate.
+ \param candidate reference to a peptide sequence candidate
+ \retval size_t hashed candidate
+ */
+ size_t operator()(const cCandidate& candidate) const {
+ return hash()(((cCandidate&)candidate).getComposition());
+ }
+
+};
+
+
+/**
+ \brief Overloaded operator ==.
+ \param a first candidate
+ \param b second candidate
+ \retval bool true when candidates are equal
+*/
+bool operator == (cCandidate const& a, cCandidate const& b);
+
+
+#endif
+
diff --git a/CycloBranch/core/cCandidateSet.cpp b/CycloBranch/core/cCandidateSet.cpp
new file mode 100644
index 0000000..f8d9d5e
--- /dev/null
+++ b/CycloBranch/core/cCandidateSet.cpp
@@ -0,0 +1,17 @@
+#include "core/cCandidateSet.h"
+
+
+cCandidateSet::cCandidateSet() {
+ candidates.clear();
+}
+
+
+int cCandidateSet::size() {
+ return (int)candidates.size();
+}
+
+
+unordered_set& cCandidateSet::getSet() {
+ return candidates;
+}
+
diff --git a/CycloBranch/core/cCandidateSet.h b/CycloBranch/core/cCandidateSet.h
new file mode 100644
index 0000000..8e2e984
--- /dev/null
+++ b/CycloBranch/core/cCandidateSet.h
@@ -0,0 +1,47 @@
+/**
+ \file cCandidateSet.h
+ \brief The representation of a set of peptide sequence candidates.
+*/
+
+
+#ifndef _CCANDIDATESET_H
+#define _CCANDIDATESET_H
+
+#include
+
+#include "core/cCandidate.h"
+
+
+/**
+ \brief The class representing a set of peptide sequence candidates.
+*/
+class cCandidateSet : public QMutex {
+
+ unordered_set candidates;
+
+public:
+
+ /**
+ \brief The constructor.
+ */
+ cCandidateSet();
+
+
+ /**
+ \brief Get the size of the set.
+ \retval int size of the set
+ */
+ int size();
+
+
+ /**
+ \brief Access to the set of candidates.
+ \retval unordered_set reference to the set of candidates
+ */
+ unordered_set& getSet();
+
+};
+
+
+#endif
+
diff --git a/CycloBranch/core/cDeNovoGraph.cpp b/CycloBranch/core/cDeNovoGraph.cpp
new file mode 100644
index 0000000..cf97657
--- /dev/null
+++ b/CycloBranch/core/cDeNovoGraph.cpp
@@ -0,0 +1,1008 @@
+#include "core/cDeNovoGraph.h"
+
+#include "gui/cMainThread.h"
+
+
+bool compareNodes(cDeNovoGraphNode& node1, cDeNovoGraphNode& node2) {
+ if (node1.getMZRatio() < node2.getMZRatio()) {
+ return true;
+ }
+ return false;
+}
+
+
+cDeNovoGraph::cDeNovoGraph() {
+ parameters = 0;
+ graph.clear();
+ lastsystemnode = 0;
+ os = 0;
+ startnode = 0;
+
+ graphreaderthread = 0;
+}
+
+
+bool cDeNovoGraph::findPath(int sourcenodeid, int edgeid, int targetnodeid, string& composition, string brickspath, int maximumbricksincombination, int depth) {
+ string localbrickpath;
+
+ int count = getNumberOfBricks(brickspath);
+
+ if ((depth > 1) && (sourcenodeid == targetnodeid)) {
+ cBrick b;
+ b.setComposition(brickspath, true);
+ if (composition.compare(b.getComposition()) == 0) {
+ //*os << endl << "brick: " << brickspath << " path: " << sourcenodeid << " ";
+ return true;
+ }
+ }
+
+ if (count < maximumbricksincombination) {
+ for (int i = 0; i < (int)graph[sourcenodeid].size(); i++) {
+ if ((i == edgeid) && (depth == 0)) {
+ continue;
+ }
+ localbrickpath = brickspath;
+ if (localbrickpath.size() > 0) {
+ localbrickpath += '-';
+ }
+ localbrickpath += graph[sourcenodeid][i].composition;
+ if (findPath(graph[sourcenodeid][i].targetnode, i, targetnodeid, composition, localbrickpath, maximumbricksincombination, depth + 1)) {
+ //*os << sourcenodeid << " ";
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+void cDeNovoGraph::createVectorsOfEdges() {
+ for (int i = 0; i < (int)graph.size(); i++) {
+ graph[i].createVectorOfEdges();
+ }
+}
+
+
+bool cDeNovoGraph::finishInPrecursor(int currentnode, double cummass) {
+
+ if (graph[currentnode].size() == 0) {
+ if (currentnode == (int)graph.size() - 1) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ if (cummass > graph.back().getMZRatio()) {
+ return false;
+ }
+
+ for (int i = 0; i < (int)graph[currentnode].size(); i++) {
+ if (finishInPrecursor(graph[currentnode][i].targetnode, cummass + graph[currentnode][i].massdifference)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+void cDeNovoGraph::initialize(cMainThread& os, cParameters& parameters) {
+ graph.clear();
+ lastsystemnode = 0;
+ this->os = &os;
+ this->parameters = ¶meters;
+ startnode = 0;
+}
+
+
+int cDeNovoGraph::createGraph(bool& terminatecomputation) {
+ cDeNovoGraphNode node;
+ double mass;
+ double termmass;
+ int left, right, middle;
+ cEdge e, e1, e2;
+ double unchargedprecursormass = uncharge(parameters->precursormass, parameters->precursorcharge);
+ double unchargedmz;
+ int i;
+
+ sortedpeaklist = parameters->peaklist;
+ // insert the single charged precursor, if neccessary
+ sortedpeaklist.sortbyMass();
+ sortedpeaklist.cropMaximumMZRatio(unchargedprecursormass);
+ if ((sortedpeaklist.size() > 0) && (!isInPpmMassErrorTolerance(sortedpeaklist[sortedpeaklist.size() - 1].mzratio, unchargedprecursormass, parameters->precursormasserrortolerance))) {
+ cPeak p;
+ p.mzratio = unchargedprecursormass;
+ sortedpeaklist.add(p);
+ }
+
+ *os << "Creating the de novo graph... " << endl;
+
+ // deconvolution
+ sortedpeaklist.removeChargeVariants(parameters->precursorcharge, parameters->fragmentmasserrortolerance);
+ *os << "Number of nodes after deconvolution: " << sortedpeaklist.size() << endl;
+
+ // remove water loss peaks
+ sortedpeaklist.removeNeutralLoss(- H2O, parameters->precursorcharge, parameters->fragmentmasserrortolerance);
+ *os << "Number of nodes when water loss ions are removed: " << sortedpeaklist.size() << endl;
+
+ // remove ammonia loss peaks
+ sortedpeaklist.removeNeutralLoss(- NH3, parameters->precursorcharge, parameters->fragmentmasserrortolerance);
+ *os << "Number of nodes when ammonia loss ions are removed: " << sortedpeaklist.size() << endl;
+
+ // insert system nodes
+ switch (parameters->peptidetype)
+ {
+ case cyclic:
+ node.clear();
+ node.setMZRatio(parameters->fragmentdefinitions[b_ion].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(b_ion);
+ graph.push_back(node);
+ break;
+ case linear:
+ case branched:
+ node.clear();
+ node.setMZRatio(0);
+ node.setIntensity(0);
+ node.addIonAnnotation(b_ion);
+ node.addIonAnnotation(y_ion);
+ graph.push_back(node);
+
+ node.clear();
+ node.setMZRatio(parameters->fragmentdefinitions[b_ion].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(b_ion);
+ graph.push_back(node);
+
+ node.clear();
+ node.setMZRatio(parameters->fragmentdefinitions[y_ion].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(y_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);
+
+ for (i = 1; i < (int)parameters->searchedmodifications.size(); i++) {
+ node.clear();
+
+ e.clear();
+ e.composition = "0";
+ e.targetnode = i + 2;
+
+ if (parameters->searchedmodifications[i].nterminal) {
+ node.setMZRatio(parameters->fragmentdefinitions[b_ion].massdifference + parameters->searchedmodifications[i].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(b_ion);
+ }
+
+ if (parameters->searchedmodifications[i].cterminal) {
+ node.setMZRatio(parameters->fragmentdefinitions[y_ion].massdifference + parameters->searchedmodifications[i].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(y_ion);
+ }
+
+ graph.push_back(node);
+ graph[0].insertTempEdge(e);
+ }
+
+ lastsystemnode = (int)graph.size() - 1;
+ startnode = 1;
+
+ // to do - problem with e.targetnode
+ //sort(graph.begin() + 1, graph.end(), compareNodes);
+
+ break;
+ case lasso:
+ node.clear();
+ node.setMZRatio(0);
+ node.setIntensity(0);
+ node.addIonAnnotation(b_ion);
+ //node.addIonAnnotation(y_ion);
+ graph.push_back(node);
+
+ node.clear();
+ node.setMZRatio(parameters->fragmentdefinitions[b_ion].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(b_ion);
+ graph.push_back(node);
+
+ //node.clear();
+ //node.setMZRatio(parameters->fragmentdefinitions[y_ion].massdifference);
+ //node.setIntensity(0);
+ //node.addIonAnnotation(y_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);
+
+ /*
+ for (i = 1; i < (int)parameters->searchedmodifications.size(); i++) {
+ node.clear();
+
+ e.clear();
+ e.composition = "0";
+ e.targetnode = i + 2;
+
+ if (parameters->searchedmodifications[i].nterminal) {
+ node.setMZRatio(parameters->fragmentdefinitions[b_ion].massdifference + parameters->searchedmodifications[i].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(b_ion);
+ }
+
+ if (parameters->searchedmodifications[i].cterminal) {
+ node.setMZRatio(parameters->fragmentdefinitions[y_ion].massdifference + parameters->searchedmodifications[i].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(y_ion);
+ }
+
+ graph.push_back(node);
+ graph[0].insertTempEdge(e);
+ }
+ */
+
+ lastsystemnode = (int)graph.size() - 1;
+ startnode = 1;
+ break;
+ case linearpolysaccharide:
+ node.clear();
+ node.setMZRatio(0);
+ node.setIntensity(0);
+ node.addIonAnnotation(ms_nterminal_ion_hplus);
+ //node.addIonAnnotation(ms_cterminal_ion_hplus);
+ graph.push_back(node);
+
+ node.clear();
+ node.setMZRatio(H2O + Hplus);
+ node.setIntensity(0);
+ node.addIonAnnotation(ms_nterminal_ion_hplus);
+ graph.push_back(node);
+
+ //node.clear();
+ //node.setMZRatio(H2O + Hplus);
+ //node.setIntensity(0);
+ //node.addIonAnnotation(ms_cterminal_ion_hplus);
+ //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);
+
+ for (i = 1; i < (int)parameters->searchedmodifications.size(); i++) {
+ node.clear();
+
+ e.clear();
+ e.composition = "0";
+ e.targetnode = i + 1;//2;
+
+ //if (parameters->searchedmodifications[i].nterminal) {
+ node.setMZRatio(H2O + Hplus + parameters->searchedmodifications[i].massdifference);
+ node.setIntensity(0);
+ node.addIonAnnotation(ms_nterminal_ion_hplus);
+ //}
+
+ //if (parameters->searchedmodifications[i].cterminal) {
+ // node.setMZRatio(H2O + Hplus +parameters->searchedmodifications[i].massdifference);
+ // node.setIntensity(0);
+ // node.addIonAnnotation(ms_cterminal_ion_hplus);
+ //}
+
+ graph.push_back(node);
+ graph[0].insertTempEdge(e);
+ }
+
+ lastsystemnode = (int)graph.size() - 1;
+ startnode = 1;
+ break;
+ default:
+ *os << "Undefined peptide type." << endl;
+ return -1;
+ }
+
+
+ // initialize nodes by mzratios from a sorted peak list
+ for (i = 0; i < sortedpeaklist.size(); i++) {
+ node.clear();
+ node.setMZRatio(sortedpeaklist[i].mzratio);
+ node.setIntensity(sortedpeaklist[i].intensity);
+ graph.push_back(node);
+ }
+
+ bricksdatabasewithcombinations = parameters->bricksdatabase;
+ *os << "Number of bricks: " << parameters->bricksdatabase.size() << endl;
+ *os << "Calculating number of brick combinations... ";
+
+ // initialization for generating the combinations of bricks
+ vector combarray;
+ int numberofbasicbricks = bricksdatabasewithcombinations.size();
+ string compositionname;
+ cBrick b;
+ bool usedbrick;
+
+ long long totaltested = 0;
+ for (i = 0; i < parameters->maximumbricksincombination; i++) {
+ combarray.push_back(0);
+ }
+
+ while (bricksdatabasewithcombinations.nextCombination(combarray, numberofbasicbricks, parameters->maximumbricksincombination, parameters->maximumcumulativemass)) {
+ if (terminatecomputation) {
+ return -1;
+ }
+ totaltested++;
+ }
+
+ *os << "ok" << endl;
+ *os << "Combinations of bricks: " << totaltested << endl;
+
+ totaltested = 0;
+ combarray.clear();
+ for (i = 0; i < parameters->maximumbricksincombination; i++) {
+ combarray.push_back(0);
+ }
+
+ // initialize edges
+ *os << "Generating combinations of bricks and generating edges... " << endl;
+
+ int j = 0;
+ while (bricksdatabasewithcombinations.nextCombination(combarray, numberofbasicbricks, parameters->maximumbricksincombination, parameters->maximumcumulativemass)) {
+
+ if (terminatecomputation) {
+ return -1;
+ }
+
+ totaltested++;
+
+ if (totaltested % 1000000 == 0) {
+ *os << totaltested << " ";
+ }
+
+ if (totaltested % 10000000 == 0) {
+ *os << endl;
+ }
+
+ usedbrick = false;
+
+ getNameOfCompositionFromIntVector(compositionname, combarray);
+ if (j < numberofbasicbricks) {
+ bricksdatabasewithcombinations[j].setComposition(compositionname, true);
+ }
+ else {
+ b.clear();
+ b.setMass(bricksdatabasewithcombinations.getMassOfComposition(combarray, parameters->maximumbricksincombination));
+ b.setComposition(compositionname, true);
+ bricksdatabasewithcombinations.push_back(b);
+ }
+
+ //cout << bricksdatabasewithcombinations.getAcronymName(bricksdatabasewithcombinations[j].getComposition(), false) << " " << bricksdatabasewithcombinations[j].getMass() << endl;
+
+ i = startnode;
+ while (i < (int)graph.size()) {
+
+ if (terminatecomputation) {
+ return -1;
+ }
+
+ if (i <= lastsystemnode) {
+ if (getNumberOfBricks(bricksdatabasewithcombinations[j].getComposition()) > parameters->maximumbricksincombinationbegin) {
+ i = lastsystemnode + 1;
+ }
+ }
+
+ if ((i > lastsystemnode) && (i < (int)graph.size() - 1)) {
+ if (getNumberOfBricks(bricksdatabasewithcombinations[j].getComposition()) > parameters->maximumbricksincombinationmiddle) {
+ i = (int)graph.size() - 1;
+ }
+ }
+
+ if (i == (int)graph.size() - 1) {
+ if (getNumberOfBricks(bricksdatabasewithcombinations[j].getComposition()) > parameters->maximumbricksincombinationend) {
+ break;
+ }
+ }
+
+ for (int k = 0; k < (int)parameters->fragmentionsfordenovograph.size(); k++) {
+
+ if (/*!graph[i].ionannotation[parameters->fragmentionsfordenovograph[k]] ||*/ (parameters->fragmentionsfordenovograph[k] == precursor_ion)) {
+ 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)) {
+ continue;
+ }
+
+ // terminal modifications
+ for (int n = 0; n < (int)parameters->searchedmodifications.size(); n++) {
+
+ if ((n > 0) && (parameters->fragmentionsfordenovograph[m] != precursor_ion)) {
+ continue;
+ }
+
+ // middle modifications for branched and lasso peptides
+ for (int p = 0; p < (int)parameters->searchedmodifications.size(); p++) {
+
+ if ((p > 0) && ((parameters->peptidetype == linear) || (parameters->peptidetype == cyclic) || (parameters->peptidetype == linearpolysaccharide))) {
+ continue;
+ }
+
+ termmass = 0;
+
+ if (parameters->fragmentionsfordenovograph[m] == precursor_ion) {
+
+ if ((parameters->peptidetype == linear) || ((parameters->peptidetype == linearpolysaccharide))) {
+ if ((n > 0) && ((parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].nterminal && parameters->searchedmodifications[n].nterminal) || (parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].cterminal && parameters->searchedmodifications[n].cterminal))) {
+ continue;
+ }
+ }
+
+ if (parameters->peptidetype == branched) {
+ if ((n > 0) && (p > 0) && ((parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].nterminal && parameters->searchedmodifications[n].nterminal && parameters->searchedmodifications[p].nterminal) || (parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].cterminal && parameters->searchedmodifications[n].cterminal && parameters->searchedmodifications[p].cterminal))) {
+ continue;
+ }
+ }
+
+ termmass = parameters->searchedmodifications[n].massdifference;
+
+ }
+
+ for (int z1 = 1; z1 <= parameters->precursorcharge; z1++) {
+
+ for (int z2 = 1; z2 <= parameters->precursorcharge; z2++) {
+
+ unchargedmz = uncharge(graph[i].getMZRatio(), z1);
+ if ((!isInPpmMassErrorTolerance(unchargedmz, unchargedprecursormass, parameters->fragmentmasserrortolerance)) && (unchargedmz > unchargedprecursormass)) {
+ continue;
+ }
+
+ mass = bricksdatabasewithcombinations[j].getMass();
+ mass -= parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].massdifference;
+ mass += parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[m]].massdifference;
+ mass += termmass;
+
+ if ((parameters->peptidetype == branched) || (parameters->peptidetype == lasso)) {
+ mass += parameters->searchedmodifications[p].massdifference;
+ }
+
+ // precursor is connected from the right side (sequence tags)
+ if (i == (int)graph.size() - 1) {
+ mass = unchargedmz - mass;
+ }
+ else {
+ mass += unchargedmz;
+ }
+
+ // search for a peak in a distance determined by a mass of a brick
+ left = lastsystemnode + 1;
+ right = (int)graph.size() - 2;
+ // binary search
+ while (left <= right) {
+
+ middle = (left + right) / 2;
+ if (isInPpmMassErrorTolerance(uncharge(graph[middle].getMZRatio(), z2), mass, parameters->fragmentmasserrortolerance)) {
+ // found
+ while ((middle > lastsystemnode + 1) && isInPpmMassErrorTolerance(uncharge(graph[middle - 1].getMZRatio(), z2), mass, parameters->fragmentmasserrortolerance)) {
+ middle--;
+ }
+ while ((middle < (int)graph.size()) && (isInPpmMassErrorTolerance(uncharge(graph[middle].getMZRatio(), z2), mass, parameters->fragmentmasserrortolerance))) {
+
+ // target node cannot be a system node
+ if (middle <= lastsystemnode) {
+ middle++;
+ continue;
+ }
+
+ // avoid cyclic paths
+ if (i == middle) {
+ middle++;
+ continue;
+ }
+
+ // mass corresponding to the target node must be <= uncharged precursor mass
+ if (uncharge(graph[middle].getMZRatio(), z2) > unchargedprecursormass) {
+ middle++;
+ continue;
+ }
+
+ // irrelevant connection with precursor
+ if ((parameters->fragmentionsfordenovograph[m] == precursor_ion) && (middle != (int)graph.size() - 1) && (i != (int)graph.size() - 1)) {
+ middle++;
+ continue;
+ }
+
+ // create an edge
+ cEdge e;
+
+ if (i == (int)graph.size() - 1) {
+ e.targetnode = i;
+ e.brickid = j;
+ e.ppmerror = ppmError(uncharge(graph[middle].getMZRatio(), z2), mass);
+ e.massdifference = abs(unchargedmz - uncharge(graph[middle].getMZRatio(), z2));
+ e.sourcecharge = z2;
+ e.targetcharge = z1;
+ e.targetintensity = graph[i].getIntensity();
+ e.composition = bricksdatabasewithcombinations[j].getComposition();
+ e.endmodifID = n;
+ e.middlemodifID = p;
+
+ // insert the new edge and/or attach the annotation to the source node if the edge exists
+ graph[middle].insertTempEdge(e);
+ }
+ else {
+ e.targetnode = middle;
+ e.brickid = j;
+ e.ppmerror = ppmError(uncharge(graph[middle].getMZRatio(), z2), mass);
+ e.massdifference = abs(uncharge(graph[middle].getMZRatio(), z2) - unchargedmz);
+ e.sourcecharge = z1;
+ e.targetcharge = z2;
+ e.targetintensity = graph[middle].getIntensity();
+ e.composition = bricksdatabasewithcombinations[j].getComposition();
+ e.endmodifID = n;
+ e.middlemodifID = p;
+
+ // insert the new edge and/or attach the annotation to the source node if the edge exists
+ graph[i].insertTempEdge(e);
+
+ }
+
+ usedbrick = true;
+
+ middle++;
+ }
+ break;
+ }
+ if (mass < uncharge(graph[middle].getMZRatio(), z2)) {
+ right = middle - 1;
+ }
+ else {
+ left = middle + 1;
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ i++;
+
+ }
+
+ if (((int)bricksdatabasewithcombinations.size() > numberofbasicbricks) && (!usedbrick)) {
+ bricksdatabasewithcombinations.removeLastBrick();
+ }
+ else {
+ j++;
+ }
+
+ }
+
+ createVectorsOfEdges();
+
+ *os << endl << "The de novo graph has been successfully created." << endl;
+ *os << "Number of bricks combinations used: " << bricksdatabasewithcombinations.size() << endl;
+ *os << "Number of nodes: " << graph.size() << endl;
+ *os << "Number of edges: " << getNumberOfEdges() << endl << endl;
+
+ return 0;
+}
+
+
+int cDeNovoGraph::removeEdgesFormingPathsNotFinishingInPrecursor(bool& terminatecomputation) {
+ *os << "Removing edges forming blind paths (not finishing in the precursor)... ";
+ double unchargedprecursormass = uncharge(parameters->precursormass, parameters->precursorcharge);
+ bool removed = true;
+ bool isprecursor;
+ int edgesremoved = 0;
+ int j;
+ while (removed) {
+ removed = false;
+ for (int i = startnode; i < (int)graph.size(); i++) {
+
+ if (terminatecomputation) {
+ return -1;
+ }
+
+ j = 0;
+ while (j < (int)graph[i].size()) {
+
+ // Is the target precursor ?
+ isprecursor = false;
+ for (int k = 1; k <= parameters->precursorcharge; k++) {
+ if (isInPpmMassErrorTolerance(graph[graph[i][j].targetnode].getMZRatio(), charge(unchargedprecursormass, k), parameters->precursormasserrortolerance)) {
+ isprecursor = true;
+ break;
+ }
+ }
+
+ // the target has not any outgoing edge and the target is not the precursor
+ if ((graph[graph[i][j].targetnode].size() == 0) && !isprecursor) {
+ graph[i].removeEdge(j);
+ edgesremoved++;
+ removed = true;
+ }
+ else {
+ j++;
+ }
+ }
+ }
+ }
+ *os << "ok" << endl;
+ *os << "Edges removed: " << edgesremoved << endl;
+ *os << "Number of edges: " << getNumberOfEdges() << endl << endl;
+
+ return 0;
+}
+
+
+int cDeNovoGraph::removeEdgesFormingPathsNotStartingFromFirstNode(bool& terminatecomputation) {
+ *os << "Removing edges forming blind paths (not starting from the first node)... ";
+ bool removed = true;
+ int edgesremoved = 0;
+ bool match;
+
+ while (removed) {
+ removed = false;
+ for (int i = lastsystemnode + 1; i < (int)graph.size(); i++) {
+
+ if (terminatecomputation) {
+ return -1;
+ }
+
+ // Am I a target node ?
+ match = false;
+ for (int j = startnode; j < (int)graph.size(); j++) {
+ for (int k = 0; k < (int)graph[j].size(); k++) {
+ if (graph[j][k].targetnode == i) {
+ match = true;
+ break;
+ }
+ }
+ if (match) {
+ break;
+ }
+ }
+
+ // remove all outgoing edges
+ if (!match) {
+ edgesremoved += (int)graph[i].size();
+ graph[i].clearEdges();
+ }
+
+ }
+ }
+ *os << "ok" << endl;
+ *os << "Edges removed: " << edgesremoved << endl;
+ *os << "Number of edges: " << getNumberOfEdges() << endl << endl;
+
+ return 0;
+}
+
+
+int cDeNovoGraph::connectEdgesFormingPathsNotFinishingInPrecursor(bool& terminatecomputation) {
+ *os << "Connecting edges with the precursor's node to generate sequence tags... ";
+ //*os << "Connecting edges forming blind paths (not finishing in the precursor)... ";
+ int edgescreated = 0;
+ int precursorposition = (int)graph.size() - 1;
+
+ for (int i = lastsystemnode + 1; i < precursorposition; i++) {
+
+ if (terminatecomputation) {
+ return -1;
+ }
+
+ // the target has not any outgoing edge and the target is not the precursor
+ //if (!finishInPrecursor(i, graph[i].getMZRatio())) {
+ cEdge e;
+ e.targetnode = (int)graph.size() - 1;
+ e.brickid = (int)bricksdatabasewithcombinations.size() + 1;
+ e.ppmerror = 0;
+ e.massdifference = abs(graph[precursorposition].getMZRatio() - graph[i].getMZRatio());
+ e.sourcecharge = 1;
+ e.targetcharge = 1;
+ e.targetintensity = graph[e.targetnode].getIntensity();
+ e.composition = to_string(e.brickid);
+ e.endmodifID = 0;
+ e.middlemodifID = 0;
+ graph[i].insertEdge(e);
+ edgescreated++;
+
+ cBrick b;
+ 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);
+ b.setComposition(to_string(e.brickid), false);
+ b.setArtificial(true);
+ bricksdatabasewithcombinations.push_back(b);
+ //}
+
+ }
+
+ *os << "ok" << endl;
+ *os << "Edges created: " << edgescreated << endl;
+ *os << "Number of edges: " << getNumberOfEdges() << endl << endl;
+
+ return 0;
+}
+
+
+int cDeNovoGraph::connectEdgesFormingPathsNotStartingFromFirstNode(bool& terminatecomputation) {
+ *os << "Connecting edges with the starting node to generate sequence tags... ";
+ //*os << "Connecting edges forming blind paths (not starting from the first node)... ";
+ int edgescreated = 0;
+ //bool match;
+
+ for (int i = lastsystemnode + 1; i < (int)graph.size() - 1; i++) {
+
+ if (terminatecomputation) {
+ return -1;
+ }
+
+ // Am I a target node ?
+ /*match = false;
+ for (int j = startnode; j < (int)graph.size() - 1; j++) {
+ for (int k = 0; k < (int)graph[j].size(); k++) {
+ if (graph[j][k].targetnode == i) {
+ match = true;
+ break;
+ }
+ }
+ if (match) {
+ break;
+ }
+ }*/
+
+ // connect with starting nodes
+ //if (!match) {
+ for (int j = startnode; j <= lastsystemnode; j++) {
+ cEdge e;
+ e.targetnode = i;
+ e.brickid = (int)bricksdatabasewithcombinations.size() + 1;
+ e.ppmerror = 0;
+ e.massdifference = abs(graph[i].getMZRatio() - graph[j].getMZRatio());
+ e.sourcecharge = 1;
+ e.targetcharge = 1;
+ e.targetintensity = graph[i].getIntensity();
+ e.composition = to_string(e.brickid);
+ e.endmodifID = 0;
+ e.middlemodifID = 0;
+ graph[j].insertEdge(e);
+ edgescreated++;
+
+ cBrick b;
+ 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);
+ b.setComposition(to_string(e.brickid), false);
+ b.setArtificial(true);
+ bricksdatabasewithcombinations.push_back(b);
+ }
+ //}
+
+ }
+
+ *os << "ok" << endl;
+ *os << "Edges created: " << edgescreated << endl;
+ *os << "Number of edges: " << getNumberOfEdges() << endl << endl;
+
+ return 0;
+}
+
+
+int cDeNovoGraph::removePathsWhichCanBeSubstitutedByLongerPath(bool& terminatecomputation) {
+ *os << "Removing edges forming paths which can be substituted by longer paths... ";
+ int edgesremoved = 0;
+ int j;
+
+ for (int i = startnode; i < (int)graph.size(); i++) {
+
+ if (terminatecomputation) {
+ return -1;
+ }
+
+ //*os << i << " ";
+ j = 0;
+ while (j < (int)graph[i].size()) {
+ cBrick b;
+ b.setComposition(graph[i][j].composition, true);
+ if (findPath(i, j, graph[i][j].targetnode, b.getComposition(), "", parameters->maximumbricksincombination, 0)) {
+ //*os << endl << "removing edge: " << i << "->" << graph[i][j].targetnode << " ";
+ graph[i].removeEdge(j);
+ edgesremoved++;
+ }
+ else {
+ j++;
+ }
+ }
+ }
+ *os << "ok" << endl;
+ *os << "Edges removed: " << edgesremoved << endl;
+ *os << "Number of edges: " << getNumberOfEdges() << endl << endl;
+
+ return 0;
+}
+
+
+void cDeNovoGraph::startGraphReader(cCandidateSet& candidates, bool& terminatecomputation) {
+ graphreaderthread = new cGraphReaderThread();
+ graphreaderthread->initialize(graph, bricksdatabasewithcombinations, candidates, parameters, os, lastsystemnode, terminatecomputation);
+ os->connect(graphreaderthread, SIGNAL(finished()), os, SLOT(graphReaderFinished()));
+ os->setGraphReaderIsWorking(true);
+ graphreaderthread->start();
+}
+
+
+int cDeNovoGraph::getNumberOfEdges() {
+ int edges = 0;
+ for (int i = 0; i < (int)graph.size(); i++) {
+ edges += (int)graph[i].size();
+ }
+ return edges;
+}
+
+
+void cDeNovoGraph::printPaths(cMainThread* os, cDeNovoGraphNode& node, vector& path, vector& composition) {
+ string s;
+
+ if (node.size() > 0) {
+ for (int i = 0; i < (int)node.size(); i++) {
+ if (node.getMZRatio() > 0) {
+ s = to_string(node.getMZRatio());
+ s += " (";
+ s += node[i].composition;
+ s += ")";
+ path.push_back(s);
+ composition.push_back(node[i].composition);
+ }
+ printPaths(os, graph[node[i].targetnode], path, composition);
+ if (node.getMZRatio() > 0) {
+ path.pop_back();
+ composition.pop_back();
+ }
+ }
+ }
+ else {
+ s = to_string(node.getMZRatio());
+ path.push_back(s);
+
+ vector tmp;
+ cCandidate candidate(composition, tmp, 0, 0, 0, -1);
+
+ *os << "bricks: " << getNumberOfBricks(candidate.getComposition()) << " edges: " << composition.size() << " composition: ";
+ *os << candidate.getComposition();
+ *os << " path: ";
+ for (int i = 0; i < (int)path.size(); i++) {
+ *os << path[i];
+ if (i < (int)path.size() - 1) {
+ *os << " -> ";
+ }
+ }
+ *os << endl;
+
+ path.pop_back();
+ }
+
+}
+
+
+string cDeNovoGraph::printGraph() {
+ string s, s2;
+ string g = "";
+
+ for (int i = 0; i < (int)graph.size(); i++) {
+
+ s = to_string(graph[i].getMZRatio());
+
+ if ((int)graph[i].size() > 0) {
+ g += "The node " + s + " with relative intensity " + to_string(graph[i].getIntensity()) + " has " + to_string(graph[i].size()) + " outgoing edge(s).
";
+ }
+ else {
+ g += "The node " + s + " with relative intensity " + to_string(graph[i].getIntensity()) + " does not have any outgoing edge.
";
+ }
+
+ //g += "Possible annotations: ";
+ //g += graph[i].printAnnotations();
+ //g += "\n";
+
+ for (int j = 0; j < (int)graph[i].size(); j++) {
+ s2 = to_string(graph[graph[i][j].targetnode].getMZRatio());
+ g += s + "->" + s2 + " using brick(s): ";
+ if (graph[i][j].composition.compare("0") == 0) {
+ g += "none";
+ }
+ else {
+ g += bricksdatabasewithcombinations.getAcronymName(graph[i][j].composition, true);
+ }
+ s2 = to_string(graph[i][j].ppmerror);
+ g += " (mass difference: " + to_string(graph[i][j].massdifference) + ", ";
+ g += "target intensity: " + to_string(graph[graph[i][j].targetnode].getIntensity()) + ", ";
+ 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 (graph[i][j].middlemodifID > 0) {
+ g += ", branch modification: " + parameters->searchedmodifications[graph[i][j].middlemodifID].name;
+ }
+ }
+ if (graph[i][j].endmodifID > 0) {
+ g += ", terminal modification: " + parameters->searchedmodifications[graph[i][j].endmodifID].name;
+ }
+ //g += graph[i][j].printSourceAnnotation(fragmentdefinitions);
+ //g += "->";
+ //g += graph[i][j].printTargetAnnotation(fragmentdefinitions);
+ g += ")
";
+ }
+
+ g += "
";
+ }
+
+ //vector path;
+ //vector composition;
+ //printPaths(os,graph[0],path,composition);
+
+ return g;
+}
+
+
+cDeNovoGraphNode& cDeNovoGraph::operator[](int position) {
+ return graph[position];
+}
+
+
+void cDeNovoGraph::sortEdgesByPPMError() {
+ for (int i = 0; i < (int)graph.size(); i++) {
+ graph[i].sortEdgesByPPMError();
+ }
+}
+
+
+void cDeNovoGraph::sortEdgesByTargetNodeIntensity() {
+ for (int i = 0; i < (int)graph.size(); i++) {
+ graph[i].sortEdgesByTargetNodeIntensity();
+ }
+}
+
+
+cBricksDatabase* cDeNovoGraph::getBrickDatabaseWithCombinations() {
+ return &bricksdatabasewithcombinations;
+}
+
diff --git a/CycloBranch/core/cDeNovoGraph.h b/CycloBranch/core/cDeNovoGraph.h
new file mode 100644
index 0000000..92cadcb
--- /dev/null
+++ b/CycloBranch/core/cDeNovoGraph.h
@@ -0,0 +1,185 @@
+/**
+ \file cDeNovoGraph.h
+ \brief The implementation of the de novo graph.
+*/
+
+
+#ifndef _CDENOVOGRAPH_H
+#define _CDENOVOGRAPH_H
+
+#include
+#include
+#include
+#include
+
+#include "core/cParameters.h"
+#include "core/cDeNovoGraphNode.h"
+#include "core/cPeaksList.h"
+#include "core/cBricksDatabase.h"
+#include "core/cTheoreticalSpectrumList.h"
+#include "parallel/cGraphReaderThread.h"
+
+class cMainThread;
+
+
+using namespace std;
+
+
+/**
+ \brief Compare two nodes.
+ \param node1 reference to the first node
+ \param node2 reference to the second node
+ \retval bool true when the mz ratio of the first node is smaller than the mz ratio of the second node
+*/
+bool compareNodes(cDeNovoGraphNode& node1, cDeNovoGraphNode& node2);
+
+
+/**
+ \brief The class implementing the de novo graph.
+*/
+class cDeNovoGraph {
+
+ cParameters* parameters;
+ vector graph;
+ cPeaksList sortedpeaklist;
+ cBricksDatabase bricksdatabasewithcombinations;
+ int lastsystemnode;
+ cMainThread* os;
+ int startnode;
+
+ cGraphReaderThread* graphreaderthread;
+
+ bool findPath(int sourcenodeid, int edgeid, int targetnodeid, string& composition, string brickspath, int maximumbricksincombination, int depth);
+
+ // create vectors of edges from temporary unordered_sets
+ void createVectorsOfEdges();
+
+ // check whether a path leads to the precursor
+ bool finishInPrecursor(int currentnode, double cummass);
+
+public:
+
+ /**
+ \brief The constructor.
+ */
+ cDeNovoGraph();
+
+
+ /**
+ \brief Initialize the graph.
+ \param os reference to the main thread of the application
+ \param parameters reference to program parameters
+ */
+ void initialize(cMainThread& os, cParameters& parameters);
+
+
+ /**
+ \brief Create the graph.
+ \param terminatecomputation reference to a variable determining that the computation must be stopped
+ \retval int 0 = successfully finished, -1 computation terminated
+ */
+ int createGraph(bool& terminatecomputation);
+
+
+ /**
+ \brief Remove edges which do not form a path finishing in the precursor.
+ \param terminatecomputation reference to a variable determining that the computation must be stopped
+ \retval int 0 = successfully finished, -1 computation terminated
+ */
+ int removeEdgesFormingPathsNotFinishingInPrecursor(bool& terminatecomputation);
+
+
+ /**
+ \brief Remove edges which do not start from system nodes.
+ \param terminatecomputation reference to a variable determining that the computation must be stopped
+ \retval int 0 = successfully finished, -1 computation terminated
+ */
+ int removeEdgesFormingPathsNotStartingFromFirstNode(bool& terminatecomputation);
+
+
+ /**
+ \brief Connect edges which do not form a path finishing in the precursor.
+ \param terminatecomputation reference to a variable determining that the computation must be stopped
+ \retval int 0 = successfully finished, -1 computation terminated
+ */
+ int connectEdgesFormingPathsNotFinishingInPrecursor(bool& terminatecomputation);
+
+
+ /**
+ \brief Connect edges which do not start from system nodes.
+ \param terminatecomputation reference to a variable determining that the computation must be stopped
+ \retval int 0 = successfully finished, -1 computation terminated
+ */
+ int connectEdgesFormingPathsNotStartingFromFirstNode(bool& terminatecomputation);
+
+
+ /**
+ \brief Remove paths which can be substituted by longer paths.
+ \param terminatecomputation reference to a variable determining that the computation must be stopped
+ \retval int 0 = successfully finished, -1 computation terminated
+ */
+ int removePathsWhichCanBeSubstitutedByLongerPath(bool& terminatecomputation);
+
+
+ /**
+ \brief Start the graph reader.
+ \param candidates output set of candidates
+ \param terminatecomputation reference to a variable determining that the computation must be stopped
+ */
+ void startGraphReader(cCandidateSet& candidates, bool& terminatecomputation);
+
+
+ /**
+ \brief Get the number of edges.
+ \retval int number of edges
+ */
+ int getNumberOfEdges();
+
+
+ /**
+ \brief Print all paths in the graph into a stream.
+ \param os pointer to the main thread of the application (stream, respectively).
+ \param node reference to a starting node
+ \param path reference to an auxiliary empty vector of strings
+ \param composition reference to an auxiliary empty vector of strings
+ */
+ void printPaths(cMainThread* os, cDeNovoGraphNode& node, vector& path, vector& composition);
+
+
+ /**
+ \brief Print the graph to a string.
+ \retval string the printed graph
+ */
+ string printGraph();
+
+
+ /**
+ \brief Overloaded operator [].
+ \param position position of a node
+ \retval cDeNovoGraphNode reference to a node
+ */
+ cDeNovoGraphNode& operator[](int position);
+
+
+ /**
+ \brief Sort edges by ppm error.
+ */
+ void sortEdgesByPPMError();
+
+
+ /**
+ \brief Sort edges by target node intensity.
+ */
+ void sortEdgesByTargetNodeIntensity();
+
+
+ /**
+ \brief Access to the database of bricks with combinations of bricks.
+ \retval cBricksDatabase pointer to a database of bricks
+ */
+ cBricksDatabase* getBrickDatabaseWithCombinations();
+
+};
+
+
+#endif
\ No newline at end of file
diff --git a/CycloBranch/core/cDeNovoGraphNode.cpp b/CycloBranch/core/cDeNovoGraphNode.cpp
new file mode 100644
index 0000000..4c3b4d1
--- /dev/null
+++ b/CycloBranch/core/cDeNovoGraphNode.cpp
@@ -0,0 +1,128 @@
+#include "core/cDeNovoGraphNode.h"
+
+
+void nodeEdge::store(ofstream& os) {
+ os.write((char *)&nodeid, sizeof(int));
+ os.write((char *)&edgeid, sizeof(int));
+}
+
+
+void nodeEdge::load(ifstream& is) {
+ is.read((char *)&nodeid, sizeof(int));
+ is.read((char *)&edgeid, sizeof(int));
+}
+
+
+bool operator == (cEdge const& a, cEdge const& b) {
+ return (a.targetnode == b.targetnode) && (a.brickid == b.brickid);
+}
+
+
+bool compareEdgesByPPMError(cEdge& a, cEdge& b) {
+ return (a.ppmerror < b.ppmerror);
+}
+
+
+bool compareEdgesByTargetNodeIntensityDesc(cEdge& a, cEdge& b) {
+ return (a.targetintensity > b.targetintensity);
+}
+
+
+cDeNovoGraphNode::cDeNovoGraphNode() {
+ clear();
+}
+
+
+void cDeNovoGraphNode::clear() {
+ mzratio = 0;
+ intensity = 0;
+ ionannotation.clear();
+
+ for (int i = 0; i < fragmentIonTypeEnd; i++)
+ {
+ ionannotation[(fragmentIonType)i] = false;
+ }
+
+ tempedges.clear();
+ edges.clear();
+}
+
+
+double cDeNovoGraphNode::getMZRatio() {
+ return mzratio;
+}
+
+
+void cDeNovoGraphNode::setMZRatio(double mzratio) {
+ this->mzratio = mzratio;
+}
+
+
+double cDeNovoGraphNode::getIntensity() {
+ return intensity;
+}
+
+
+void cDeNovoGraphNode::setIntensity(double intensity) {
+ this->intensity = intensity;
+}
+
+
+void cDeNovoGraphNode::insertTempEdge(cEdge& e) {
+ tempedges.insert(e);
+}
+
+
+void cDeNovoGraphNode::insertEdge(cEdge& e) {
+ edges.push_back(e);
+}
+
+
+void cDeNovoGraphNode::sortEdgesByPPMError() {
+ sort(edges.begin(), edges.end(), compareEdgesByPPMError);
+}
+
+
+void cDeNovoGraphNode::sortEdgesByTargetNodeIntensity() {
+ sort(edges.begin(), edges.end(), compareEdgesByTargetNodeIntensityDesc);
+}
+
+
+void cDeNovoGraphNode::createVectorOfEdges() {
+ edges.clear();
+ while (tempedges.size() > 0) {
+ edges.push_back(*tempedges.begin());
+ tempedges.erase(tempedges.begin());
+ }
+}
+
+
+int cDeNovoGraphNode::size() {
+ return (int)edges.size();
+}
+
+
+cEdge& cDeNovoGraphNode::operator[](int position) {
+ return edges[position];
+}
+
+
+void cDeNovoGraphNode::removeEdge(int position) {
+ edges.erase(edges.begin() + position);
+}
+
+
+void cDeNovoGraphNode::clearEdges() {
+ edges.clear();
+}
+
+
+void cDeNovoGraphNode::addIonAnnotation(fragmentIonType iontype) {
+ ionannotation[iontype] = true;
+}
+
+
+bool cDeNovoGraphNode::checkIonAnnotation(fragmentIonType iontype) {
+ return ionannotation[iontype];
+}
+
diff --git a/CycloBranch/core/cDeNovoGraphNode.h b/CycloBranch/core/cDeNovoGraphNode.h
new file mode 100644
index 0000000..8ee33bd
--- /dev/null
+++ b/CycloBranch/core/cDeNovoGraphNode.h
@@ -0,0 +1,321 @@
+/**
+ \file cDeNovoGraphNode.h
+ \brief The representation of a node in the de novo graph.
+*/
+
+
+#ifndef _CDENOVOGRAPHNODE_H
+#define _CDENOVOGRAPHNODE_H
+
+#include
+#include
+#include