diff --git a/CycloBranch/CycloBranch-Linux.pro b/CycloBranch/CycloBranch-Linux.pro index 20323f5..d9aaa86 100644 --- a/CycloBranch/CycloBranch-Linux.pro +++ b/CycloBranch/CycloBranch-Linux.pro @@ -45,6 +45,8 @@ HEADERS += core/cAllocator.h \ gui/cFragmentIonsListWidget.h \ gui/cGraphWidget.h \ gui/cHTMLExportDialog.h \ + gui/cImageWindow.h \ + gui/cImageWindowWidget.h \ gui/cLinearWidget.h \ gui/cMainThread.h \ gui/cMainWindow.h \ @@ -53,6 +55,7 @@ HEADERS += core/cAllocator.h \ gui/cSequenceDatabaseWidget.h \ gui/cSpectrumDetailWidget.h \ gui/cSpectrumSceneWidget.h \ + gui/cSummaryPeaksTableWidget.h \ parallel/cGraphReaderThread.h \ parallel/cSpectrumComparatorThread.h SOURCES += core/cBrick.cpp \ @@ -86,6 +89,8 @@ SOURCES += core/cBrick.cpp \ gui/cFragmentIonsListWidget.cpp \ gui/cGraphWidget.cpp \ gui/cHTMLExportDialog.cpp \ + gui/cImageWindow.cpp \ + gui/cImageWindowWidget.cpp \ gui/cLinearWidget.cpp \ gui/cMainThread.cpp \ gui/cMainWindow.cpp \ @@ -94,6 +99,7 @@ SOURCES += core/cBrick.cpp \ gui/cSequenceDatabaseWidget.cpp \ gui/cSpectrumDetailWidget.cpp \ gui/cSpectrumSceneWidget.cpp \ + gui/cSummaryPeaksTableWidget.cpp \ parallel/cGraphReaderThread.cpp \ parallel/cSpectrumComparatorThread.cpp \ main.cpp diff --git a/CycloBranch/CycloBranch-MacOSX.pro b/CycloBranch/CycloBranch-MacOSX.pro index 7014a69..a20edbc 100644 --- a/CycloBranch/CycloBranch-MacOSX.pro +++ b/CycloBranch/CycloBranch-MacOSX.pro @@ -53,6 +53,8 @@ HEADERS += core/cAllocator.h \ gui/cFragmentIonsListWidget.h \ gui/cGraphWidget.h \ gui/cHTMLExportDialog.h \ + gui/cImageWindow.h \ + gui/cImageWindowWidget.h \ gui/cLinearWidget.h \ gui/cMainThread.h \ gui/cMainWindow.h \ @@ -61,6 +63,7 @@ HEADERS += core/cAllocator.h \ gui/cSequenceDatabaseWidget.h \ gui/cSpectrumDetailWidget.h \ gui/cSpectrumSceneWidget.h \ + gui/cSummaryPeaksTableWidget.h \ parallel/cGraphReaderThread.h \ parallel/cSpectrumComparatorThread.h SOURCES += core/cBrick.cpp \ @@ -94,6 +97,8 @@ SOURCES += core/cBrick.cpp \ gui/cFragmentIonsListWidget.cpp \ gui/cGraphWidget.cpp \ gui/cHTMLExportDialog.cpp \ + gui/cImageWindow.cpp \ + gui/cImageWindowWidget.cpp \ gui/cLinearWidget.cpp \ gui/cMainThread.cpp \ gui/cMainWindow.cpp \ @@ -102,6 +107,7 @@ SOURCES += core/cBrick.cpp \ gui/cSequenceDatabaseWidget.cpp \ gui/cSpectrumDetailWidget.cpp \ gui/cSpectrumSceneWidget.cpp \ + gui/cSummaryPeaksTableWidget.cpp \ parallel/cGraphReaderThread.cpp \ parallel/cSpectrumComparatorThread.cpp \ main.cpp diff --git a/CycloBranch/CycloBranch.vcxproj b/CycloBranch/CycloBranch.vcxproj index 714f7a1..279e2b5 100644 --- a/CycloBranch/CycloBranch.vcxproj +++ b/CycloBranch/CycloBranch.vcxproj @@ -221,6 +221,14 @@ true true + + true + true + + + true + true + true true @@ -257,6 +265,10 @@ true true + + true + true + @@ -323,6 +335,14 @@ true true + + true + true + + + true + true + true true @@ -359,6 +379,10 @@ true true + + true + true + @@ -372,6 +396,8 @@ + + @@ -380,6 +406,7 @@ + @@ -402,6 +429,60 @@ + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cImageWindowWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cImageWindowWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cImageWindowWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cImageWindowWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cImageWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cImageWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cImageWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cImageWindow.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cSummaryPeaksTableWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cSummaryPeaksTableWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cSummaryPeaksTableWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtSvg" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing cSummaryPeaksTableWidget.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtPrintSupport" "-IC:\boost_1_57_0" "-IC:\xerces-c-3.1.1\include" + $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing cHTMLExportDialog.h... diff --git a/CycloBranch/CycloBranch.vcxproj.filters b/CycloBranch/CycloBranch.vcxproj.filters index aaef3c0..9be1365 100644 --- a/CycloBranch/CycloBranch.vcxproj.filters +++ b/CycloBranch/CycloBranch.vcxproj.filters @@ -314,6 +314,33 @@ Source Files\core + + 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 + @@ -394,6 +421,15 @@ Header Files\gui + + Header Files\gui + + + Header Files\gui + + + Header Files\gui + diff --git a/CycloBranch/core/cBrick.cpp b/CycloBranch/core/cBrick.cpp index 8c488b2..936429e 100644 --- a/CycloBranch/core/cBrick.cpp +++ b/CycloBranch/core/cBrick.cpp @@ -50,7 +50,7 @@ void cBrick::clear() { mass = 0; composition = ""; artificial = false; - residuelosstype = water; + residuelosstype = h2o_loss; } diff --git a/CycloBranch/core/cBrick.h b/CycloBranch/core/cBrick.h index 4711641..3a3ef83 100644 --- a/CycloBranch/core/cBrick.h +++ b/CycloBranch/core/cBrick.h @@ -21,9 +21,18 @@ using namespace std; \brief Residue loss types. */ enum eResidueLossType { - water = 0, - h2, - h2o2 + h2o_loss = 0, + h2_loss +}; + + +/** + \brief Precursor loss types. +*/ +enum eKetidePrecursorType { + ketide_precursor_h2o = 0, + ketide_precursor_h2, + ketide_precursor_h2o2 }; diff --git a/CycloBranch/core/cBricksDatabase.cpp b/CycloBranch/core/cBricksDatabase.cpp index 6c43754..c7cd9ae 100644 --- a/CycloBranch/core/cBricksDatabase.cpp +++ b/CycloBranch/core/cBricksDatabase.cpp @@ -67,7 +67,7 @@ bool cBricksDatabase::nextCombination(vector& combarray, int numberofbasicb combarray[pointer]++; // set combarray[pointer] to the maximum value when outside of the mass range - mass = getMassOfComposition(combarray); + mass = getMassOfComposition(combarray, numberofbasicbricks); if ((cyFlag == 0) && (combarray[pointer] <= numberofbasicbricks) && (((maximumcumulativemass > 0) && (mass > maximumcumulativemass)) || (mass > neutralprecursormass))) { combarray[pointer] = numberofbasicbricks + 1; @@ -82,7 +82,7 @@ bool cBricksDatabase::nextCombination(vector& combarray, int numberofbasicb } // skip combinations outside of the mass range - mass = getMassOfComposition(combarray); + mass = getMassOfComposition(combarray, numberofbasicbricks); while ((combarray[pointer] <= numberofbasicbricks) && (pointer < maximumbricksincombination - 1) && (((maximumcumulativemass > 0) && (mass > maximumcumulativemass)) || (mass > neutralprecursormass))) { pointer++; @@ -92,7 +92,7 @@ bool cBricksDatabase::nextCombination(vector& combarray, int numberofbasicb combarray[i] = combarray[pointer]; } - mass = getMassOfComposition(combarray); + mass = getMassOfComposition(combarray, numberofbasicbricks); } if ((combarray[pointer] > numberofbasicbricks) || ((maximumcumulativemass > 0) && (mass > maximumcumulativemass)) || (mass > neutralprecursormass)) { @@ -128,7 +128,7 @@ int cBricksDatabase::loadFromPlainTextStream(ifstream &stream, string& errormess size_t pos; double mass; -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 regex rx; string name; #endif @@ -165,17 +165,12 @@ int cBricksDatabase::loadFromPlainTextStream(ifstream &stream, string& errormess break; } -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 name = b.getName(); rx = "^\\(-2H\\) "; if (regex_search(name, rx)) { - b.setResidueLossType(h2); - } - - rx = "^\\(-2OH\\) "; - if (regex_search(name, rx)) { - b.setResidueLossType(h2o2); + b.setResidueLossType(h2_loss); } #endif @@ -284,11 +279,11 @@ cBrick& cBricksDatabase::operator[](int position) { } -double cBricksDatabase::getMassOfComposition(vector& combarray) { +double cBricksDatabase::getMassOfComposition(vector& combarray, int numberofbasicbricks) { double mass = 0; int i = 0; while (i < (int)combarray.size()) { - if (combarray[i] > 0) { + if ((combarray[i] > 0) && (combarray[i] <= numberofbasicbricks)) { mass += bricks[combarray[i] - 1].getMass(); } i++; @@ -554,10 +549,10 @@ void cBricksDatabase::load(ifstream& is) { } -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 -bool cBricksDatabase::checkPolyketideBlocks(cBrick& brickseries) { +bool cBricksDatabase::checkKetideBlocks(cBrick& brickseries) { vector intcomposition; brickseries.explodeToIntComposition(intcomposition); @@ -565,20 +560,26 @@ bool cBricksDatabase::checkPolyketideBlocks(cBrick& brickseries) { return false; } - int hydrogens = 0; - int hydroxyls = 0; + int h2_blocks = 0; + int h2o_blocks = 0; for (int i = 0; i < (int)intcomposition.size(); i++) { - if (bricks[intcomposition[i] - 1].getResidueLossType() == h2) { - hydrogens++; + if (bricks[intcomposition[i] - 1].getResidueLossType() == h2_loss) { + h2_blocks++; } - if (bricks[intcomposition[i] - 1].getResidueLossType() == h2o2) { - hydroxyls++; + if (bricks[intcomposition[i] - 1].getResidueLossType() == h2o_loss) { + h2o_blocks++; } } - if ((hydrogens == hydroxyls) || (hydrogens == hydroxyls + 1) || (hydrogens + 1 == hydroxyls)) { + if ((h2_blocks == h2o_blocks) || (h2_blocks == h2o_blocks + 1) || (h2_blocks + 1 == h2o_blocks)) { + return true; + } + + /* + if ((h2_blocks == 0) && (h2o_blocks == (int)intcomposition.size())) { return true; } + */ return false; } diff --git a/CycloBranch/core/cBricksDatabase.h b/CycloBranch/core/cBricksDatabase.h index 3a236c8..0cc5801 100644 --- a/CycloBranch/core/cBricksDatabase.h +++ b/CycloBranch/core/cBricksDatabase.h @@ -134,9 +134,10 @@ class cBricksDatabase { /** \brief Get the mass of a composition of bricks. \param combarray reference to an input integer vector of ids + \param numberofbasicbricks number of basic building blocks \retval double cumulative mass of the bricks in the \a combarray */ - double getMassOfComposition(vector& combarray); + double getMassOfComposition(vector& combarray, int numberofbasicbricks); /** @@ -223,15 +224,15 @@ class cBricksDatabase { void load(ifstream& is); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 /** - \brief Check if the numbers of hydrogen and hydroxyl blocks are correct. + \brief Check if the numbers of H2 loss and H2O loss blocks are correct. \param brickseries a tested combination of building blocks \retval bool true when the numbers of blocks are correct */ - bool checkPolyketideBlocks(cBrick& brickseries); + bool checkKetideBlocks(cBrick& brickseries); #endif diff --git a/CycloBranch/core/cCandidate.cpp b/CycloBranch/core/cCandidate.cpp index cca1343..bd598ff 100644 --- a/CycloBranch/core/cCandidate.cpp +++ b/CycloBranch/core/cCandidate.cpp @@ -326,6 +326,7 @@ void cCandidate::prepareBranchedCandidates(cCandidateSet& result, ePeptideType p c = *this; c.branchstart = 0; c.branchend = i; + c.revertComposition(); result.getSet().insert(c); } } @@ -754,18 +755,18 @@ double cCandidate::getPrecursorMass(cBricksDatabase& brickdatabasewithcombinatio case branchcyclic: mass = parameters->fragmentdefinitions[cyclic_precursor_ion].massdifference + parameters->searchedmodifications[middlemodifID].massdifference; break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - switch (getResidueLossType(brickdatabasewithcombinations)) +#if OLIGOKETIDES == 1 + case linearoligoketide: + switch (getKetidePrecursorType(brickdatabasewithcombinations)) { - case water: - mass = parameters->fragmentdefinitions[linear_polyketide_precursor_ion_h_oh].massdifference; + case ketide_precursor_h2o: + mass = parameters->fragmentdefinitions[linear_oligoketide_precursor_ion_h_oh].massdifference; break; - case h2: - mass = parameters->fragmentdefinitions[linear_polyketide_precursor_ion_h_h].massdifference; + case ketide_precursor_h2: + mass = parameters->fragmentdefinitions[linear_oligoketide_precursor_ion_h_h].massdifference; break; - case h2o2: - mass = parameters->fragmentdefinitions[linear_polyketide_precursor_ion_oh_oh].massdifference; + case ketide_precursor_h2o2: + mass = parameters->fragmentdefinitions[linear_oligoketide_precursor_ion_oh_oh].massdifference; break; default: mass = 0; @@ -773,8 +774,8 @@ double cCandidate::getPrecursorMass(cBricksDatabase& brickdatabasewithcombinatio } mass += parameters->searchedmodifications[startmodifID].massdifference + parameters->searchedmodifications[endmodifID].massdifference; break; - case cyclicpolyketide: - mass = parameters->fragmentdefinitions[cyclic_polyketide_precursor_ion].massdifference; + case cyclicoligoketide: + mass = parameters->fragmentdefinitions[cyclic_oligoketide_precursor_ion].massdifference; break; #endif case other: @@ -1021,17 +1022,17 @@ cSummaryFormula cCandidate::getSummaryFormula(cParameters& parameters, ePeptideT case branchcyclic: formula.addFormula(parameters.searchedmodifications[middlemodifID].summary); break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - switch (getResidueLossType(parameters.bricksdatabase)) +#if OLIGOKETIDES == 1 + case linearoligoketide: + switch (getKetidePrecursorType(parameters.bricksdatabase)) { - case water: + case ketide_precursor_h2o: summary = "H2O"; break; - case h2: + case ketide_precursor_h2: summary = "H2"; break; - case h2o2: + case ketide_precursor_h2o2: summary = "H2O2"; break; default: @@ -1046,7 +1047,7 @@ cSummaryFormula cCandidate::getSummaryFormula(cParameters& parameters, ePeptideT formula.addFormula(parameters.searchedmodifications[startmodifID].summary); formula.addFormula(parameters.searchedmodifications[endmodifID].summary); break; - case cyclicpolyketide: + case cyclicoligoketide: break; #endif case other: @@ -1255,9 +1256,9 @@ void cCandidate::setRealPeptideName(cBricksDatabase& bricksdatabase, ePeptideTyp { case linear: case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: + case cyclicoligoketide: #endif case linearpolysaccharide: realpeptidename = bricksdatabase.getRealName(internalcomposition); @@ -1279,9 +1280,9 @@ void cCandidate::setAcronymPeptideNameWithHTMLReferences(cBricksDatabase& bricks { case linear: case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: + case cyclicoligoketide: #endif case linearpolysaccharide: acronympeptidename = bricksdatabase.getAcronymName(internalcomposition, true); @@ -1308,39 +1309,56 @@ string& cCandidate::getAcronymPeptideNameWithHTMLReferences() { } -eResidueLossType cCandidate::getResidueLossType(cBricksDatabase& bricksdatabase) { +eKetidePrecursorType cCandidate::getKetidePrecursorType(cBricksDatabase& bricksdatabase) { cBrick b; b.setComposition(internalcomposition, false); vector intcomposition; b.explodeToIntComposition(intcomposition); - int hydrogens = 0; - int hydroxyls = 0; + /* + if (intcomposition.size() == 0) { + return ketide_precursor_h2o; + } + + if ((bricksdatabase[intcomposition[0] - 1].getResidueLossType() == h2_loss) && (bricksdatabase[intcomposition.back() - 1].getResidueLossType() == h2_loss)) { + return ketide_precursor_h2; + } + + if ((bricksdatabase[intcomposition[0] - 1].getResidueLossType() == h2o_loss) && (bricksdatabase[intcomposition.back() - 1].getResidueLossType() == h2o_loss)) { + return ketide_precursor_h2o2; + } + + return ketide_precursor_h2o; + */ + + int h2_blocks = 0; + int h2o_blocks = 0; for (int i = 0; i < (int)intcomposition.size(); i++) { - if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2) { - hydrogens++; + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2_loss) { + h2_blocks++; } - if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o2) { - hydroxyls++; + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o_loss) { + h2o_blocks++; } } - if (hydrogens == hydroxyls) { - return water; + if (h2_blocks == h2o_blocks) { + return ketide_precursor_h2o; } - if (hydrogens > hydroxyls) { - return h2; + if (h2_blocks > h2o_blocks) { + return ketide_precursor_h2; } - return h2o2; + return ketide_precursor_h2o2; } -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 -bool cCandidate::checkPolyketideSequence(cBricksDatabase& bricksdatabase, ePeptideType peptidetype) { +bool cCandidate::checkKetideSequence(cBricksDatabase& bricksdatabase, ePeptideType peptidetype) { + cBrick b; b.setComposition(internalcomposition, false); vector intcomposition; @@ -1350,17 +1368,31 @@ bool cCandidate::checkPolyketideSequence(cBricksDatabase& bricksdatabase, ePepti return false; } + /* + // all blocks are water loss + int h2o_blocks = 0; + for (int i = 0; i < (int)intcomposition.size(); i++) { + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o_loss) { + h2o_blocks++; + } + } + if (h2o_blocks == (int)intcomposition.size()) { + return true; + } + */ + bool hasfirstblockartificial = hasFirstBrickArtificial(bricksdatabase); bool haslastblockartificial = hasLastBrickArtificial(bricksdatabase); - // cyclic polyketide has always an even number of blocks - if ((peptidetype == cyclicpolyketide) && !hasfirstblockartificial && !haslastblockartificial && ((int)intcomposition.size() % 2 == 1)) { + // cyclic oligoketide has always an even number of blocks + if ((peptidetype == cyclicoligoketide) && !hasfirstblockartificial && !haslastblockartificial && ((int)intcomposition.size() % 2 == 1)) { return false; } + // even blocks are water loss and odd blocks are h2 loss, or vice versa for (int i = (hasfirstblockartificial?2:1); i < (haslastblockartificial?(int)intcomposition.size()-1:(int)intcomposition.size()); i++) { - if (!(((bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2) && (bricksdatabase[intcomposition[i - 1] - 1].getResidueLossType() == h2o2)) - || ((bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o2) && (bricksdatabase[intcomposition[i - 1] - 1].getResidueLossType() == h2)))) { + if (!(((bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2_loss) && (bricksdatabase[intcomposition[i - 1] - 1].getResidueLossType() == h2o_loss)) + || ((bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o_loss) && (bricksdatabase[intcomposition[i - 1] - 1].getResidueLossType() == h2_loss)))) { return false; } } @@ -1376,7 +1408,7 @@ eResidueLossType cCandidate::getLeftResidueType(cBricksDatabase& bricksdatabase) b.explodeToIntComposition(intcomposition); if (intcomposition.size() == 0) { - return water; + return h2o_loss; } return bricksdatabase[intcomposition[0] - 1].getResidueLossType(); @@ -1390,14 +1422,14 @@ eResidueLossType cCandidate::getRightResidueType(cBricksDatabase& bricksdatabase b.explodeToIntComposition(intcomposition); if (intcomposition.size() == 0) { - return water; + return h2o_loss; } return bricksdatabase[intcomposition.back() - 1].getResidueLossType(); } -bool cCandidate::checkPolyketideBlocks(cBricksDatabase& bricksdatabase, ePeptideType peptidetype) { +bool cCandidate::checkKetideBlocks(cBricksDatabase& bricksdatabase, ePeptideType peptidetype) { cBrick b; b.setComposition(internalcomposition, false); vector intcomposition; @@ -1410,25 +1442,31 @@ bool cCandidate::checkPolyketideBlocks(cBricksDatabase& bricksdatabase, ePeptide bool hasfirstblockartificial = hasFirstBrickArtificial(bricksdatabase); bool haslastblockartificial = hasLastBrickArtificial(bricksdatabase); - // cyclic polyketide has always an even number of blocks - if ((peptidetype == cyclicpolyketide) && !hasfirstblockartificial && !haslastblockartificial && ((int)intcomposition.size() % 2 == 1)) { + // cyclic oligoketide has always an even number of blocks + if ((peptidetype == cyclicoligoketide) && !hasfirstblockartificial && !haslastblockartificial && ((int)intcomposition.size() % 2 == 1)) { return false; } - int hydrogens = 0; - int hydroxyls = 0; + int h2_blocks = 0; + int h2o_blocks = 0; for (int i = (hasfirstblockartificial?1:0); i < (haslastblockartificial?(int)intcomposition.size()-1:(int)intcomposition.size()); i++) { - if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2) { - hydrogens++; + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2_loss) { + h2_blocks++; } - if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o2) { - hydroxyls++; + if (bricksdatabase[intcomposition[i] - 1].getResidueLossType() == h2o_loss) { + h2o_blocks++; } } - if ((hydrogens == hydroxyls) || (hydrogens == hydroxyls + 1) || (hydrogens + 1 == hydroxyls)) { + if ((h2_blocks == h2o_blocks) || (h2_blocks == h2o_blocks + 1) || (h2_blocks + 1 == h2o_blocks)) { + return true; + } + + /* + if ((h2_blocks == 0) && (h2o_blocks == (int)intcomposition.size())) { return true; } + */ return false; } diff --git a/CycloBranch/core/cCandidate.h b/CycloBranch/core/cCandidate.h index 0afa307..75c36d5 100644 --- a/CycloBranch/core/cCandidate.h +++ b/CycloBranch/core/cCandidate.h @@ -569,14 +569,14 @@ class cCandidate { /** - \brief Get the residue loss type. + \brief Get the precursor type. \param bricksdatabase a database of building blocks - \retval eResidueLossType the residue loss type + \retval eKetidePrecursorType the type of precursor ion */ - eResidueLossType getResidueLossType(cBricksDatabase& bricksdatabase); + eKetidePrecursorType getKetidePrecursorType(cBricksDatabase& bricksdatabase); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 /** \brief Check if the order of blocks is correct. @@ -584,7 +584,7 @@ class cCandidate { \param peptidetype the type of peptide \retval bool true when the order of blocks is correct; false otherwise */ - bool checkPolyketideSequence(cBricksDatabase& bricksdatabase, ePeptideType peptidetype); + bool checkKetideSequence(cBricksDatabase& bricksdatabase, ePeptideType peptidetype); /** @@ -604,12 +604,12 @@ class cCandidate { /** - \brief Check if the numbers of hydrogen and hydroxyl blocks are correct. + \brief Check if the numbers of H2 loss and H2O loss blocks are correct. \param bricksdatabase a database of building blocks \param peptidetype the type of peptide \retval bool true when the numbers of blocks are correct */ - bool checkPolyketideBlocks(cBricksDatabase& bricksdatabase, ePeptideType peptidetype); + bool checkKetideBlocks(cBricksDatabase& bricksdatabase, ePeptideType peptidetype); #endif diff --git a/CycloBranch/core/cDeNovoGraph.cpp b/CycloBranch/core/cDeNovoGraph.cpp index e06a1db..4b248c2 100644 --- a/CycloBranch/core/cDeNovoGraph.cpp +++ b/CycloBranch/core/cDeNovoGraph.cpp @@ -300,8 +300,8 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { lastsystemnode = (int)graph.size() - 1; startnode = 1; break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: node.clear(); node.setMZRatio(0); node.setIntensity(0); @@ -402,20 +402,20 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { lastsystemnode = (int)graph.size() - 1; startnode = 1; break; - case cyclicpolyketide: + case cyclicoligoketide: node.clear(); node.setMZRatio(0); node.setIntensity(0); - node.addIonAnnotation(l0h_ion); + //node.addIonAnnotation(l0h_ion); node.addIonAnnotation(l1h_ion); node.addIonAnnotation(l2h_ion); graph.push_back(node); - node.clear(); - node.setMZRatio(parameters->fragmentdefinitions[l0h_ion].massdifference + negativeshift); - node.setIntensity(0); - node.addIonAnnotation(l0h_ion); - graph.push_back(node); + //node.clear(); + //node.setMZRatio(parameters->fragmentdefinitions[l0h_ion].massdifference + negativeshift); + //node.setIntensity(0); + //node.addIonAnnotation(l0h_ion); + //graph.push_back(node); node.clear(); node.setMZRatio(parameters->fragmentdefinitions[l1h_ion].massdifference + negativeshift); @@ -581,11 +581,11 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { } else { b.clear(); - b.setMass(bricksdatabasewithcombinations.getMassOfComposition(combarray)); + b.setMass(bricksdatabasewithcombinations.getMassOfComposition(combarray, numberofbasicbricks)); b.setComposition(compositionname, true); -#if POLYKETIDE_SIDEROPHORES == 1 - if (((parameters->peptidetype == linearpolyketide) || (parameters->peptidetype == cyclicpolyketide)) && !bricksdatabasewithcombinations.checkPolyketideBlocks(b)) { +#if OLIGOKETIDES == 1 + if (((parameters->peptidetype == linearoligoketide) || (parameters->peptidetype == cyclicoligoketide)) && !bricksdatabasewithcombinations.checkKetideBlocks(b)) { continue; } #endif @@ -623,9 +623,9 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { for (int k = 0; k < (int)parameters->fragmentionsfordenovograph.size(); k++) { if (/*!graph[i].ionannotation[parameters->fragmentionsfordenovograph[k]] ||*/ (parameters->fragmentionsfordenovograph[k] == precursor_ion) -#if POLYKETIDE_SIDEROPHORES == 1 - || (parameters->fragmentionsfordenovograph[k] == linear_polyketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[k] == linear_polyketide_precursor_ion_h_oh) - || (parameters->fragmentionsfordenovograph[k] == linear_polyketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[k] == cyclic_polyketide_precursor_ion) +#if OLIGOKETIDES == 1 + || (parameters->fragmentionsfordenovograph[k] == linear_oligoketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[k] == linear_oligoketide_precursor_ion_h_oh) + || (parameters->fragmentionsfordenovograph[k] == linear_oligoketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[k] == cyclic_oligoketide_precursor_ion) #endif ) { continue; @@ -635,19 +635,19 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { // test for incompatible ion series if ( -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 ( #endif !((parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].nterminal == parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[m]].nterminal) && (parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].cterminal == parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[m]].cterminal)) -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 || - (((parameters->peptidetype == linearpolyketide) || (parameters->peptidetype == cyclicpolyketide)) && - !(((parameters->fragmentionsfordenovograph[k] == l0h_ion) && (parameters->fragmentionsfordenovograph[m] == l0h_ion)) || ((parameters->fragmentionsfordenovograph[k] == l1h_ion) && (parameters->fragmentionsfordenovograph[m] == l1h_ion)) || ((parameters->fragmentionsfordenovograph[k] == l2h_ion) && (parameters->fragmentionsfordenovograph[m] == l2h_ion)) + (((parameters->peptidetype == linearoligoketide) || (parameters->peptidetype == cyclicoligoketide)) && + !(/*((parameters->fragmentionsfordenovograph[k] == l0h_ion) && (parameters->fragmentionsfordenovograph[m] == l0h_ion)) ||*/ ((parameters->fragmentionsfordenovograph[k] == l1h_ion) && (parameters->fragmentionsfordenovograph[m] == l1h_ion)) || ((parameters->fragmentionsfordenovograph[k] == l2h_ion) && (parameters->fragmentionsfordenovograph[m] == l2h_ion)) || ((parameters->fragmentionsfordenovograph[k] == l1oh_ion) && (parameters->fragmentionsfordenovograph[m] == l1oh_ion)) || ((parameters->fragmentionsfordenovograph[k] == l2oh_ion) && (parameters->fragmentionsfordenovograph[m] == l2oh_ion)))) ) - && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_h_h) && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_h_oh) - && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_oh_oh) && (parameters->fragmentionsfordenovograph[m] != cyclic_polyketide_precursor_ion) + && (parameters->fragmentionsfordenovograph[m] != linear_oligoketide_precursor_ion_h_h) && (parameters->fragmentionsfordenovograph[m] != linear_oligoketide_precursor_ion_h_oh) + && (parameters->fragmentionsfordenovograph[m] != linear_oligoketide_precursor_ion_oh_oh) && (parameters->fragmentionsfordenovograph[m] != cyclic_oligoketide_precursor_ion) #endif && (parameters->fragmentionsfordenovograph[m] != precursor_ion) ) { @@ -658,9 +658,9 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { for (int n = 0; n < (int)parameters->searchedmodifications.size(); n++) { if ((n > 0) && (parameters->fragmentionsfordenovograph[m] != precursor_ion) -#if POLYKETIDE_SIDEROPHORES == 1 - && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_h_h) && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_h_oh) - && (parameters->fragmentionsfordenovograph[m] != linear_polyketide_precursor_ion_oh_oh) && (parameters->fragmentionsfordenovograph[m] != cyclic_polyketide_precursor_ion) +#if OLIGOKETIDES == 1 + && (parameters->fragmentionsfordenovograph[m] != linear_oligoketide_precursor_ion_h_h) && (parameters->fragmentionsfordenovograph[m] != linear_oligoketide_precursor_ion_h_oh) + && (parameters->fragmentionsfordenovograph[m] != linear_oligoketide_precursor_ion_oh_oh) && (parameters->fragmentionsfordenovograph[m] != cyclic_oligoketide_precursor_ion) #endif ) { continue; @@ -670,8 +670,8 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { for (int p = 0; p < (int)parameters->searchedmodifications.size(); p++) { if ((p > 0) && ((parameters->peptidetype == linear) || (parameters->peptidetype == cyclic) || (parameters->peptidetype == linearpolysaccharide) -#if POLYKETIDE_SIDEROPHORES == 1 - || (parameters->peptidetype == linearpolyketide) || (parameters->peptidetype == cyclicpolyketide) +#if OLIGOKETIDES == 1 + || (parameters->peptidetype == linearoligoketide) || (parameters->peptidetype == cyclicoligoketide) #endif )) { continue; @@ -679,17 +679,17 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { termmass = 0; -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 if ((parameters->fragmentionsfordenovograph[m] == precursor_ion) - || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_h_oh) - || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[m] == cyclic_polyketide_precursor_ion)) { + || (parameters->fragmentionsfordenovograph[m] == linear_oligoketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[m] == linear_oligoketide_precursor_ion_h_oh) + || (parameters->fragmentionsfordenovograph[m] == linear_oligoketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[m] == cyclic_oligoketide_precursor_ion)) { #else if (parameters->fragmentionsfordenovograph[m] == precursor_ion) { #endif if ((parameters->peptidetype == linear) || (parameters->peptidetype == linearpolysaccharide) -#if POLYKETIDE_SIDEROPHORES == 1 - || (parameters->peptidetype == linearpolyketide) +#if OLIGOKETIDES == 1 + || (parameters->peptidetype == linearoligoketide) #endif ) { if ((n > 0) && ((parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].nterminal && parameters->searchedmodifications[n].nterminal) || (parameters->fragmentdefinitions[parameters->fragmentionsfordenovograph[k]].cterminal && parameters->searchedmodifications[n].cterminal))) { @@ -766,10 +766,10 @@ int cDeNovoGraph::createGraph(bool& terminatecomputation) { } // irrelevant connection with precursor -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 if (((parameters->fragmentionsfordenovograph[m] == precursor_ion) - || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_h_oh) - || (parameters->fragmentionsfordenovograph[m] == linear_polyketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[m] == cyclic_polyketide_precursor_ion)) + || (parameters->fragmentionsfordenovograph[m] == linear_oligoketide_precursor_ion_h_h) || (parameters->fragmentionsfordenovograph[m] == linear_oligoketide_precursor_ion_h_oh) + || (parameters->fragmentionsfordenovograph[m] == linear_oligoketide_precursor_ion_oh_oh) || (parameters->fragmentionsfordenovograph[m] == cyclic_oligoketide_precursor_ion)) && (middle != (int)graph.size() - 1) && (i != (int)graph.size() - 1)) { #else if ((parameters->fragmentionsfordenovograph[m] == precursor_ion) && (middle != (int)graph.size() - 1) && (i != (int)graph.size() - 1)) { @@ -1016,7 +1016,7 @@ int cDeNovoGraph::connectEdgesFormingPathsNotFinishingInPrecursor(bool& terminat b.setArtificial(true); bricksdatabasewithcombinations.push_back(b); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 // -H2 brick (3) b.setName(to_string(e.massdifference - 2*H)); diff --git a/CycloBranch/core/cFragmentIons.cpp b/CycloBranch/core/cFragmentIons.cpp index dc09253..6cf0034 100644 --- a/CycloBranch/core/cFragmentIons.cpp +++ b/CycloBranch/core/cFragmentIons.cpp @@ -949,7 +949,7 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[ms_MGa4H].multiplier = 1; fragmentions[ms_MGa4H].numberofisotopes = 1; -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 // initialize l0h ion fragmentions[l0h_ion].nterminal = true; @@ -982,28 +982,28 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi // initialize l0h-CO ion fragmentions[l0h_ion_co_loss].nterminal = true; fragmentions[l0h_ion_co_loss].cterminal = false; - fragmentions[l0h_ion_co_loss].name = "LA-2H"; + fragmentions[l0h_ion_co_loss].name = "LB-2H-CO"; fragmentions[l0h_ion_co_loss].massdifference = L0H_ION - CO + adductshift; fragmentions[l0h_ion_co_loss].parent = l0h_ion; // initialize l0h-CO-H2O ion fragmentions[l0h_ion_co_loss_dehydrated].nterminal = true; fragmentions[l0h_ion_co_loss_dehydrated].cterminal = false; - fragmentions[l0h_ion_co_loss_dehydrated].name = "LA*-2H"; + fragmentions[l0h_ion_co_loss_dehydrated].name = "LB*-2H-CO"; fragmentions[l0h_ion_co_loss_dehydrated].massdifference = L0H_ION - CO - H2O + adductshift; fragmentions[l0h_ion_co_loss_dehydrated].parent = l0h_ion; // initialize l0h-CO-NH3 ion fragmentions[l0h_ion_co_loss_deamidated].nterminal = true; fragmentions[l0h_ion_co_loss_deamidated].cterminal = false; - fragmentions[l0h_ion_co_loss_deamidated].name = "LAx-2H"; + fragmentions[l0h_ion_co_loss_deamidated].name = "LBx-2H-CO"; fragmentions[l0h_ion_co_loss_deamidated].massdifference = L0H_ION - CO - NH3 + adductshift; fragmentions[l0h_ion_co_loss_deamidated].parent = l0h_ion; // initialize l0h-CO-H2O-NH3 ion fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].name = "LA*x-2H"; + fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].name = "LB*x-2H-CO"; fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].massdifference = L0H_ION - CO - H2O - NH3 + adductshift; fragmentions[l0h_ion_co_loss_dehydrated_and_deamidated].parent = l0h_ion; @@ -1038,28 +1038,28 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi // initialize l1h-CO ion fragmentions[l1h_ion_co_loss].nterminal = true; fragmentions[l1h_ion_co_loss].cterminal = false; - fragmentions[l1h_ion_co_loss].name = "LA"; + fragmentions[l1h_ion_co_loss].name = "LB-CO"; fragmentions[l1h_ion_co_loss].massdifference = L1H_ION - CO + adductshift; fragmentions[l1h_ion_co_loss].parent = l1h_ion; // initialize l1h-CO-H2O ion fragmentions[l1h_ion_co_loss_dehydrated].nterminal = true; fragmentions[l1h_ion_co_loss_dehydrated].cterminal = false; - fragmentions[l1h_ion_co_loss_dehydrated].name = "LA*"; + fragmentions[l1h_ion_co_loss_dehydrated].name = "LB*-CO"; fragmentions[l1h_ion_co_loss_dehydrated].massdifference = L1H_ION - CO - H2O + adductshift; fragmentions[l1h_ion_co_loss_dehydrated].parent = l1h_ion; // initialize l1h-CO-NH3 ion fragmentions[l1h_ion_co_loss_deamidated].nterminal = true; fragmentions[l1h_ion_co_loss_deamidated].cterminal = false; - fragmentions[l1h_ion_co_loss_deamidated].name = "LAx"; + fragmentions[l1h_ion_co_loss_deamidated].name = "LBx-CO"; fragmentions[l1h_ion_co_loss_deamidated].massdifference = L1H_ION - CO - NH3 + adductshift; fragmentions[l1h_ion_co_loss_deamidated].parent = l1h_ion; // initialize l1h-CO-H2O-NH3 ion fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].name = "LA*x"; + fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].name = "LB*x-CO"; fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].massdifference = L1H_ION - CO - H2O - NH3 + adductshift; fragmentions[l1h_ion_co_loss_dehydrated_and_deamidated].parent = l1h_ion; @@ -1094,28 +1094,28 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi // initialize l2h-CO ion fragmentions[l2h_ion_co_loss].nterminal = true; fragmentions[l2h_ion_co_loss].cterminal = false; - fragmentions[l2h_ion_co_loss].name = "LA+2H"; + fragmentions[l2h_ion_co_loss].name = "LB+2H-CO"; fragmentions[l2h_ion_co_loss].massdifference = L2H_ION - CO + adductshift; fragmentions[l2h_ion_co_loss].parent = l2h_ion; // initialize l2h-CO-H2O ion fragmentions[l2h_ion_co_loss_dehydrated].nterminal = true; fragmentions[l2h_ion_co_loss_dehydrated].cterminal = false; - fragmentions[l2h_ion_co_loss_dehydrated].name = "LA*+2H"; + fragmentions[l2h_ion_co_loss_dehydrated].name = "LB*+2H-CO"; fragmentions[l2h_ion_co_loss_dehydrated].massdifference = L2H_ION - CO - H2O + adductshift; fragmentions[l2h_ion_co_loss_dehydrated].parent = l2h_ion; // initialize l2h-CO-NH3 ion fragmentions[l2h_ion_co_loss_deamidated].nterminal = true; fragmentions[l2h_ion_co_loss_deamidated].cterminal = false; - fragmentions[l2h_ion_co_loss_deamidated].name = "LAx+2H"; + fragmentions[l2h_ion_co_loss_deamidated].name = "LBx+2H-CO"; fragmentions[l2h_ion_co_loss_deamidated].massdifference = L2H_ION - CO - NH3 + adductshift; fragmentions[l2h_ion_co_loss_deamidated].parent = l2h_ion; // initialize l2h-CO-H2O-NH3 ion fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].name = "LA*x+2H"; + fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].name = "LB*x+2H-CO"; fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].massdifference = L2H_ION - CO - H2O - NH3 + adductshift; fragmentions[l2h_ion_co_loss_dehydrated_and_deamidated].parent = l2h_ion; @@ -1150,28 +1150,28 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi // initialize r1h-CO ion fragmentions[r1h_ion_co_loss].nterminal = true; fragmentions[r1h_ion_co_loss].cterminal = false; - fragmentions[r1h_ion_co_loss].name = "RA"; + fragmentions[r1h_ion_co_loss].name = "RB-CO"; fragmentions[r1h_ion_co_loss].massdifference = R1H_ION - CO + adductshift; fragmentions[r1h_ion_co_loss].parent = r1h_ion; // initialize r1h-CO-H2O ion fragmentions[r1h_ion_co_loss_dehydrated].nterminal = true; fragmentions[r1h_ion_co_loss_dehydrated].cterminal = false; - fragmentions[r1h_ion_co_loss_dehydrated].name = "RA*"; + fragmentions[r1h_ion_co_loss_dehydrated].name = "RB*-CO"; fragmentions[r1h_ion_co_loss_dehydrated].massdifference = R1H_ION - CO - H2O + adductshift; fragmentions[r1h_ion_co_loss_dehydrated].parent = r1h_ion; // initialize r1h-CO-NH3 ion fragmentions[r1h_ion_co_loss_deamidated].nterminal = true; fragmentions[r1h_ion_co_loss_deamidated].cterminal = false; - fragmentions[r1h_ion_co_loss_deamidated].name = "RAx"; + fragmentions[r1h_ion_co_loss_deamidated].name = "RBx-CO"; fragmentions[r1h_ion_co_loss_deamidated].massdifference = R1H_ION - CO - NH3 + adductshift; fragmentions[r1h_ion_co_loss_deamidated].parent = r1h_ion; // initialize r1h-CO-H2O-NH3 ion fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].name = "RA*x"; + fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].name = "RB*x-CO"; fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].massdifference = R1H_ION - CO - H2O - NH3 + adductshift; fragmentions[r1h_ion_co_loss_dehydrated_and_deamidated].parent = r1h_ion; @@ -1206,28 +1206,28 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi // initialize r2h-CO ion fragmentions[r2h_ion_co_loss].nterminal = true; fragmentions[r2h_ion_co_loss].cterminal = false; - fragmentions[r2h_ion_co_loss].name = "RA+2H"; + fragmentions[r2h_ion_co_loss].name = "RB+2H-CO"; fragmentions[r2h_ion_co_loss].massdifference = R2H_ION - CO + adductshift; fragmentions[r2h_ion_co_loss].parent = r2h_ion; // initialize r2h-CO-H2O ion fragmentions[r2h_ion_co_loss_dehydrated].nterminal = true; fragmentions[r2h_ion_co_loss_dehydrated].cterminal = false; - fragmentions[r2h_ion_co_loss_dehydrated].name = "RA*+2H"; + fragmentions[r2h_ion_co_loss_dehydrated].name = "RB*+2H-CO"; fragmentions[r2h_ion_co_loss_dehydrated].massdifference = R2H_ION - CO - H2O + adductshift; fragmentions[r2h_ion_co_loss_dehydrated].parent = r2h_ion; // initialize r2h-CO-NH3 ion fragmentions[r2h_ion_co_loss_deamidated].nterminal = true; fragmentions[r2h_ion_co_loss_deamidated].cterminal = false; - fragmentions[r2h_ion_co_loss_deamidated].name = "RAx+2H"; + fragmentions[r2h_ion_co_loss_deamidated].name = "RBx+2H-CO"; fragmentions[r2h_ion_co_loss_deamidated].massdifference = R2H_ION - CO - NH3 + adductshift; fragmentions[r2h_ion_co_loss_deamidated].parent = r2h_ion; // initialize r2h-CO-H2O-NH3 ion fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].nterminal = true; fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].name = "RA*x+2H"; + fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].name = "RB*x+2H-CO"; fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].massdifference = R2H_ION - CO - H2O - NH3 + adductshift; fragmentions[r2h_ion_co_loss_dehydrated_and_deamidated].parent = r2h_ion; @@ -1455,229 +1455,229 @@ void cFragmentIons::recalculateFragments(bool cyclicnterminus, bool cyclicctermi fragmentions[r2oh_ion_co_loss_dehydrated_and_deamidated].massdifference = R2OH_ION - CO - H2O - NH3 + adductshift; fragmentions[r2oh_ion_co_loss_dehydrated_and_deamidated].parent = r2oh_ion; - // initialize linear polyketide siderophore precursor ion (H-...-H) - fragmentions[linear_polyketide_precursor_ion_h_h].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h].name = "[M+zH]+ (H-...-H)"; - fragmentions[linear_polyketide_precursor_ion_h_h].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_h].parent = linear_polyketide_precursor_ion_h_h; - - // initialize linear polyketide siderophore precursor ion (H-...-H) - H2O - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].name = "[M+zH]+ * (H-...-H)"; - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - H2O + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated].parent = linear_polyketide_precursor_ion_h_h; - - // initialize linear polyketide siderophore precursor ion (H-...-H) - NH3 - fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].name = "[M+zH]+ x (H-...-H)"; - fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_h_deamidated].parent = linear_polyketide_precursor_ion_h_h; - - // initialize linear polyketide siderophore precursor ion (H-...-H) - H2O - NH3 - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].name = "[M+zH]+ *x (H-...-H)"; - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - H2O - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_h_h; - - // initialize linear polyketide siderophore precursor ion (H-...-H) - CO - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].name = "[M+zH]+ -CO (H-...-H)"; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - CO + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss].parent = linear_polyketide_precursor_ion_h_h_co_loss; - - // initialize linear polyketide siderophore precursor ion (H-...-H) - CO - H2O - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].name = "[M+zH]+ *-CO (H-...-H)"; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - CO - H2O + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated].parent = linear_polyketide_precursor_ion_h_h_co_loss; - - // initialize linear polyketide siderophore precursor ion (H-...-H) - CO - NH3 - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].name = "[M+zH]+ x-CO (H-...-H)"; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - CO - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_deamidated].parent = linear_polyketide_precursor_ion_h_h_co_loss; - - // initialize linear polyketide siderophore precursor ion (H-...-H) - CO - H2O - NH3 - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (H-...-H)"; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_H - CO - H2O - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_h_h_co_loss; - - // initialize linear polyketide siderophore precursor ion (H-...-OH) - fragmentions[linear_polyketide_precursor_ion_h_oh].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh].name = "[M+zH]+ (H-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_h_oh].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_oh].parent = linear_polyketide_precursor_ion_h_oh; - - // initialize linear polyketide siderophore precursor ion (H-...-OH) - H2O - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].name = "[M+zH]+ * (H-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - H2O + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated].parent = linear_polyketide_precursor_ion_h_oh; - - // initialize linear polyketide siderophore precursor ion (H-...-OH) - NH3 - fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].name = "[M+zH]+ x (H-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_oh_deamidated].parent = linear_polyketide_precursor_ion_h_oh; - - // initialize linear polyketide siderophore precursor ion (H-...-OH) - H2O - NH3 - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].name = "[M+zH]+ *x (H-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - H2O - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_h_oh; - - // initialize linear polyketide siderophore precursor ion (H-...-OH) - CO - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].name = "[M+zH]+ -CO (H-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - CO + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss].parent = linear_polyketide_precursor_ion_h_oh_co_loss; - - // initialize linear polyketide siderophore precursor ion (H-...-OH) - CO - H2O - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].name = "[M+zH]+ *-CO (H-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - CO - H2O + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated].parent = linear_polyketide_precursor_ion_h_oh_co_loss; - - // initialize linear polyketide siderophore precursor ion (H-...-OH) - CO - NH3 - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].name = "[M+zH]+ x-CO (H-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - CO - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_deamidated].parent = linear_polyketide_precursor_ion_h_oh_co_loss; - - // initialize linear polyketide siderophore precursor ion (H-...-OH) - CO - H2O - NH3 - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (H-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH - CO - H2O - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_h_oh_co_loss; - - // initialize linear polyketide siderophore precursor ion (HO-...-OH) - fragmentions[linear_polyketide_precursor_ion_oh_oh].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh].name = "[M+zH]+ (HO-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_oh_oh].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH + adductshift; - fragmentions[linear_polyketide_precursor_ion_oh_oh].parent = linear_polyketide_precursor_ion_oh_oh; - - // initialize linear polyketide siderophore precursor ion (HO-...-OH) - H2O - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].name = "[M+zH]+ * (HO-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - H2O + adductshift; - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated].parent = linear_polyketide_precursor_ion_oh_oh; - - // initialize linear polyketide siderophore precursor ion (HO-...-OH) - NH3 - fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].name = "[M+zH]+ x (HO-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_oh_oh_deamidated].parent = linear_polyketide_precursor_ion_oh_oh; - - // initialize linear polyketide siderophore precursor ion (HO-...-OH) - H2O - NH3 - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].name = "[M+zH]+ *x (HO-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - H2O - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_oh_oh; - - // initialize linear polyketide siderophore precursor ion (HO-...-OH) - CO - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].name = "[M+zH]+ -CO (HO-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - CO + adductshift; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss].parent = linear_polyketide_precursor_ion_oh_oh_co_loss; - - // initialize linear polyketide siderophore precursor ion (HO-...-OH) - CO - H2O - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].name = "[M+zH]+ *-CO (HO-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - CO - H2O + adductshift; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated].parent = linear_polyketide_precursor_ion_oh_oh_co_loss; - - // initialize linear polyketide siderophore precursor ion (HO-...-OH) - CO - NH3 - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].name = "[M+zH]+ x-CO (HO-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - CO - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated].parent = linear_polyketide_precursor_ion_oh_oh_co_loss; - - // initialize linear polyketide siderophore precursor ion (HO-...-OH) - CO - H2O - NH3 - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].nterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (HO-...-OH)"; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH - CO - H2O - NH3 + adductshift; - fragmentions[linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].parent = linear_polyketide_precursor_ion_oh_oh_co_loss; - - // initialize cyclic polyketide siderophore precursor ion - fragmentions[cyclic_polyketide_precursor_ion].nterminal = false; - fragmentions[cyclic_polyketide_precursor_ion].cterminal = false; - fragmentions[cyclic_polyketide_precursor_ion].name = "[M+zH]+"; - fragmentions[cyclic_polyketide_precursor_ion].massdifference = Hplus + adductshift; - fragmentions[cyclic_polyketide_precursor_ion].parent = cyclic_polyketide_precursor_ion; - - // initialize cyclic polyketide siderophore precursor ion - H2O - fragmentions[cyclic_polyketide_precursor_ion_dehydrated].nterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_dehydrated].cterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_dehydrated].name = "[M+zH]+ *"; - fragmentions[cyclic_polyketide_precursor_ion_dehydrated].massdifference = Hplus - H2O + adductshift; - fragmentions[cyclic_polyketide_precursor_ion_dehydrated].parent = cyclic_polyketide_precursor_ion; - - // initialize cyclic polyketide siderophore precursor ion - NH3 - fragmentions[cyclic_polyketide_precursor_ion_deamidated].nterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_deamidated].cterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_deamidated].name = "[M+zH]+ x"; - fragmentions[cyclic_polyketide_precursor_ion_deamidated].massdifference = Hplus - NH3 + adductshift; - fragmentions[cyclic_polyketide_precursor_ion_deamidated].parent = cyclic_polyketide_precursor_ion; - - // initialize cyclic polyketide siderophore precursor ion - H2O - NH3 - fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].nterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].cterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].name = "[M+zH]+ *x"; - fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].massdifference = Hplus - H2O - NH3 + adductshift; - fragmentions[cyclic_polyketide_precursor_ion_dehydrated_and_deamidated].parent = cyclic_polyketide_precursor_ion; - - // initialize cyclic polyketide siderophore precursor ion - CO - fragmentions[cyclic_polyketide_precursor_ion_co_loss].nterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_co_loss].cterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_co_loss].name = "[M+zH]+ -CO"; - fragmentions[cyclic_polyketide_precursor_ion_co_loss].massdifference = Hplus - CO + adductshift; - fragmentions[cyclic_polyketide_precursor_ion_co_loss].parent = cyclic_polyketide_precursor_ion_co_loss; - - // initialize cyclic polyketide siderophore precursor ion - CO - H2O - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].nterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].cterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].name = "[M+zH]+ *-CO"; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].massdifference = Hplus - CO - H2O + adductshift; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated].parent = cyclic_polyketide_precursor_ion_co_loss; - - // initialize cyclic polyketide siderophore precursor ion - CO - NH3 - fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].nterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].cterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].name = "[M+zH]+ x-CO"; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].massdifference = Hplus - CO - NH3 + adductshift; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_deamidated].parent = cyclic_polyketide_precursor_ion_co_loss; - - // initialize cyclic polyketide siderophore precursor ion - CO - H2O - NH3 - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].nterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].cterminal = false; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO"; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].massdifference = Hplus - CO - H2O - NH3 + adductshift; - fragmentions[cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated].parent = cyclic_polyketide_precursor_ion_co_loss; + // initialize linear oligoketide precursor ion (H-...-H) + fragmentions[linear_oligoketide_precursor_ion_h_h].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h].name = "[M+zH]+ (H-...-H)"; + fragmentions[linear_oligoketide_precursor_ion_h_h].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_h].parent = linear_oligoketide_precursor_ion_h_h; + + // initialize linear oligoketide precursor ion (H-...-H) - H2O + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated].name = "[M+zH]+ * (H-...-H)"; + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H - H2O + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated].parent = linear_oligoketide_precursor_ion_h_h; + + // initialize linear oligoketide precursor ion (H-...-H) - NH3 + fragmentions[linear_oligoketide_precursor_ion_h_h_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_deamidated].name = "[M+zH]+ x (H-...-H)"; + fragmentions[linear_oligoketide_precursor_ion_h_h_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_h_deamidated].parent = linear_oligoketide_precursor_ion_h_h; + + // initialize linear oligoketide precursor ion (H-...-H) - H2O - NH3 + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated_and_deamidated].name = "[M+zH]+ *x (H-...-H)"; + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H - H2O - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_h_dehydrated_and_deamidated].parent = linear_oligoketide_precursor_ion_h_h; + + // initialize linear oligoketide precursor ion (H-...-H) - CO + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss].name = "[M+zH]+ -CO (H-...-H)"; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H - CO + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss].parent = linear_oligoketide_precursor_ion_h_h_co_loss; + + // initialize linear oligoketide precursor ion (H-...-H) - CO - H2O + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated].name = "[M+zH]+ *-CO (H-...-H)"; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H - CO - H2O + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated].parent = linear_oligoketide_precursor_ion_h_h_co_loss; + + // initialize linear oligoketide precursor ion (H-...-H) - CO - NH3 + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_deamidated].name = "[M+zH]+ x-CO (H-...-H)"; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H - CO - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_deamidated].parent = linear_oligoketide_precursor_ion_h_h_co_loss; + + // initialize linear oligoketide precursor ion (H-...-H) - CO - H2O - NH3 + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (H-...-H)"; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H - CO - H2O - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated].parent = linear_oligoketide_precursor_ion_h_h_co_loss; + + // initialize linear oligoketide precursor ion (H-...-OH) + fragmentions[linear_oligoketide_precursor_ion_h_oh].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh].name = "[M+zH]+ (H-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_h_oh].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_oh].parent = linear_oligoketide_precursor_ion_h_oh; + + // initialize linear oligoketide precursor ion (H-...-OH) - H2O + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated].name = "[M+zH]+ * (H-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH - H2O + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated].parent = linear_oligoketide_precursor_ion_h_oh; + + // initialize linear oligoketide precursor ion (H-...-OH) - NH3 + fragmentions[linear_oligoketide_precursor_ion_h_oh_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_deamidated].name = "[M+zH]+ x (H-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_h_oh_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_oh_deamidated].parent = linear_oligoketide_precursor_ion_h_oh; + + // initialize linear oligoketide precursor ion (H-...-OH) - H2O - NH3 + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated_and_deamidated].name = "[M+zH]+ *x (H-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH - H2O - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_oh_dehydrated_and_deamidated].parent = linear_oligoketide_precursor_ion_h_oh; + + // initialize linear oligoketide precursor ion (H-...-OH) - CO + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss].name = "[M+zH]+ -CO (H-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH - CO + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss].parent = linear_oligoketide_precursor_ion_h_oh_co_loss; + + // initialize linear oligoketide precursor ion (H-...-OH) - CO - H2O + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated].name = "[M+zH]+ *-CO (H-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH - CO - H2O + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated].parent = linear_oligoketide_precursor_ion_h_oh_co_loss; + + // initialize linear oligoketide precursor ion (H-...-OH) - CO - NH3 + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_deamidated].name = "[M+zH]+ x-CO (H-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH - CO - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_deamidated].parent = linear_oligoketide_precursor_ion_h_oh_co_loss; + + // initialize linear oligoketide precursor ion (H-...-OH) - CO - H2O - NH3 + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (H-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH - CO - H2O - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated].parent = linear_oligoketide_precursor_ion_h_oh_co_loss; + + // initialize linear oligoketide precursor ion (HO-...-OH) + fragmentions[linear_oligoketide_precursor_ion_oh_oh].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh].name = "[M+zH]+ (HO-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_oh_oh].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH + adductshift; + fragmentions[linear_oligoketide_precursor_ion_oh_oh].parent = linear_oligoketide_precursor_ion_oh_oh; + + // initialize linear oligoketide precursor ion (HO-...-OH) - H2O + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated].name = "[M+zH]+ * (HO-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH - H2O + adductshift; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated].parent = linear_oligoketide_precursor_ion_oh_oh; + + // initialize linear oligoketide precursor ion (HO-...-OH) - NH3 + fragmentions[linear_oligoketide_precursor_ion_oh_oh_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_deamidated].name = "[M+zH]+ x (HO-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_deamidated].parent = linear_oligoketide_precursor_ion_oh_oh; + + // initialize linear oligoketide precursor ion (HO-...-OH) - H2O - NH3 + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated_and_deamidated].name = "[M+zH]+ *x (HO-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH - H2O - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_dehydrated_and_deamidated].parent = linear_oligoketide_precursor_ion_oh_oh; + + // initialize linear oligoketide precursor ion (HO-...-OH) - CO + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss].name = "[M+zH]+ -CO (HO-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH - CO + adductshift; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss].parent = linear_oligoketide_precursor_ion_oh_oh_co_loss; + + // initialize linear oligoketide precursor ion (HO-...-OH) - CO - H2O + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated].name = "[M+zH]+ *-CO (HO-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH - CO - H2O + adductshift; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated].parent = linear_oligoketide_precursor_ion_oh_oh_co_loss; + + // initialize linear oligoketide precursor ion (HO-...-OH) - CO - NH3 + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_deamidated].name = "[M+zH]+ x-CO (HO-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH - CO - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_deamidated].parent = linear_oligoketide_precursor_ion_oh_oh_co_loss; + + // initialize linear oligoketide precursor ion (HO-...-OH) - CO - H2O - NH3 + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO (HO-...-OH)"; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].massdifference = PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH - CO - H2O - NH3 + adductshift; + fragmentions[linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated].parent = linear_oligoketide_precursor_ion_oh_oh_co_loss; + + // initialize cyclic oligoketide precursor ion + fragmentions[cyclic_oligoketide_precursor_ion].nterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion].cterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion].name = "[M+zH]+"; + fragmentions[cyclic_oligoketide_precursor_ion].massdifference = Hplus + adductshift; + fragmentions[cyclic_oligoketide_precursor_ion].parent = cyclic_oligoketide_precursor_ion; + + // initialize cyclic oligoketide precursor ion - H2O + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated].nterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated].cterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated].name = "[M+zH]+ *"; + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated].massdifference = Hplus - H2O + adductshift; + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated].parent = cyclic_oligoketide_precursor_ion; + + // initialize cyclic oligoketide precursor ion - NH3 + fragmentions[cyclic_oligoketide_precursor_ion_deamidated].nterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_deamidated].cterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_deamidated].name = "[M+zH]+ x"; + fragmentions[cyclic_oligoketide_precursor_ion_deamidated].massdifference = Hplus - NH3 + adductshift; + fragmentions[cyclic_oligoketide_precursor_ion_deamidated].parent = cyclic_oligoketide_precursor_ion; + + // initialize cyclic oligoketide precursor ion - H2O - NH3 + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated_and_deamidated].nterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated_and_deamidated].cterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated_and_deamidated].name = "[M+zH]+ *x"; + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated_and_deamidated].massdifference = Hplus - H2O - NH3 + adductshift; + fragmentions[cyclic_oligoketide_precursor_ion_dehydrated_and_deamidated].parent = cyclic_oligoketide_precursor_ion; + + // initialize cyclic oligoketide precursor ion - CO + fragmentions[cyclic_oligoketide_precursor_ion_co_loss].nterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss].cterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss].name = "[M+zH]+ -CO"; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss].massdifference = Hplus - CO + adductshift; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss].parent = cyclic_oligoketide_precursor_ion_co_loss; + + // initialize cyclic oligoketide precursor ion - CO - H2O + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated].nterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated].cterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated].name = "[M+zH]+ *-CO"; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated].massdifference = Hplus - CO - H2O + adductshift; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated].parent = cyclic_oligoketide_precursor_ion_co_loss; + + // initialize cyclic oligoketide precursor ion - CO - NH3 + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_deamidated].nterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_deamidated].cterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_deamidated].name = "[M+zH]+ x-CO"; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_deamidated].massdifference = Hplus - CO - NH3 + adductshift; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_deamidated].parent = cyclic_oligoketide_precursor_ion_co_loss; + + // initialize cyclic oligoketide precursor ion - CO - H2O - NH3 + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated_and_deamidated].nterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated_and_deamidated].cterminal = false; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated_and_deamidated].name = "[M+zH]+ *x-CO"; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated_and_deamidated].massdifference = Hplus - CO - H2O - NH3 + adductshift; + fragmentions[cyclic_oligoketide_precursor_ion_co_loss_dehydrated_and_deamidated].parent = cyclic_oligoketide_precursor_ion_co_loss; #endif // initialize B-2H ion @@ -1741,25 +1741,25 @@ void initializeFragmentIonsForDeNovoGraphOfBranchCyclicPeptides(vector& fragmentions) { +void initializeFragmentIonsForDeNovoGraphOfLinearOligoketide(vector& fragmentions) { fragmentions.push_back(l1h_ion); fragmentions.push_back(l2h_ion); fragmentions.push_back(l1oh_ion); fragmentions.push_back(l2oh_ion); - fragmentions.push_back(linear_polyketide_precursor_ion_h_h); - fragmentions.push_back(linear_polyketide_precursor_ion_h_oh); - fragmentions.push_back(linear_polyketide_precursor_ion_oh_oh); + fragmentions.push_back(linear_oligoketide_precursor_ion_h_h); + fragmentions.push_back(linear_oligoketide_precursor_ion_h_oh); + fragmentions.push_back(linear_oligoketide_precursor_ion_oh_oh); } -void initializeFragmentIonsForDeNovoGraphOfCyclicPolyketideSiderophore(vector& fragmentions) { - fragmentions.push_back(l0h_ion); +void initializeFragmentIonsForDeNovoGraphOfCyclicOligoketide(vector& fragmentions) { + //fragmentions.push_back(l0h_ion); fragmentions.push_back(l1h_ion); fragmentions.push_back(l2h_ion); - fragmentions.push_back(cyclic_polyketide_precursor_ion); + fragmentions.push_back(cyclic_oligoketide_precursor_ion); } diff --git a/CycloBranch/core/cFragmentIons.h b/CycloBranch/core/cFragmentIons.h index b3fb3e5..1578f4c 100644 --- a/CycloBranch/core/cFragmentIons.h +++ b/CycloBranch/core/cFragmentIons.h @@ -201,7 +201,7 @@ const double Z_ION = Hplus + O - N - H; const double PRECURSOR_ION = Hplus + H2O; const double PRECURSOR_ION_CYCLIC = Hplus; -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 const double L0H_ION = Hplus - 2 * H; const double L1H_ION = Hplus; const double L2H_ION = Hplus + 2 * H; @@ -212,9 +212,9 @@ const double PRECURSOR_ION_CYCLIC = Hplus; const double R1OH_ION = Hplus + O; const double R2OH_ION = Hplus + H2O; - const double PRECURSOR_ION_LINEAR_POLYKETIDE_H_H = Hplus + 2 * H; - const double PRECURSOR_ION_LINEAR_POLYKETIDE_H_OH = Hplus + H2O; - const double PRECURSOR_ION_LINEAR_POLYKETIDE_OH_OH = Hplus + 2 * H + 2 * O; + const double PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_H = Hplus + 2 * H; + const double PRECURSOR_ION_LINEAR_OLIGOKETIDE_H_OH = Hplus + H2O; + const double PRECURSOR_ION_LINEAR_OLIGOKETIDE_OH_OH = Hplus + 2 * H + 2 * O; #endif @@ -336,7 +336,7 @@ enum eFragmentIonType { ms_MGa2H, ms_MGa3HNa, ms_MGa4H, -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 l0h_ion, l0h_ion_dehydrated, l0h_ion_deamidated, @@ -409,38 +409,38 @@ enum eFragmentIonType { r2oh_ion_co_loss_dehydrated, r2oh_ion_co_loss_deamidated, r2oh_ion_co_loss_dehydrated_and_deamidated, - linear_polyketide_precursor_ion_h_h, - linear_polyketide_precursor_ion_h_h_dehydrated, - linear_polyketide_precursor_ion_h_h_deamidated, - linear_polyketide_precursor_ion_h_h_dehydrated_and_deamidated, - linear_polyketide_precursor_ion_h_h_co_loss, - linear_polyketide_precursor_ion_h_h_co_loss_dehydrated, - linear_polyketide_precursor_ion_h_h_co_loss_deamidated, - linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated, - linear_polyketide_precursor_ion_h_oh, - linear_polyketide_precursor_ion_h_oh_dehydrated, - linear_polyketide_precursor_ion_h_oh_deamidated, - linear_polyketide_precursor_ion_h_oh_dehydrated_and_deamidated, - linear_polyketide_precursor_ion_h_oh_co_loss, - linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated, - linear_polyketide_precursor_ion_h_oh_co_loss_deamidated, - linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated, - linear_polyketide_precursor_ion_oh_oh, - linear_polyketide_precursor_ion_oh_oh_dehydrated, - linear_polyketide_precursor_ion_oh_oh_deamidated, - linear_polyketide_precursor_ion_oh_oh_dehydrated_and_deamidated, - linear_polyketide_precursor_ion_oh_oh_co_loss, - linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated, - linear_polyketide_precursor_ion_oh_oh_co_loss_deamidated, - linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated, - cyclic_polyketide_precursor_ion, - cyclic_polyketide_precursor_ion_dehydrated, - cyclic_polyketide_precursor_ion_deamidated, - cyclic_polyketide_precursor_ion_dehydrated_and_deamidated, - cyclic_polyketide_precursor_ion_co_loss, - cyclic_polyketide_precursor_ion_co_loss_dehydrated, - cyclic_polyketide_precursor_ion_co_loss_deamidated, - cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated, + linear_oligoketide_precursor_ion_h_h, + linear_oligoketide_precursor_ion_h_h_dehydrated, + linear_oligoketide_precursor_ion_h_h_deamidated, + linear_oligoketide_precursor_ion_h_h_dehydrated_and_deamidated, + linear_oligoketide_precursor_ion_h_h_co_loss, + linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated, + linear_oligoketide_precursor_ion_h_h_co_loss_deamidated, + linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated, + linear_oligoketide_precursor_ion_h_oh, + linear_oligoketide_precursor_ion_h_oh_dehydrated, + linear_oligoketide_precursor_ion_h_oh_deamidated, + linear_oligoketide_precursor_ion_h_oh_dehydrated_and_deamidated, + linear_oligoketide_precursor_ion_h_oh_co_loss, + linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated, + linear_oligoketide_precursor_ion_h_oh_co_loss_deamidated, + linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated, + linear_oligoketide_precursor_ion_oh_oh, + linear_oligoketide_precursor_ion_oh_oh_dehydrated, + linear_oligoketide_precursor_ion_oh_oh_deamidated, + linear_oligoketide_precursor_ion_oh_oh_dehydrated_and_deamidated, + linear_oligoketide_precursor_ion_oh_oh_co_loss, + linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated, + linear_oligoketide_precursor_ion_oh_oh_co_loss_deamidated, + linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated, + cyclic_oligoketide_precursor_ion, + cyclic_oligoketide_precursor_ion_dehydrated, + cyclic_oligoketide_precursor_ion_deamidated, + cyclic_oligoketide_precursor_ion_dehydrated_and_deamidated, + cyclic_oligoketide_precursor_ion_co_loss, + cyclic_oligoketide_precursor_ion_co_loss_dehydrated, + cyclic_oligoketide_precursor_ion_co_loss_deamidated, + cyclic_oligoketide_precursor_ion_co_loss_dehydrated_and_deamidated, #endif //b_ion_2H_loss, fragmentIonTypeEnd @@ -675,21 +675,21 @@ void initializeFragmentIonsForDeNovoGraphOfTPeptides(vector& f void initializeFragmentIonsForDeNovoGraphOfBranchCyclicPeptides(vector& fragmentions); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 /** - \brief Initialize fragment ion types for the de novo graph of a linear polyketide siderophore + \brief Initialize fragment ion types for the de novo graph of a linear oligoketide \param fragmentions reference to a vector of fragment ion types */ -void initializeFragmentIonsForDeNovoGraphOfLinearPolyketideSiderophore(vector& fragmentions); +void initializeFragmentIonsForDeNovoGraphOfLinearOligoketide(vector& fragmentions); /** - \brief Initialize fragment ion types for the de novo graph of a cyclic polyketide siderophore + \brief Initialize fragment ion types for the de novo graph of a cyclic oligoketide \param fragmentions reference to a vector of fragment ion types */ -void initializeFragmentIonsForDeNovoGraphOfCyclicPolyketideSiderophore(vector& fragmentions); +void initializeFragmentIonsForDeNovoGraphOfCyclicOligoketide(vector& fragmentions); #endif diff --git a/CycloBranch/core/cImzML.cpp b/CycloBranch/core/cImzML.cpp index 80476fe..29050f2 100644 --- a/CycloBranch/core/cImzML.cpp +++ b/CycloBranch/core/cImzML.cpp @@ -1,9 +1,15 @@ #include "core/cImzML.h" +#include +#include "core/cPeaksList.h" + cImzML::cImzML() { XMLPlatformUtils::Initialize(); + profilespectra = false; + parser = new XercesDOMParser(); + document = 0; } @@ -13,16 +19,17 @@ cImzML::~cImzML() { } -void cImzML::parse(string filename) { +void cImzML::parse(string& filename) { parser->parse(filename.c_str()); - DOMDocument* document = parser->getDocument(); + document = parser->getDocument(); DOMElement* root = document->getDocumentElement(); if (!root) { return; } + profilespectra = false; // childrens of mzML for (XMLSize_t i = 0; i < root->getChildNodes()->getLength(); i++) { @@ -31,8 +38,64 @@ void cImzML::parse(string filename) { if (currentNode1->getNodeType() && currentNode1->getNodeType() == DOMNode::ELEMENT_NODE) { DOMElement* currentElement1 = dynamic_cast(currentNode1); + + + if (XMLString::equals(currentElement1->getTagName(), XMLString::transcode("referenceableParamGroupList"))) { + + + // childrens of referenceableParamGroupList + for (XMLSize_t j = 0; j < currentNode1->getChildNodes()->getLength(); j++) { + + DOMNode* currentNode2 = currentNode1->getChildNodes()->item(j); + if (currentNode2->getNodeType() && currentNode2->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement2 = dynamic_cast(currentNode2); + if (XMLString::equals(currentElement2->getTagName(), XMLString::transcode("referenceableParamGroup"))) { + + const XMLCh* xmlch_id = currentElement2->getAttribute(XMLString::transcode("id")); + string id = XMLString::transcode(xmlch_id); + + if (id.compare("spectrum") == 0) { + + + // childrens of referenceableParamGroup + for (XMLSize_t k = 0; k < currentNode2->getChildNodes()->getLength(); k++) { + + DOMNode* currentNode3 = currentNode2->getChildNodes()->item(k); + if (currentNode3->getNodeType() && currentNode3->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement3 = dynamic_cast(currentNode3); + if (XMLString::equals(currentElement3->getTagName(), XMLString::transcode("cvParam"))) { + + const XMLCh* xmlch_name = currentElement3->getAttribute(XMLString::transcode("name")); + string name = XMLString::transcode(xmlch_name); + if (name.compare("profile spectrum") == 0) { + + profilespectra = true; + + } + + } + + } + + } + + + } + + } + + } + + } + + + } + + if (XMLString::equals(currentElement1->getTagName(), XMLString::transcode("run"))) { - + // childrens of run for (XMLSize_t j = 0; j < currentNode1->getChildNodes()->getLength(); j++) { @@ -222,7 +285,282 @@ void cImzML::parse(string filename) { } +void cImzML::updateRawDataToPeakList(vector& peaklists) { + + if (!document) { + return; + } + + DOMElement* root = document->getDocumentElement(); + if (!root) { + return; + } + + unsigned long long offset = 16; + int currentid = 0; + + // childrens of mzML + for (XMLSize_t i = 0; i < root->getChildNodes()->getLength(); i++) { + + DOMNode* currentNode1 = root->getChildNodes()->item(i); + if (currentNode1->getNodeType() && currentNode1->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement1 = dynamic_cast(currentNode1); + + + if (XMLString::equals(currentElement1->getTagName(), XMLString::transcode("referenceableParamGroupList"))) { + + + // childrens of referenceableParamGroupList + for (XMLSize_t j = 0; j < currentNode1->getChildNodes()->getLength(); j++) { + + DOMNode* currentNode2 = currentNode1->getChildNodes()->item(j); + if (currentNode2->getNodeType() && currentNode2->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement2 = dynamic_cast(currentNode2); + if (XMLString::equals(currentElement2->getTagName(), XMLString::transcode("referenceableParamGroup"))) { + + const XMLCh* xmlch_id = currentElement2->getAttribute(XMLString::transcode("id")); + string id = XMLString::transcode(xmlch_id); + + if (id.compare("spectrum") == 0) { + + + // childrens of referenceableParamGroup + for (XMLSize_t k = 0; k < currentNode2->getChildNodes()->getLength(); k++) { + + DOMNode* currentNode3 = currentNode2->getChildNodes()->item(k); + if (currentNode3->getNodeType() && currentNode3->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement3 = dynamic_cast(currentNode3); + if (XMLString::equals(currentElement3->getTagName(), XMLString::transcode("cvParam"))) { + + const XMLCh* xmlch_name = currentElement3->getAttribute(XMLString::transcode("name")); + string name = XMLString::transcode(xmlch_name); + if (name.compare("profile spectrum") == 0) { + + currentElement3->setAttribute(XMLString::transcode("name"), XMLString::transcode("centroid spectrum")); + + } + + } + + } + + } + + + } + + } + + } + + } + + + } + + + if (XMLString::equals(currentElement1->getTagName(), XMLString::transcode("run"))) { + + + // childrens of run + for (XMLSize_t j = 0; j < currentNode1->getChildNodes()->getLength(); j++) { + + DOMNode* currentNode2 = currentNode1->getChildNodes()->item(j); + if (currentNode2->getNodeType() && currentNode2->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement2 = dynamic_cast(currentNode2); + if (XMLString::equals(currentElement2->getTagName(), XMLString::transcode("spectrumList"))) { + + + // childrens of spectrumList + for (XMLSize_t k = 0; k < currentNode2->getChildNodes()->getLength(); k++) { + + DOMNode* currentNode3 = currentNode2->getChildNodes()->item(k); + if (currentNode3->getNodeType() && currentNode3->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement3 = dynamic_cast(currentNode3); + if (XMLString::equals(currentElement3->getTagName(), XMLString::transcode("spectrum"))) { + + + // childrens of spectrum + for (XMLSize_t l = 0; l < currentNode3->getChildNodes()->getLength(); l++) { + + DOMNode* currentNode4 = currentNode3->getChildNodes()->item(l); + if (currentNode4->getNodeType() && currentNode4->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement4 = dynamic_cast(currentNode4); + if (XMLString::equals(currentElement4->getTagName(), XMLString::transcode("binaryDataArrayList"))) { + + + // childrens of binaryDataArrayList + for (XMLSize_t m = 0; m < currentNode4->getChildNodes()->getLength(); m++) { + + DOMNode* currentNode5 = currentNode4->getChildNodes()->item(m); + if (currentNode5->getNodeType() && currentNode5->getNodeType() == DOMNode::ELEMENT_NODE) { + + DOMElement* currentElement5 = dynamic_cast(currentNode5); + if (XMLString::equals(currentElement5->getTagName(), XMLString::transcode("binaryDataArray"))) { + + + // childrens of binaryDataArray + bool mzarray = false; + unsigned long long length = 0; + for (XMLSize_t n = 0; n < currentNode5->getChildNodes()->getLength(); n++) { + + DOMNode* currentNode6 = currentNode5->getChildNodes()->item(n); + if (currentNode6->getNodeType() && currentNode6->getNodeType() == DOMNode::ELEMENT_NODE) { + + + DOMElement* currentElement6 = dynamic_cast(currentNode6); + if (XMLString::equals(currentElement6->getTagName(), XMLString::transcode("referenceableParamGroupRef"))) { + + const XMLCh* xmlch_ref = currentElement6->getAttribute(XMLString::transcode("ref")); + string ref = XMLString::transcode(xmlch_ref); + + if (ref.compare("mzArray") == 0) { + mzarray = true; + } + + } + + if (XMLString::equals(currentElement6->getTagName(), XMLString::transcode("cvParam"))) { + + const XMLCh* xmlch_name = currentElement6->getAttribute(XMLString::transcode("name")); + string name = XMLString::transcode(xmlch_name); + + if (mzarray) { + if (name.compare("external offset") == 0) { + stringstream ss; + ss << offset; + currentElement6->setAttribute(XMLString::transcode("value"), XMLString::transcode(ss.str().c_str())); + } + + if (name.compare("external encoded length") == 0) { + stringstream ss; + ss << peaklists[currentid].size() * 8; + currentElement6->setAttribute(XMLString::transcode("value"), XMLString::transcode(ss.str().c_str())); + } + + if (name.compare("external array length") == 0) { + stringstream ss; + ss << peaklists[currentid].size(); + currentElement6->setAttribute(XMLString::transcode("value"), XMLString::transcode(ss.str().c_str())); + } + } + else { + if (name.compare("external offset") == 0) { + stringstream ss; + ss << offset + peaklists[currentid].size() * 8; + currentElement6->setAttribute(XMLString::transcode("value"), XMLString::transcode(ss.str().c_str())); + } + + if (name.compare("external encoded length") == 0) { + stringstream ss; + ss << peaklists[currentid].size() * 8; + currentElement6->setAttribute(XMLString::transcode("value"), XMLString::transcode(ss.str().c_str())); + } + + if (name.compare("external array length") == 0) { + stringstream ss; + ss << peaklists[currentid].size(); + currentElement6->setAttribute(XMLString::transcode("value"), XMLString::transcode(ss.str().c_str())); + } + } + + } + + + } + + } + + + } + + } + + } + + + } + + } + + } + + + offset += peaklists[currentid].size() * 8 * 2; + currentid++; + + + } + + } + + } + + + } + + } + + } + + + } + + } + + } + + +} + + vector& cImzML::getItems() { return imzmlitems; } + +bool cImzML::hasProfileSpectra() { + return profilespectra; +} + + +void cImzML::write(string& filename) { + if (document == 0) { + return; + } + +#if OS_TYPE == WIN + DOMImplementation *implementation = DOMImplementationRegistry::getDOMImplementation(L"LS"); +#else + XMLCh *features = XMLString::transcode("LS"); + DOMImplementation *implementation = DOMImplementationRegistry::getDOMImplementation(features); +#endif + DOMLSSerializer *serializer = ((DOMImplementationLS*)implementation)->createLSSerializer(); + + if (serializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true)) { + serializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true); + } + serializer->setNewLine(XMLString::transcode("\r\n")); + + XMLCh *outputpath = XMLString::transcode(filename.c_str()); + XMLFormatTarget *formatTarget = new LocalFileFormatTarget(outputpath); + DOMLSOutput *output = ((DOMImplementationLS*)implementation)->createLSOutput(); + output->setByteStream(formatTarget); + + serializer->write(document, output); + +#if OS_TYPE != WIN + XMLString::release(&features); +#endif + serializer->release(); + XMLString::release(&outputpath); + delete formatTarget; + output->release(); +} + diff --git a/CycloBranch/core/cImzML.h b/CycloBranch/core/cImzML.h index 468d6df..73cc7a0 100644 --- a/CycloBranch/core/cImzML.h +++ b/CycloBranch/core/cImzML.h @@ -12,11 +12,15 @@ #include #include #include +#include using namespace std; using namespace xercesc; +class cPeaksList; + + /** \brief A parsed imzML item. */ @@ -80,6 +84,9 @@ struct cImzMLItem { class cImzML { XercesDOMParser* parser; + DOMDocument* document; + + bool profilespectra; vector imzmlitems; public: @@ -101,7 +108,14 @@ class cImzML { \brief Parse an imzml file. \param filename imzml filename */ - void parse(string filename); + void parse(string& filename); + + + /** + \brief Update values after conversion of profile spectra into centroid spectra. + \param peaklists an updated vector of peaklists + */ + void updateRawDataToPeakList(vector& peaklists); /** @@ -109,6 +123,20 @@ class cImzML { \retval vector a vector of cImzML items */ vector& getItems(); + + + /** + \brief Check if the file contains profile spectra. + \retval bool true if the file contains profile spectra + */ + bool hasProfileSpectra(); + + + /** + \brief Write an imzml file. + \param filename an output imzml filename + */ + void write(string& filename); }; diff --git a/CycloBranch/core/cParameters.cpp b/CycloBranch/core/cParameters.cpp index e1aeac7..ef30621 100644 --- a/CycloBranch/core/cParameters.cpp +++ b/CycloBranch/core/cParameters.cpp @@ -84,7 +84,7 @@ int cParameters::checkAndPrepare(bool& terminatecomputation) { ifstream sequencedatabasestream; regex rx; string s; - int i; + int i, errtype; string foldername; string ibdfilename; @@ -290,9 +290,40 @@ int cParameters::checkAndPrepare(bool& terminatecomputation) { #endif break; case imzML: - if (peaklistseries.loadFromIMZMLStream(peaklistfilename, peakliststream, minimumrelativeintensitythreshold, os, terminatecomputation) == -1) { + errtype = peaklistseries.loadFromIMZMLStream(peaklistfilename, peakliststream, minimumrelativeintensitythreshold, os, terminatecomputation); + if (errtype == -1) { error = true; - errormessage = "Aborted by user."; + errormessage = "Aborted by user.\n"; + } + if (errtype == -2) { + error = true; + #if OS_TYPE == UNX + errormessage = "Raw data cannot be converted.\n"; + errormessage += "Does the file '" + peaklistfilename + "' exist ?\n"; + errormessage += "Is the directory with the file '" + peaklistfilename + "' writable ?\n"; + errormessage += "Do you have enough space on your hard drive ?\n"; + errormessage += "Do you have OpenMS 1.11 installed (sudo apt-get install topp) ?\n"; + errormessage += "Do you have 'raw2peaks.sh' file located in '" + installdir.toStdString() + "External/linux' folder ?\n"; + errormessage += "Is the file 'raw2peaks.sh' executable (sudo chmod +x " + installdir.toStdString() + "External/linux/raw2peaks.sh) ? \n"; + #else + #if OS_TYPE == OSX + errormessage = "Raw data cannot be converted.\n"; + errormessage += "Does the file '" + peaklistfilename + "' exist ?\n"; + errormessage += "Is the directory with the file '" + peaklistfilename + "' writable ?\n"; + errormessage += "Do you have enough space on your hard drive ?\n"; + errormessage += "Do you have OpenMS 1.11 installed ?\n"; + errormessage += "Do you have 'raw2peaks.sh' file located in '" + installdir.toStdString() + "External/macosx' folder ?\n"; + errormessage += "Is the file 'raw2peaks.sh' executable (sudo chmod +x " + installdir.toStdString() + "External/macosx/raw2peaks.sh) ? \n"; + #else + errormessage = "Raw data cannot be converted.\n"; + errormessage += "Does the file '" + peaklistfilename + "' exist ?\n"; + errormessage += "Is the directory with the file '" + peaklistfilename + "' writable ?\n"; + errormessage += "Do you have enough space on your hard drive ?\n"; + errormessage += "Do you have OpenMS 1.11 installed ?\n"; + errormessage += "Do you have a path to OpenMS binaries folder in your PATH variable (e.g., 'C:/Program Files/OpenMS-1.11/bin') ?\n"; + errormessage += "Do you have 'raw2peaks.bat' file located in the '" + appname.toStdString() + "/External/windows' folder ?\n"; + #endif + #endif } break; default: @@ -512,12 +543,12 @@ int cParameters::checkAndPrepare(bool& terminatecomputation) { case branchcyclic: initializeFragmentIonsForDeNovoGraphOfBranchCyclicPeptides(fragmentionsfordenovograph); break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - initializeFragmentIonsForDeNovoGraphOfLinearPolyketideSiderophore(fragmentionsfordenovograph); +#if OLIGOKETIDES == 1 + case linearoligoketide: + initializeFragmentIonsForDeNovoGraphOfLinearOligoketide(fragmentionsfordenovograph); break; - case cyclicpolyketide: - initializeFragmentIonsForDeNovoGraphOfCyclicPolyketideSiderophore(fragmentionsfordenovograph); + case cyclicoligoketide: + initializeFragmentIonsForDeNovoGraphOfCyclicOligoketide(fragmentionsfordenovograph); break; #endif case linearpolysaccharide: @@ -581,12 +612,12 @@ string cParameters::printToString() { case branchcyclic: s += "Branch-cyclic\n"; break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - s += "Linear oligoketide siderophore\n"; +#if OLIGOKETIDES == 1 + case linearoligoketide: + s += "Linear oligoketide\n"; break; - case cyclicpolyketide: - s += "Cyclic oligoketide siderophore\n"; + case cyclicoligoketide: + s += "Cyclic oligoketide\n"; break; #endif case linearpolysaccharide: diff --git a/CycloBranch/core/cPeakListSeries.cpp b/CycloBranch/core/cPeakListSeries.cpp index fb2ee2e..70e60bd 100644 --- a/CycloBranch/core/cPeakListSeries.cpp +++ b/CycloBranch/core/cPeakListSeries.cpp @@ -1,5 +1,6 @@ #include "core/cPeakListSeries.h" +#include #include "gui/cMainThread.h" @@ -64,11 +65,26 @@ void cPeakListSeries::loadFromBAFStream(ifstream &stream) { int cPeakListSeries::loadFromIMZMLStream(string& imzmlfilename, ifstream &ibdstream, double minimumrelativeintensitythreshold, cMainThread* os, bool& terminatecomputation) { - *os << "Parsing the imzML file ..." << endl; + *os << endl << endl << "Parsing the imzML file..." << endl; cImzML imzml; imzml.parse(imzmlfilename); + ofstream mgfofstream; + ifstream mgfifstream; + string mgfname; + string convertedimzmlfilename; + string convertedibdfilename; + int strip; + bool rawdata = imzml.hasProfileSpectra(); + + if (rawdata) { + mgfname = imzmlfilename.substr(0, (int)imzmlfilename.size() - 5); + stringstream ss; + ss << mgfname << setw(10) << setfill('0') << 0 << ".mgf"; + mgfofstream.open(ss.str()); + } + *os << "Loading the peaklist no. : " << endl; for (int i = 0; i < (int)imzml.getItems().size(); i++) { @@ -77,21 +93,118 @@ int cPeakListSeries::loadFromIMZMLStream(string& imzmlfilename, ifstream &ibdstr *os << endl; } + if (rawdata) { + mgfofstream << "BEGIN IONS" << endl; + mgfofstream << "TITLE=" << endl; + mgfofstream << "SCAN=" << to_string(i + 1) << endl; + mgfofstream << "PEPMASS=1" << endl; + mgfofstream << "RTINSECONDS=1" << endl; + mgfofstream << "CHARGE=1+" << endl << endl; + } + cPeaksList peaklist; peaklist.loadFromIBDStream(imzml.getItems()[i], ibdstream); - if (peaklist.size() > 0) { - peaklist.normalizeIntenzity(); // to do - redundant operation - peaklist.cropIntenzity(minimumrelativeintensitythreshold); // to do - redundant operation + if ((peaklist.size() > 0) && !rawdata) { peaklists.push_back(peaklist); } + if (rawdata) { + for (int j = 0; j < peaklist.size(); j++) { + mgfofstream << peaklist[j].mzratio << " " << peaklist[j].intensity << endl; + } + mgfofstream << "END IONS" << endl << endl; + + if (((i + 1) % 100 == 0) && (i > 0)) { + mgfofstream.close(); + stringstream ss; + strip = (i + 1) / 100; + ss << mgfname << setw(10) << setfill('0') << strip << ".mgf"; + mgfofstream.open(ss.str()); + } + } + if (terminatecomputation) { peaklists.clear(); return -1; } } - *os << " ok" << endl; + *os << " ok" << endl << endl; + + if (rawdata) { + + mgfofstream.close(); + + *os << endl << "Converting raw data to peaklists... "; + + string s; + #if OS_TYPE == UNX + s = installdir.toStdString() + "External/linux/raw2peaks.sh " + mgfname; + #else + #if OS_TYPE == OSX + s = installdir.toStdString() + "External/macosx/raw2peaks.sh " + mgfname; + #else + s = "External\\windows\\raw2peaks.bat \"" + mgfname + "\""; + #endif + #endif + + if (system(s.c_str()) != 0) { + return -2; + } + + mgfname += "mgf"; + mgfifstream.open(mgfname); + while (mgfifstream.good() && (peaklists.size() < imzml.getItems().size())) { + cPeaksList peaklist; + peaklist.loadFromMGFStream(mgfifstream); + peaklists.push_back(peaklist); + } + mgfifstream.close(); + QFile::remove(mgfname.c_str()); + + if (imzml.getItems().size() != peaklists.size()) { + return -2; + } + + for (int i = 0; i < (int)imzml.getItems().size(); i++) { + peaklists[i].setCoordinates(imzml.getItems()[i].x, imzml.getItems()[i].y); + } + + imzml.updateRawDataToPeakList(peaklists); + + convertedimzmlfilename = imzmlfilename.substr(0, (int)imzmlfilename.size() - 6); + convertedibdfilename = convertedimzmlfilename + "_converted.ibd"; + convertedimzmlfilename += "_converted.imzML"; + imzml.write(convertedimzmlfilename); + + ofstream ofibdstream; + char headerbyte; + ofibdstream.open(convertedibdfilename, std::ofstream::binary); + + // copy ibd header + ibdstream.seekg(0, ibdstream.beg); + for (int i = 0; i < 16; i++) { + ibdstream.read((char*)&headerbyte, 1); + ofibdstream.write((char*)&headerbyte, 1); + } + + // write peaklists + for (int i = 0; i < (int)peaklists.size(); i++) { + peaklists[i].storeToIBDStream(ofibdstream); + } + + ofibdstream.close(); + + int i = 0; + while (i < (int)peaklists.size()) { + if (peaklists[i].size() == 0) { + peaklists.erase(peaklists.begin() + i); + } + else { + i++; + } + } + } return 0; } diff --git a/CycloBranch/core/cPeakListSeries.h b/CycloBranch/core/cPeakListSeries.h index f44c10b..bb1c11b 100644 --- a/CycloBranch/core/cPeakListSeries.h +++ b/CycloBranch/core/cPeakListSeries.h @@ -7,6 +7,8 @@ #ifndef _CPEAKLISTSERIES_H #define _CPEAKLISTSERIES_H +#include + #include "core/cPeaksList.h" @@ -85,7 +87,7 @@ class cPeakListSeries { \param minimumrelativeintensitythreshold a minimum threshold of relative intensity \param os pointer to the main thread of the application (output stream) \param terminatecomputation reference to a variable determining that the computation must be stopped - \retval int 0 = success; -1 = error + \retval int 0 = success; -1 = aborted by user, -2 = error */ int loadFromIMZMLStream(string& imzmlfilename, ifstream &ibdstream, double minimumrelativeintensitythreshold, cMainThread* os, bool& terminatecomputation); diff --git a/CycloBranch/core/cPeaksList.cpp b/CycloBranch/core/cPeaksList.cpp index aef3fe3..140dcf1 100644 --- a/CycloBranch/core/cPeaksList.cpp +++ b/CycloBranch/core/cPeaksList.cpp @@ -129,13 +129,11 @@ void cPeaksList::loadFromBAFStream(ifstream &stream) { void cPeaksList::loadFromIBDStream(cImzMLItem& imzmlitem, ifstream &ibdstream) { unsigned long long start; - unsigned long long end; double value; peaks.resize(imzmlitem.mzlength/8); start = imzmlitem.mzstart; - end = imzmlitem.mzstart + imzmlitem.mzlength; ibdstream.seekg(start, ibdstream.beg); for (int i = 0; i < (int)imzmlitem.mzlength/8; i++) { if (ibdstream.good()) { @@ -149,7 +147,6 @@ void cPeaksList::loadFromIBDStream(cImzMLItem& imzmlitem, ifstream &ibdstream) { } start = imzmlitem.intensitystart; - end = imzmlitem.intensitystart + imzmlitem.intensitylength; ibdstream.seekg(start, ibdstream.beg); for (int i = 0; i < (int)imzmlitem.intensitylength/8; i++) { if (ibdstream.good()) { @@ -163,6 +160,19 @@ void cPeaksList::loadFromIBDStream(cImzMLItem& imzmlitem, ifstream &ibdstream) { } +void cPeaksList::storeToIBDStream(ofstream &ibdstream) { + // store m/z values + for (int i = 0; i < (int)peaks.size(); i++) { + ibdstream.write((char *)&(peaks[i].mzratio), 8); + } + + // store intensities + for (int i = 0; i < (int)peaks.size(); i++) { + ibdstream.write((char *)&(peaks[i].intensity), 8); + } +} + + void cPeaksList::loadFromMGFStream(ifstream &stream) { string s; cPeak p; @@ -559,12 +569,30 @@ void cPeaksList::maxHighestPeaksInWindow(int maximumnumberofpeaksinwindow, doubl } -double cPeaksList::getMaximumIntensityFromMZInterval(double minmz, double maxmz) { +double cPeaksList::getMaximumIntensityFromMZInterval(double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled) { double intensity = 0; for (int i = 0; i < (int)peaks.size(); i++) { + + // skip peaks which are out of range if ((peaks[i].mzratio < minmz) || (peaks[i].mzratio > maxmz)) { continue; } + + // skip unmatched peaks if selected + if (hideunmatched && (peaks[i].matched <= 0)) { + continue; + } + + // skip matched peaks if selected + if (hidematched && (peaks[i].matched > 0)) { + continue; + } + + // skip scrambled peaks if selected + if ((peptidetype == cyclic) && hidescrambled && peaks[i].scrambled) { + continue; + } + if (peaks[i].intensity > intensity) { intensity = peaks[i].intensity; } diff --git a/CycloBranch/core/cPeaksList.h b/CycloBranch/core/cPeaksList.h index 2c5d11a..fd99dd7 100644 --- a/CycloBranch/core/cPeaksList.h +++ b/CycloBranch/core/cPeaksList.h @@ -138,11 +138,18 @@ class cPeaksList { /** \brief Load the spectrum from .ibd file. \param imzmlitem cImzML containing the offset in the ibd file - \param ibdstream ibd binary file stream + \param ibdstream an input binary file stream */ void loadFromIBDStream(cImzMLItem& imzmlitem, ifstream &ibdstream); + /** + \brief Store the spectrum into .ibd file. + \param ibdstream an output binary file stream + */ + void storeToIBDStream(ofstream &ibdstream); + + /** \brief Load the spectrum from a .mgf file. \param stream source stream @@ -304,9 +311,13 @@ class cPeaksList { \brief Get a maximum intensity of a peak in an interval of mz ratios. \param minmz minimum mz ratio \param maxmz maximum mz ratio + \param hidematched true, if matched peaks are hidden + \param hideunmatched true, if unmatched peaks are hidden + \param peptidetype the type of peptide + \param hidescrambled true, if scrambled peaks are hidden \retval double intensity */ - double getMaximumIntensityFromMZInterval(double minmz, double maxmz); + double getMaximumIntensityFromMZInterval(double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled); /** diff --git a/CycloBranch/core/cTheoreticalSpectrum.cpp b/CycloBranch/core/cTheoreticalSpectrum.cpp index e06bd4c..d86d769 100644 --- a/CycloBranch/core/cTheoreticalSpectrum.cpp +++ b/CycloBranch/core/cTheoreticalSpectrum.cpp @@ -143,42 +143,42 @@ void cTheoreticalSpectrum::generatePrecursorIon(vector& intcomposition, cBr endtype = (int)cyclic_precursor_ion_co_loss_and_dehydrated_and_deamidated; usedmodifications.insert(candidate.getMiddleModifID()); break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: peak.mzratio = parameters->searchedmodifications[candidate.getStartModifID()].massdifference + parameters->searchedmodifications[candidate.getEndModifID()].massdifference; peak.seriesid = 0; - switch (candidate.getResidueLossType(bricksdatabasewithcombinations)) + switch (candidate.getKetidePrecursorType(bricksdatabasewithcombinations)) { - case water: - starttype = (int)linear_polyketide_precursor_ion_h_oh; - endtype = (int)linear_polyketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated; + case ketide_precursor_h2o: + starttype = (int)linear_oligoketide_precursor_ion_h_oh; + endtype = (int)linear_oligoketide_precursor_ion_h_oh_co_loss_dehydrated_and_deamidated; break; - case h2: - starttype = (int)linear_polyketide_precursor_ion_h_h; - endtype = (int)linear_polyketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated; + case ketide_precursor_h2: + starttype = (int)linear_oligoketide_precursor_ion_h_h; + endtype = (int)linear_oligoketide_precursor_ion_h_h_co_loss_dehydrated_and_deamidated; break; - case h2o2: - starttype = (int)linear_polyketide_precursor_ion_oh_oh; - endtype = (int)linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated; + case ketide_precursor_h2o2: + starttype = (int)linear_oligoketide_precursor_ion_oh_oh; + endtype = (int)linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated; break; default: break; } if (candidate.hasFirstBrickArtificial(bricksdatabasewithcombinations) || candidate.hasLastBrickArtificial(bricksdatabasewithcombinations)) { - starttype = (int)linear_polyketide_precursor_ion_h_h; - endtype = (int)linear_polyketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated; + starttype = (int)linear_oligoketide_precursor_ion_h_h; + endtype = (int)linear_oligoketide_precursor_ion_oh_oh_co_loss_dehydrated_and_deamidated; } usedmodifications.insert(candidate.getStartModifID()); usedmodifications.insert(candidate.getEndModifID()); break; - case cyclicpolyketide: + case cyclicoligoketide: peak.mzratio = 0; peak.seriesid = (int)intcomposition.size() - 1; - starttype = (int)cyclic_polyketide_precursor_ion; - endtype = (int)cyclic_polyketide_precursor_ion_co_loss_dehydrated_and_deamidated; + starttype = (int)cyclic_oligoketide_precursor_ion; + endtype = (int)cyclic_oligoketide_precursor_ion_co_loss_dehydrated_and_deamidated; break; #endif case linearpolysaccharide: @@ -1214,7 +1214,7 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab return -2; } - eResidueLossType leftresiduelosstype = water; + eResidueLossType leftresiduelosstype = h2o_loss; bool hasfirstblockartificial = false; for (int i = 0; i < 2*r; i++) { @@ -1224,7 +1224,7 @@ int cTheoreticalSpectrum::compareCyclic(cPeaksList& sortedpeaklist, cBricksDatab brick.setComposition(rotations[i], false); brick.explodeToIntComposition(intcomposition); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 eResidueLossType leftresiduelosstype = bricksdatabasewithcombinations[intcomposition[0] - 1].getResidueLossType(); bool hasfirstblockartificial = bricksdatabasewithcombinations[intcomposition[0] - 1].isArtificial(); #endif @@ -1735,12 +1735,12 @@ int cTheoreticalSpectrum::compareBranchCyclic(cPeaksList& sortedpeaklist, cBrick } -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 -int cTheoreticalSpectrum::compareLinearPolyketideSiderophore(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { +int cTheoreticalSpectrum::compareLinearOligoketide(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { - if (!candidate.checkPolyketideSequence(bricksdatabasewithcombinations, parameters->peptidetype)) { + if (!candidate.checkKetideSequence(bricksdatabasewithcombinations, parameters->peptidetype)) { return -2; } @@ -1761,10 +1761,10 @@ int cTheoreticalSpectrum::compareLinearPolyketideSiderophore(cPeaksList& sortedp bool haslastblockartificial = bricksdatabasewithcombinations[intcomposition.back() - 1].isArtificial(); if (!hasfirstblockartificial && !haslastblockartificial) { - if (((leftresiduelosstype == h2) && (candidate.getStartModifID() > 0) && parameters->searchedmodifications[candidate.getStartModifID()].cterminal) - || ((leftresiduelosstype == h2o2) && (candidate.getStartModifID() > 0) && parameters->searchedmodifications[candidate.getStartModifID()].nterminal) - || ((rightresiduelosstype == h2) && (candidate.getEndModifID() > 0) && parameters->searchedmodifications[candidate.getEndModifID()].cterminal) - || ((rightresiduelosstype == h2o2) && (candidate.getEndModifID() > 0) && parameters->searchedmodifications[candidate.getEndModifID()].nterminal)) { + if (((leftresiduelosstype == h2_loss) && (candidate.getStartModifID() > 0) && parameters->searchedmodifications[candidate.getStartModifID()].cterminal) + || ((leftresiduelosstype == h2o_loss) && (candidate.getStartModifID() > 0) && parameters->searchedmodifications[candidate.getStartModifID()].nterminal) + || ((rightresiduelosstype == h2_loss) && (candidate.getEndModifID() > 0) && parameters->searchedmodifications[candidate.getEndModifID()].cterminal) + || ((rightresiduelosstype == h2o_loss) && (candidate.getEndModifID() > 0) && parameters->searchedmodifications[candidate.getEndModifID()].nterminal)) { return -2; } } @@ -1798,16 +1798,16 @@ int cTheoreticalSpectrum::compareLinearPolyketideSiderophore(cPeaksList& sortedp for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { if ( - ((hasfirstblockartificial || (leftresiduelosstype == h2)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2h_ion))) + ((hasfirstblockartificial || (leftresiduelosstype == h2_loss)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2h_ion))) || - ((hasfirstblockartificial || (leftresiduelosstype == h2o2)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2oh_ion))) + ((hasfirstblockartificial || (leftresiduelosstype == h2o_loss)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2oh_ion))) ) { generateNTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype, 0, leftresiduelosstype, hasfirstblockartificial); } if ( - ((haslastblockartificial || (rightresiduelosstype == h2)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2h_ion))) + ((haslastblockartificial || (rightresiduelosstype == h2_loss)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2h_ion))) || - ((haslastblockartificial || (rightresiduelosstype == h2o2)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2oh_ion))) + ((haslastblockartificial || (rightresiduelosstype == h2o_loss)) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2oh_ion))) ) { generateCTerminalFragmentIons(parameters->precursorcharge, theoreticalpeaksrealsize, intcomposition, parameters->fragmentionsfortheoreticalspectra[i], bricksdatabasewithcombinations, writedescription, 0, splittingsites, parameters->searchedmodifications, parameters->peptidetype, 0, rightresiduelosstype, haslastblockartificial); } @@ -1902,9 +1902,9 @@ int cTheoreticalSpectrum::compareLinearPolyketideSiderophore(cPeaksList& sortedp } -int cTheoreticalSpectrum::compareCyclicPolyketideSiderophore(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { +int cTheoreticalSpectrum::compareCyclicOligoketide(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence) { - if (!candidate.checkPolyketideSequence(bricksdatabasewithcombinations, parameters->peptidetype)) { + if (!candidate.checkKetideSequence(bricksdatabasewithcombinations, parameters->peptidetype)) { return -2; } @@ -2222,8 +2222,8 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea peak.mzratio = parameters->fragmentdefinitions[fragmentiontype].massdifference; if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) -#if POLYKETIDE_SIDEROPHORES == 1 - || (peptidetype == linearpolyketide) +#if OLIGOKETIDES == 1 + || (peptidetype == linearoligoketide) #endif ) { peak.mzratio += searchedmodifications[candidate.getStartModifID()].massdifference; @@ -2253,11 +2253,11 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea case linearpolysaccharide: peak.rotationid = rotationid; break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: peak.rotationid = rotationid; break; - case cyclicpolyketide: + case cyclicoligoketide: peak.rotationid = rotationid; break; #endif @@ -2291,48 +2291,48 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea //} } -#if POLYKETIDE_SIDEROPHORES == 1 - if (peptidetype == linearpolyketide) { - if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { +#if OLIGOKETIDES == 1 + if (peptidetype == linearoligoketide) { + if (!hasfirstblockartificial && (leftresiduelosstype == h2_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { continue; } - if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion) && (i % 2 == 1)) { + if (!hasfirstblockartificial && (leftresiduelosstype == h2_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion) && (i % 2 == 1)) { continue; } - if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1oh_ion) && (i % 2 == 1)) { + if (!hasfirstblockartificial && (leftresiduelosstype == h2o_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1oh_ion) && (i % 2 == 1)) { continue; } - if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2oh_ion) && (i % 2 == 0)) { + if (!hasfirstblockartificial && (leftresiduelosstype == h2o_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2oh_ion) && (i % 2 == 0)) { continue; } } - if (peptidetype == cyclicpolyketide) { + if (peptidetype == cyclicoligoketide) { - if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l0h_ion)) { // b+2H ion is generated instead of b-2H - continue; - } + //if (!hasfirstblockartificial && (leftresiduelosstype == h2_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l0h_ion)) { // b+2H ion is generated instead of b-2H + // continue; + //} - if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { + if (!hasfirstblockartificial && (leftresiduelosstype == h2_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { continue; } - if (!hasfirstblockartificial && (leftresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion) && (i % 2 == 1)) { + if (!hasfirstblockartificial && (leftresiduelosstype == h2_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion) && (i % 2 == 1)) { continue; } - if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l0h_ion) && (i % 2 == 1)) { - continue; - } + //if (!hasfirstblockartificial && (leftresiduelosstype == h2o_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l0h_ion) && (i % 2 == 1)) { + // continue; + //} - if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { // ok - even numbers of blocks => always b-ion + if (!hasfirstblockartificial && (leftresiduelosstype == h2o_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l1h_ion) && (i % 2 == 0)) { // ok - even numbers of blocks => always b-ion continue; } - if (!hasfirstblockartificial && (leftresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion)) { // b-2H ion is generated instead of b+2H + if (!hasfirstblockartificial && (leftresiduelosstype == h2o_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == l2h_ion)) { // b-2H ion is generated instead of b+2H continue; } } @@ -2343,8 +2343,8 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea if (writedescription) { peak.description = ""; -#if POLYKETIDE_SIDEROPHORES == 1 - if ((peptidetype == cyclic) || (peptidetype == cyclicpolyketide)) { +#if OLIGOKETIDES == 1 + if ((peptidetype == cyclic) || (peptidetype == cyclicoligoketide)) { #else if (peptidetype == cyclic) { #endif @@ -2358,8 +2358,8 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea peak.description += to_string(trotation->id + 1) + "_"; } -#if POLYKETIDE_SIDEROPHORES == 1 - if ((peptidetype == linearpolyketide) || (peptidetype == cyclicpolyketide)) { +#if OLIGOKETIDES == 1 + if ((peptidetype == linearoligoketide) || (peptidetype == cyclicoligoketide)) { peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(0, 2) + to_string(i + 1); if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 2) { peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(2, parameters->fragmentdefinitions[fragmentiontype].name.length() - 2); @@ -2371,7 +2371,7 @@ void cTheoreticalSpectrum::generateNTerminalFragmentIons(int maxcharge, int& pea if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 1) { peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(1, parameters->fragmentdefinitions[fragmentiontype].name.length() - 1); } -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 } #endif @@ -2428,8 +2428,8 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea peak.mzratio = parameters->fragmentdefinitions[fragmentiontype].massdifference; if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) -#if POLYKETIDE_SIDEROPHORES == 1 - || (peptidetype == linearpolyketide) +#if OLIGOKETIDES == 1 + || (peptidetype == linearoligoketide) #endif ) { peak.mzratio += searchedmodifications[candidate.getEndModifID()].massdifference; @@ -2456,11 +2456,11 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea case branchcyclic: peak.rotationid = rotationid*6 + trotation->id; // to do - potential bug break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: peak.rotationid = rotationid; break; - case cyclicpolyketide: + case cyclicoligoketide: peak.rotationid = rotationid; break; #endif @@ -2498,21 +2498,21 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea //} } -#if POLYKETIDE_SIDEROPHORES == 1 - if (peptidetype == linearpolyketide) { - if (!haslastblockartificial && (rightresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == r1h_ion) && (order % 2 == 0)) { +#if OLIGOKETIDES == 1 + if (peptidetype == linearoligoketide) { + if (!haslastblockartificial && (rightresiduelosstype == h2_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == r1h_ion) && (order % 2 == 0)) { continue; } - if (!haslastblockartificial && (rightresiduelosstype == h2) && (parameters->fragmentdefinitions[fragmentiontype].parent == r2h_ion) && (order % 2 == 1)) { + if (!haslastblockartificial && (rightresiduelosstype == h2_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == r2h_ion) && (order % 2 == 1)) { continue; } - if (!haslastblockartificial && (rightresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == r1oh_ion) && (order % 2 == 1)) { + if (!haslastblockartificial && (rightresiduelosstype == h2o_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == r1oh_ion) && (order % 2 == 1)) { continue; } - if (!haslastblockartificial && (rightresiduelosstype == h2o2) && (parameters->fragmentdefinitions[fragmentiontype].parent == r2oh_ion) && (order % 2 == 0)) { + if (!haslastblockartificial && (rightresiduelosstype == h2o_loss) && (parameters->fragmentdefinitions[fragmentiontype].parent == r2oh_ion) && (order % 2 == 0)) { continue; } } @@ -2523,8 +2523,8 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea if (writedescription) { peak.description = ""; -#if POLYKETIDE_SIDEROPHORES == 1 - if (peptidetype == cyclicpolyketide) { +#if OLIGOKETIDES == 1 + if (peptidetype == cyclicoligoketide) { peak.description += to_string(splittingsites[rotationid].first + 1) + "-" + to_string(splittingsites[rotationid].second + 1) + "_"; } #endif @@ -2539,8 +2539,8 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea peak.description += to_string(trotation->id + 1) + "_"; } -#if POLYKETIDE_SIDEROPHORES == 1 - if ((peptidetype == linearpolyketide) || (peptidetype == cyclicpolyketide)) { +#if OLIGOKETIDES == 1 + if ((peptidetype == linearoligoketide) || (peptidetype == cyclicoligoketide)) { peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(0, 2) + to_string((int)intcomposition.size() - i); if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 2) { peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(2, parameters->fragmentdefinitions[fragmentiontype].name.length() - 2); @@ -2552,7 +2552,7 @@ void cTheoreticalSpectrum::generateCTerminalFragmentIons(int maxcharge, int& pea if (parameters->fragmentdefinitions[fragmentiontype].name.size() > 1) { peak.description += parameters->fragmentdefinitions[fragmentiontype].name.substr(1, parameters->fragmentdefinitions[fragmentiontype].name.length() - 1); } -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 } #endif diff --git a/CycloBranch/core/cTheoreticalSpectrum.h b/CycloBranch/core/cTheoreticalSpectrum.h index 20ae222..d78f8d2 100644 --- a/CycloBranch/core/cTheoreticalSpectrum.h +++ b/CycloBranch/core/cTheoreticalSpectrum.h @@ -244,11 +244,11 @@ class cTheoreticalSpectrum { int compareBranchCyclic(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 /** - \brief Compare the theoretical spectrum of a linear polyketide siderophore with an experimental spectrum. + \brief Compare the theoretical spectrum of a linear oligoketide with an experimental spectrum. \param sortedpeaklist reference to an experimental peaklist \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks \param writedescription if true then string descriptions of peaks are filled @@ -256,11 +256,11 @@ class cTheoreticalSpectrum { \param searchedsequence reference to a regex of a searched sequence \retval int number theoretical peaks generated; -2 when the sequence tag does not match the peptide sequence candidate */ - int compareLinearPolyketideSiderophore(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); + int compareLinearOligoketide(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); /** - \brief Compare the theoretical spectrum of a cyclic polyketide siderophore with an experimental spectrum. + \brief Compare the theoretical spectrum of a cyclic oligoketide with an experimental spectrum. \param sortedpeaklist reference to an experimental peaklist \param bricksdatabasewithcombinations reference to a database of bricks with combinations of bricks \param writedescription if true then string descriptions of peaks are filled @@ -268,7 +268,7 @@ class cTheoreticalSpectrum { \param searchedsequence reference to a regex of a searched sequence \retval int number theoretical peaks generated; -2 when the sequence tag does not match the peptide sequence candidate */ - int compareCyclicPolyketideSiderophore(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); + int compareCyclicOligoketide(cPeaksList& sortedpeaklist, cBricksDatabase& bricksdatabasewithcombinations, bool writedescription, regex& sequencetag, regex& searchedsequence); #endif @@ -351,7 +351,7 @@ class cTheoreticalSpectrum { \param leftresiduelosstype a residue type of the leftmost building block \param hasfirstblockartificial true when the first block is artificial, false otherwise */ - void generateNTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, eFragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, ePeptideType peptidetype, TRotationInfo* trotation = 0, eResidueLossType leftresiduelosstype = water, bool hasfirstblockartificial = false); + void generateNTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, eFragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, ePeptideType peptidetype, TRotationInfo* trotation = 0, eResidueLossType leftresiduelosstype = h2o_loss, bool hasfirstblockartificial = false); /** @@ -370,7 +370,7 @@ class cTheoreticalSpectrum { \param rightresiduelosstype a residue type of the rightmost building block \param haslastblockartificial true when the last block is artificial, false otherwise */ - void generateCTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, eFragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, ePeptideType peptidetype, TRotationInfo* trotation = 0, eResidueLossType rightresiduelosstype = water, bool haslastblockartificial = false); + void generateCTerminalFragmentIons(int maxcharge, int& peaklistrealsize, vector& intcomposition, eFragmentIonType fragmentiontype, cBricksDatabase& bricksdatabase, bool writedescription, int rotationid, vector& splittingsites, vector& searchedmodifications, ePeptideType peptidetype, TRotationInfo* trotation = 0, eResidueLossType rightresiduelosstype = h2o_loss, bool haslastblockartificial = false); /** diff --git a/CycloBranch/core/cTheoreticalSpectrumList.cpp b/CycloBranch/core/cTheoreticalSpectrumList.cpp index e6dccaf..66a96a7 100644 --- a/CycloBranch/core/cTheoreticalSpectrumList.cpp +++ b/CycloBranch/core/cTheoreticalSpectrumList.cpp @@ -256,12 +256,12 @@ int cTheoreticalSpectrumList::parallelCompareAndStore(cCandidateSet& candidates, case branchcyclic: theoreticalpeaksrealsize = tsp.compareBranchCyclic(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - theoreticalpeaksrealsize = tsp.compareLinearPolyketideSiderophore(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); +#if OLIGOKETIDES == 1 + case linearoligoketide: + theoreticalpeaksrealsize = tsp.compareLinearOligoketide(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); break; - case cyclicpolyketide: - theoreticalpeaksrealsize = tsp.compareCyclicPolyketideSiderophore(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); + case cyclicoligoketide: + theoreticalpeaksrealsize = tsp.compareCyclicOligoketide(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence); break; #endif case linearpolysaccharide: diff --git a/CycloBranch/core/utilities.cpp b/CycloBranch/core/utilities.cpp index 2b464ca..7b72d2c 100644 --- a/CycloBranch/core/utilities.cpp +++ b/CycloBranch/core/utilities.cpp @@ -4,7 +4,7 @@ QString appname = "CycloBranch"; -QString appversion = "v. 1.0.1512 (64-bit)"; +QString appversion = "v. 1.1.170 (64-bit)"; #if OS_TYPE == UNX @@ -75,14 +75,14 @@ bool checkRegex(ePeptideType peptidetype, string& sequence, string& errormessage { case linear: case linearpolysaccharide: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*$"; break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+$"; break; @@ -186,12 +186,12 @@ ePeptideType getPeptideTypeFromString(string& s) { if (s.compare("branch-cyclic") == 0) { return branchcyclic; } -#if POLYKETIDE_SIDEROPHORES == 1 - if (s.compare("linear-oligoketide-siderophore") == 0) { - return linearpolyketide; +#if OLIGOKETIDES == 1 + if (s.compare("linear-oligoketide") == 0) { + return linearoligoketide; } - if (s.compare("cyclic-oligoketide-siderophore") == 0) { - return cyclicpolyketide; + if (s.compare("cyclic-oligoketide") == 0) { + return cyclicoligoketide; } #endif if (s.compare("linear-polysaccharide") == 0) { @@ -220,12 +220,12 @@ string getStringFromPeptideType(ePeptideType peptidetype) { case branchcyclic: return "branch-cyclic"; break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - return "linear-oligoketide-siderophore"; +#if OLIGOKETIDES == 1 + case linearoligoketide: + return "linear-oligoketide"; break; - case cyclicpolyketide: - return "cyclic-oligoketide-siderophore"; + case cyclicoligoketide: + return "cyclic-oligoketide"; break; #endif case linearpolysaccharide: diff --git a/CycloBranch/core/utilities.h b/CycloBranch/core/utilities.h index 986e584..33e3955 100644 --- a/CycloBranch/core/utilities.h +++ b/CycloBranch/core/utilities.h @@ -36,7 +36,7 @@ class cBrick; #endif -#define POLYKETIDE_SIDEROPHORES 1 +#define OLIGOKETIDES 1 using namespace std; @@ -51,9 +51,9 @@ enum ePeptideType { cyclic = 1, branched = 2, branchcyclic = 3, -#if POLYKETIDE_SIDEROPHORES == 1 - linearpolyketide = 4, - cyclicpolyketide = 5, +#if OLIGOKETIDES == 1 + linearoligoketide = 4, + cyclicoligoketide = 5, linearpolysaccharide = 6, other = 7 #else diff --git a/CycloBranch/gui/cAboutWidget.cpp b/CycloBranch/gui/cAboutWidget.cpp index 8a0226f..ac06537 100644 --- a/CycloBranch/gui/cAboutWidget.cpp +++ b/CycloBranch/gui/cAboutWidget.cpp @@ -18,7 +18,7 @@ cAboutWidget::cAboutWidget(QWidget* parent) { QString homepage = "Homepage: http://ms.biomed.cas.cz/cyclobranch/

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

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

"; citation += "Jiri Novak, Karel Lemr, Kevin A. Schug and Vladimir Havlicek.
"; citation += "CycloBranch: De Novo Sequencing of Nonribosomal Peptides from Accurate Product Ion Mass Spectra.
"; citation += "J. Am. Soc. Mass Spectrom., vol. 26, no. 10, pp. 1780-1786, 2015. DOI: 10.1007/s13361-015-1211-1.
"; @@ -28,7 +28,7 @@ cAboutWidget::cAboutWidget(QWidget* parent) { licence += "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

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


"; - QString developers = "Developers:

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

(C) 2013 - 2015


"; + QString developers = "Developers:

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

(C) 2013 - 2016


"; QString splash = "



"; diff --git a/CycloBranch/gui/cBricksDatabaseWidget.cpp b/CycloBranch/gui/cBricksDatabaseWidget.cpp index c2c65d2..d493e71 100644 --- a/CycloBranch/gui/cBricksDatabaseWidget.cpp +++ b/CycloBranch/gui/cBricksDatabaseWidget.cpp @@ -68,8 +68,8 @@ cBricksDatabaseWidget::cBricksDatabaseWidget(QWidget* parent) { rowsfilterbutton->setToolTip("Filter Search Results"); rowsfilterbutton->setMinimumWidth(50); - rowsfilterclearbutton = new QPushButton("Clear"); - rowsfilterclearbutton->setToolTip("Clear Form and Reset Search Results"); + rowsfilterclearbutton = new QPushButton("Reset"); + rowsfilterclearbutton->setToolTip("Reset Search Results"); rowsfilterclearbutton->setMinimumWidth(50); rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); @@ -198,7 +198,8 @@ void cBricksDatabaseWidget::deleteTable(bool enableprogress) { int rowcount = database->rowCount(); if (enableprogress) { - progress = new QProgressDialog("Clearing the table...", /*"Cancel"*/0, 0, rowcount, this); + progress = new QProgressDialog("Clearing the table...", 0, 0, rowcount, this); + progress->setMinimumWidth(250); progress->installEventFilter(&filter); progress->setMinimumDuration(0); progress->setWindowModality(Qt::WindowModal); @@ -213,9 +214,6 @@ void cBricksDatabaseWidget::deleteTable(bool enableprogress) { if (enableprogress) { progress->setValue(i); - //if (progress->wasCanceled()) { - // break; - //} } } @@ -380,7 +378,8 @@ void cBricksDatabaseWidget::loadDatabase() { deleteTable(true); - QProgressDialog progress("Loading the Databatase of Building Blocks...", /*"Cancel"*/0, 0, bricks.size(), this); + QProgressDialog progress("Loading the Database of Building Blocks...", "Cancel", 0, bricks.size(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -412,9 +411,14 @@ void cBricksDatabaseWidget::loadDatabase() { ((QLabel *)database->cellWidget(i, 6))->setOpenExternalLinks(true); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} + if (progress.wasCanceled()) { + deleteTable(true); + bricks.clear(); + databasefile = ""; + save->setText(" Save "); + break; + } + } for (int i = 0; i < database->columnCount(); i++) { @@ -452,7 +456,8 @@ bool cBricksDatabaseWidget::saveDatabase() { } else { - QProgressDialog progress("Saving the Databatase of Building Blocks...", /*"Cancel"*/0, 0, database->rowCount(), this); + QProgressDialog progress("Saving the Database of Building Blocks...", 0, 0, database->rowCount(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -504,9 +509,6 @@ bool cBricksDatabaseWidget::saveDatabase() { bricks.push_back(b); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} } bricks.storeToPlainTextStream(outputstream); @@ -622,13 +624,15 @@ void cBricksDatabaseWidget::filterRows() { bool match; int i, j; - QProgressDialog progress("Updating...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating...", "Cancel", 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); progress.setWindowModality(Qt::WindowModal); for (i = 0; i < rowcount; i++) { + match = false; for (j = 0; j < database->columnCount(); j++) { // ignore non-text fields @@ -643,6 +647,12 @@ void cBricksDatabaseWidget::filterRows() { } database->setRowHidden(i, !match); progress.setValue(i); + + if (progress.wasCanceled()) { + resetFilter(); + break; + } + } progress.setValue(rowcount); @@ -653,7 +663,8 @@ void cBricksDatabaseWidget::resetFilter() { rowsfilterline->setText(""); int rowcount = database->rowCount(); - QProgressDialog progress("Updating...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating...", 0, 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); diff --git a/CycloBranch/gui/cCyclicWidget.cpp b/CycloBranch/gui/cCyclicWidget.cpp index 5f38f81..6b65c87 100644 --- a/CycloBranch/gui/cCyclicWidget.cpp +++ b/CycloBranch/gui/cCyclicWidget.cpp @@ -210,14 +210,14 @@ void generateCyclicLabelsToRight(bool nterminal, int rotationid, int rotationsta string name; int m; if ((visiblerotationid == -1) || ((parameters->peptidetype == cyclic) && (visiblerotationid == rotationid)) -#if POLYKETIDE_SIDEROPHORES == 1 - || ((parameters->peptidetype == cyclicpolyketide) && (visiblerotationid == rotationid)) +#if OLIGOKETIDES == 1 + || ((parameters->peptidetype == cyclicoligoketide) && (visiblerotationid == rotationid)) #endif || ((parameters->peptidetype == branchcyclic) && (visiblerotationid == rotationid/6))) { for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { if ((nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) || (!nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal) -#if POLYKETIDE_SIDEROPHORES == 1 - || (parameters->peptidetype == cyclicpolyketide) +#if OLIGOKETIDES == 1 + || (parameters->peptidetype == cyclicoligoketide) #endif ) { m = 0; @@ -225,14 +225,14 @@ void generateCyclicLabelsToRight(bool nterminal, int rotationid, int rotationsta if ((branchstart == -1) || (branchend == -1) || ((branchstart >= 0) && (j < branchstart)) || ((branchend >= 0) && (j >= branchend))) { if (theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].series[j] > 0) { name = theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.substr(0, theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.rfind('_') + 1); -#if POLYKETIDE_SIDEROPHORES == 1 - if (parameters->peptidetype == cyclicpolyketide) { +#if OLIGOKETIDES == 1 + if (parameters->peptidetype == cyclicoligoketide) { name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(0, 2) + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(2); } else { #endif name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 } #endif @@ -268,14 +268,14 @@ void generateCyclicLabelsToLeft(bool nterminal, int rotationid, int rotationstar string name; int m; if ((visiblerotationid == -1) || ((parameters->peptidetype == cyclic) && (visiblerotationid == rotationid)) -#if POLYKETIDE_SIDEROPHORES == 1 - || ((parameters->peptidetype == cyclicpolyketide) && (visiblerotationid == rotationid)) +#if OLIGOKETIDES == 1 + || ((parameters->peptidetype == cyclicoligoketide) && (visiblerotationid == rotationid)) #endif || ((parameters->peptidetype == branchcyclic) && (visiblerotationid == rotationid/6))) { for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { if ((nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal) || (!nterminal && parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal) -#if POLYKETIDE_SIDEROPHORES == 1 - || (parameters->peptidetype == cyclicpolyketide) +#if OLIGOKETIDES == 1 + || (parameters->peptidetype == cyclicoligoketide) #endif ) { m = 0; @@ -283,14 +283,14 @@ void generateCyclicLabelsToLeft(bool nterminal, int rotationid, int rotationstar if ((branchstart == -1) || (branchend == -1) || ((branchstart >= 0) && (j < branchstart)) || ((branchend >= 0) && (j >= branchend))) { if (theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].series[j] > 0) { name = theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.substr(0, theoreticalspectrum->getVisualCoverage()[rotationid*parameters->fragmentionsfortheoreticalspectra.size() + i].name.rfind('_') + 1); -#if POLYKETIDE_SIDEROPHORES == 1 - if (parameters->peptidetype == cyclicpolyketide) { +#if OLIGOKETIDES == 1 + if (parameters->peptidetype == cyclicoligoketide) { name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(0, 2) + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(2); } else { #endif name += parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 } #endif cumulativeangle = angle*(double)((2*numberofringblocks - rotationstart + numberofringblocks - m - 1) % numberofringblocks) + angle/(double)2; diff --git a/CycloBranch/gui/cDrawPeptideWidget.cpp b/CycloBranch/gui/cDrawPeptideWidget.cpp index a33802d..83d29b1 100644 --- a/CycloBranch/gui/cDrawPeptideWidget.cpp +++ b/CycloBranch/gui/cDrawPeptideWidget.cpp @@ -42,9 +42,9 @@ cDrawPeptideWidget::cDrawPeptideWidget(QWidget* parent) { peptidetypecombobox->addItem(tr("Cyclic")); peptidetypecombobox->addItem(tr("Branched")); peptidetypecombobox->addItem(tr("Branch-cyclic")); -#if POLYKETIDE_SIDEROPHORES == 1 - peptidetypecombobox->addItem(tr("Linear oligoketide siderophore")); - peptidetypecombobox->addItem(tr("Cyclic oligoketide siderophore")); +#if OLIGOKETIDES == 1 + peptidetypecombobox->addItem(tr("Linear oligoketide")); + peptidetypecombobox->addItem(tr("Cyclic oligoketide")); #endif //peptidetypecombobox->addItem(tr("Linear polysaccharide (beta version)")); //peptidetypecombobox->addItem(tr("Other")); @@ -290,15 +290,15 @@ void cDrawPeptideWidget::separateBlocksChanged(int state) { void cDrawPeptideWidget::numberOfBackboneBlocksChanged(int numberofblocks) { switch ((ePeptideType)peptidetypecombobox->currentIndex()) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif numberofblocksbackbone->setRange(1, 100); branchposition->setRange(1, 1); break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif numberofblocksbackbone->setRange(2, 100); branchposition->setRange(1, 1); @@ -371,15 +371,15 @@ void cDrawPeptideWidget::peptideTypeChanged(int index) { switch ((ePeptideType)index) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif linearwidget->show(); numberOfBackboneBlocksChanged(max(backboneblocks->count(), 1)); break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif cyclicwidget->show(); numberOfBackboneBlocksChanged(max(backboneblocks->count(), 2)); @@ -448,8 +448,8 @@ void cDrawPeptideWidget::blocksChanged() { ePeptideType peptidetype = (ePeptideType)peptidetypecombobox->currentIndex(); if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) || ((backbonecount > 1) && (peptidetype == cyclic)) -#if POLYKETIDE_SIDEROPHORES == 1 - || (peptidetype == linearpolyketide) || ((backbonecount > 1) && (peptidetype == cyclicpolyketide)) +#if OLIGOKETIDES == 1 + || (peptidetype == linearoligoketide) || ((backbonecount > 1) && (peptidetype == cyclicoligoketide)) #endif ) { for (int i = 0; i < backbonecount; i++) { @@ -589,8 +589,8 @@ void cDrawPeptideWidget::sequenceChanged() { b.explodeToIntComposition(intcomposition); if ((peptidetype == linear) || (peptidetype == linearpolysaccharide) || (peptidetype == cyclic) -#if POLYKETIDE_SIDEROPHORES == 1 - || (peptidetype == linearpolyketide) || (peptidetype == cyclicpolyketide) +#if OLIGOKETIDES == 1 + || (peptidetype == linearoligoketide) || (peptidetype == cyclicoligoketide) #endif ) { numberofblocksbackbone->setValue((int)v.size()); @@ -651,8 +651,8 @@ void cDrawPeptideWidget::drawPeptide(vector& composition, cBricksDatabas switch ((ePeptideType)peptidetypecombobox->currentIndex()) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif theoreticalspectrum.getCandidate().setCandidate(composition, netmp, 0, 0, 0, -1, -1); theoreticalspectrum.getCandidate().setAcronyms(bricksdb); @@ -660,8 +660,8 @@ void cDrawPeptideWidget::drawPeptide(vector& composition, cBricksDatabas linearwidget->repaint(); break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif theoreticalspectrum.getCandidate().setCandidate(composition, netmp, 0, 0, 0, -1, -1); theoreticalspectrum.getCandidate().setAcronyms(bricksdb); diff --git a/CycloBranch/gui/cImageWindow.cpp b/CycloBranch/gui/cImageWindow.cpp new file mode 100644 index 0000000..00e0c11 --- /dev/null +++ b/CycloBranch/gui/cImageWindow.cpp @@ -0,0 +1,95 @@ +#include "gui/cImageWindow.h" +#include "gui/cEventFilter.h" + +#include +#include +#include +#include +#include +#include + + +cImageWindow::cImageWindow(QWidget* parent) { + this->parent = parent; + + setWindowTitle("Image Window"); + setWindowIcon(QIcon(":/images/icons/23.png")); + + close = new QPushButton(tr("Close")); + close->setToolTip("Close the window."); + + loadimagebutton = new QPushButton(tr("Load Image")); + loadimagebutton->setToolTip("Load an image file."); + loadimagebutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + + image = new QImage(); + imagewindowwidget = new cImageWindowWidget(); + + buttons = new QHBoxLayout(); + buttons->addWidget(close); + buttons->addStretch(); + buttons->addWidget(loadimagebutton); + + mainlayout = new QVBoxLayout(); + mainlayout->addWidget(imagewindowwidget); + mainlayout->addLayout(buttons); + + connect(close, SIGNAL(released()), this, SLOT(closeWindow())); + connect(loadimagebutton, SIGNAL(released()), this, SLOT(loadImage())); + + setLayout(mainlayout); + + resize(1280, 700); + + lastimagedir = "./"; +} + + +cImageWindow::~cImageWindow() { + delete close; + delete loadimagebutton; + + delete image; + delete imagewindowwidget; + + delete buttons; + delete mainlayout; +} + + +void cImageWindow::closeEvent(QCloseEvent *event) { + closeWindow(); +} + + +void cImageWindow::keyPressEvent(QKeyEvent *event) { + if (event->key() == Qt::Key_Escape) { + closeWindow(); + } + + if (event->key() == Qt::Key_F1) { + #if OS_TYPE == WIN + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/imagewindow.html").absoluteFilePath())); + #else + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/imagewindow.html").absoluteFilePath())); + #endif + } +} + + +void cImageWindow::closeWindow() { + hide(); +} + + +void cImageWindow::loadImage() { + QString filename = QFileDialog::getOpenFileName(this, tr("Open Image File..."), lastimagedir, tr("Image Files (*.jpg *.jpeg *.png *.tif *.tiff *.bmp *.gif)")); + + if (!filename.isEmpty()) { + lastimagedir = filename; + + image->load(filename); + imagewindowwidget->setPixmap(image); + } +} + diff --git a/CycloBranch/gui/cImageWindow.h b/CycloBranch/gui/cImageWindow.h new file mode 100644 index 0000000..75ce8f1 --- /dev/null +++ b/CycloBranch/gui/cImageWindow.h @@ -0,0 +1,86 @@ +/** + \file cImageWindow.h + \brief Image window. +*/ + + +#ifndef _CIMAGEWINDOW_H +#define _CIMAGEWINDOW_H + +#include +#include +#include "core/utilities.h" +#include "gui/cImageWindowWidget.h" + + +// forward declaration +class QHBoxLayout; +class QVBoxLayout; +class QPushButton; +class QImage; + + +/** + \brief Image window. +*/ +class cImageWindow : public QWidget +{ + Q_OBJECT + +public: + + + /** + \brief The constructor. + \param parent pointer to a parent widget + */ + cImageWindow(QWidget* parent = (QWidget *)0); + + + /** + \brief The destructor. + */ + ~cImageWindow(); + + + /** + \brief Handle the window close event. + \param event pointer to QCloseEvent + */ + void closeEvent(QCloseEvent *event); + + +private: + + QWidget* parent; + QPushButton* close; + QPushButton* loadimagebutton; + + QImage* image; + cImageWindowWidget* imagewindowwidget; + QHBoxLayout* buttons; + QVBoxLayout* mainlayout; + + QString lastimagedir; + + +protected: + + + /** + \brief Handle a key press event. + \param event pointer to QKeyEvent + */ + void keyPressEvent(QKeyEvent *event); + + +private slots: + + + void closeWindow(); + + void loadImage(); + +}; + +#endif diff --git a/CycloBranch/gui/cImageWindowWidget.cpp b/CycloBranch/gui/cImageWindowWidget.cpp new file mode 100644 index 0000000..e399c7e --- /dev/null +++ b/CycloBranch/gui/cImageWindowWidget.cpp @@ -0,0 +1,30 @@ +#include "gui/cImageWindowWidget.h" + + +cImageWindowWidget::cImageWindowWidget(QWidget* parent) { + pixmap = new QPixmap(); +} + + +cImageWindowWidget::~cImageWindowWidget() { + delete pixmap; +} + + +void cImageWindowWidget::setPixmap(QImage* image) { + *pixmap = QPixmap::fromImage(*image); +} + + +void cImageWindowWidget::paint(QPainter& painter) { + painter.drawPixmap(0, 0, *pixmap); +} + + +void cImageWindowWidget::paintEvent(QPaintEvent *event) { + QPainter painter; + painter.begin(this); + paint(painter); + painter.end(); +} + diff --git a/CycloBranch/gui/cImageWindowWidget.h b/CycloBranch/gui/cImageWindowWidget.h new file mode 100644 index 0000000..d9b5064 --- /dev/null +++ b/CycloBranch/gui/cImageWindowWidget.h @@ -0,0 +1,66 @@ +/** + \file cImageWindowWidget.h + \brief Image window widget. +*/ + + +#ifndef _CIMAGEWINDOWWIDGET_H +#define _CIMAGEWINDOWWIDGET_H + +#include +#include +#include +#include +#include + + +/** + \brief Image window widget. +*/ +class cImageWindowWidget : public QWidget +{ + Q_OBJECT + +public: + + + /** + \brief The constructor. + \param parent pointer to a parent widget + */ + cImageWindowWidget(QWidget* parent = (QWidget *)0); + + + /** + \brief The destructor. + */ + ~cImageWindowWidget(); + + + /** + \brief Set pixmap from an image. + \param image an image + */ + void setPixmap(QImage* image); + + +private: + + QPixmap* pixmap; + + + void paint(QPainter& painter); + + +protected: + + + /** + \brief Handle the paint event. + \param event pointer to QPaintEvent + */ + void paintEvent(QPaintEvent *event); + +}; + +#endif diff --git a/CycloBranch/gui/cLinearWidget.cpp b/CycloBranch/gui/cLinearWidget.cpp index 4c116af..ac723ae 100644 --- a/CycloBranch/gui/cLinearWidget.cpp +++ b/CycloBranch/gui/cLinearWidget.cpp @@ -176,9 +176,9 @@ void cLinearWidget::paint(QPainter& painter) { int len = (int)theoreticalspectrum->getVisualCoverage()[0].series.size(); for (int i = 0; i < (int)parameters->fragmentionsfortheoreticalspectra.size(); i++) { -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 if (((parameters->peptidetype == linear) && (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].nterminal)) || - ((parameters->peptidetype == linearpolyketide) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2h_ion) + ((parameters->peptidetype == linearoligoketide) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == l2oh_ion)))) { #else @@ -186,23 +186,23 @@ void cLinearWidget::paint(QPainter& painter) { #endif for (int j = 0; j < len; j++) { if (theoreticalspectrum->getVisualCoverage()[i].series[j] > 0) { -#if POLYKETIDE_SIDEROPHORES == 1 - if (parameters->peptidetype == linearpolyketide) { +#if OLIGOKETIDES == 1 + if (parameters->peptidetype == linearoligoketide) { name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(0, 2) + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(2); } else { #endif name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(j + 1) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 } #endif insertLabel(labels, leftmargin + horizontalstep/4 + horizontalstep/8 + horizontalstep*j + horizontalstep/2, topmargin - 35, name, false); } } } -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 if (((parameters->peptidetype == linear) && (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].cterminal)) || - ((parameters->peptidetype == linearpolyketide) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2h_ion) + ((parameters->peptidetype == linearoligoketide) && ((parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2h_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r1oh_ion) || (parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].parent == r2oh_ion)))) { #else @@ -210,14 +210,14 @@ void cLinearWidget::paint(QPainter& painter) { #endif for (int j = len - 1; j >= 0; j--) { if (theoreticalspectrum->getVisualCoverage()[i].series[len - j - 1] > 0) { -#if POLYKETIDE_SIDEROPHORES == 1 - if (parameters->peptidetype == linearpolyketide) { +#if OLIGOKETIDES == 1 + if (parameters->peptidetype == linearoligoketide) { name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(0, 2) + to_string(len - j) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(2); } else { #endif name = parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name[0] + to_string(len - j) + parameters->fragmentdefinitions[parameters->fragmentionsfortheoreticalspectra[i]].name.substr(1); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 } #endif insertLabel(labels, leftmargin + horizontalstep*(j + 1), topmargin + 35, name, false); diff --git a/CycloBranch/gui/cMainThread.cpp b/CycloBranch/gui/cMainThread.cpp index acd93a2..c1011c9 100644 --- a/CycloBranch/gui/cMainThread.cpp +++ b/CycloBranch/gui/cMainThread.cpp @@ -8,14 +8,14 @@ bool cMainThread::checkModifications(cParameters& parameters, cSequence& sequenc errormessage = ""; if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == branchcyclic) || (sequence.getPeptideType() == linearpolysaccharide) -#if POLYKETIDE_SIDEROPHORES == 1 - || (sequence.getPeptideType() == linearpolyketide) +#if OLIGOKETIDES == 1 + || (sequence.getPeptideType() == linearoligoketide) #endif ) { if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == linearpolysaccharide) -#if POLYKETIDE_SIDEROPHORES == 1 - || (sequence.getPeptideType() == linearpolyketide) +#if OLIGOKETIDES == 1 + || (sequence.getPeptideType() == linearoligoketide) #endif ) { startmodifid = -1; @@ -29,8 +29,8 @@ bool cMainThread::checkModifications(cParameters& parameters, cSequence& sequenc for (int i = 0; i < (int)parameters.searchedmodifications.size(); i++) { if ((sequence.getPeptideType() == linear) || (sequence.getPeptideType() == branched) || (sequence.getPeptideType() == linearpolysaccharide) -#if POLYKETIDE_SIDEROPHORES == 1 - || (sequence.getPeptideType() == linearpolyketide) +#if OLIGOKETIDES == 1 + || (sequence.getPeptideType() == linearoligoketide) #endif ) { if (parameters.searchedmodifications[i].name.compare(sequence.getNTterminalModification()) == 0) { @@ -384,12 +384,12 @@ void cMainThread::run() { // set candidate c.setCandidate(v, netmp, startmodifid, endmodifid, middlemodifid, branchstart, branchend); -#if POLYKETIDE_SIDEROPHORES == 1 +#if OLIGOKETIDES == 1 - if (!calculatesummaries && ((parameters.sequencedatabase[i].getPeptideType() == linearpolyketide) || (parameters.sequencedatabase[i].getPeptideType() == cyclicpolyketide))) { + if (!calculatesummaries && ((parameters.sequencedatabase[i].getPeptideType() == linearoligoketide) || (parameters.sequencedatabase[i].getPeptideType() == cyclicoligoketide))) { - if (!c.checkPolyketideSequence(parameters.bricksdatabase, parameters.sequencedatabase[i].getPeptideType())) { - if (parameters.sequencedatabase[i].getPeptideType() == linearpolyketide) { + if (!c.checkKetideSequence(parameters.bricksdatabase, parameters.sequencedatabase[i].getPeptideType())) { + if (parameters.sequencedatabase[i].getPeptideType() == linearoligoketide) { *os << "Ignored sequence: " << parameters.sequencedatabase[i].getName() << " " << parameters.sequencedatabase[i].getSequence() << "; the order of building blocks is not correct." << endl; } else { @@ -401,10 +401,10 @@ void cMainThread::run() { eResidueLossType leftresiduelosstype = c.getLeftResidueType(parameters.bricksdatabase); eResidueLossType rightresiduelosstype = c.getRightResidueType(parameters.bricksdatabase); - if (((leftresiduelosstype == h2) && (c.getStartModifID() > 0) && parameters.searchedmodifications[c.getStartModifID()].cterminal) - || ((leftresiduelosstype == h2o2) && (c.getStartModifID() > 0) && parameters.searchedmodifications[c.getStartModifID()].nterminal) - || ((rightresiduelosstype == h2) && (c.getEndModifID() > 0) && parameters.searchedmodifications[c.getEndModifID()].cterminal) - || ((rightresiduelosstype == h2o2) && (c.getEndModifID() > 0) && parameters.searchedmodifications[c.getEndModifID()].nterminal)) { + if (((leftresiduelosstype == h2_loss) && (c.getStartModifID() > 0) && parameters.searchedmodifications[c.getStartModifID()].cterminal) + || ((leftresiduelosstype == h2o_loss) && (c.getStartModifID() > 0) && parameters.searchedmodifications[c.getStartModifID()].nterminal) + || ((rightresiduelosstype == h2_loss) && (c.getEndModifID() > 0) && parameters.searchedmodifications[c.getEndModifID()].cterminal) + || ((rightresiduelosstype == h2o_loss) && (c.getEndModifID() > 0) && parameters.searchedmodifications[c.getEndModifID()].nterminal)) { *os << "Ignored sequence: " << parameters.sequencedatabase[i].getName() << " " << parameters.sequencedatabase[i].getSequence() << "; the N-terminal modification is attached to C-terminus or vice versa." << endl; continue; } diff --git a/CycloBranch/gui/cMainWindow.cpp b/CycloBranch/gui/cMainWindow.cpp index 63c15a9..6fb5f36 100644 --- a/CycloBranch/gui/cMainWindow.cpp +++ b/CycloBranch/gui/cMainWindow.cpp @@ -90,6 +90,13 @@ cMainWindow::cMainWindow() { actionGraph = new QAction(QIcon(":/images/icons/32.png"), tr("De Novo &Graph"), this); actionGraph->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G)); + actionSummaryTableOfMatchedPeaks = new QAction(QIcon(":/images/icons/43.png"), tr("S&ummary Table of Matched Peaks"), this); + actionSummaryTableOfMatchedPeaks->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); + + actionImageWindow = new QAction(QIcon(":/images/icons/23.png"), tr("Image &Window"), this); + actionImageWindow->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W)); + actionImageWindow->setDisabled(true); + actionLog = new QAction(QIcon(":/images/icons/2.png"), tr("&Log Window"), this); actionLog->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); actionLog->setCheckable(true); @@ -130,6 +137,8 @@ cMainWindow::cMainWindow() { toolbarView = addToolBar(tr("View")); toolbarView->addAction(actionShowIsomers); toolbarView->addAction(actionGraph); + toolbarView->addAction(actionSummaryTableOfMatchedPeaks); + toolbarView->addAction(actionImageWindow); toolbarView->addAction(actionLog); toolbarHelp = addToolBar(tr("Help")); @@ -148,8 +157,8 @@ cMainWindow::cMainWindow() { rowsfilterbutton->setToolTip("Filter Search Results"); rowsfilterbutton->setMinimumWidth(50); - rowsfilterclearbutton = new QPushButton("Clear"); - rowsfilterclearbutton->setToolTip("Clear Form and Reset Search Results"); + rowsfilterclearbutton = new QPushButton("Reset"); + rowsfilterclearbutton->setToolTip("Reset Search Results"); rowsfilterclearbutton->setMinimumWidth(50); rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); @@ -182,6 +191,8 @@ cMainWindow::cMainWindow() { sequencedatabasewidget = new cSequenceDatabaseWidget(this); modificationswidget = new cModificationsWidget(); drawpeptidewidget = new cDrawPeptideWidget(this); + summarytableofmatchedpeaks = new cSummaryPeaksTableWidget(this); + imagewindow = new cImageWindow(this); parameterswidget = new cParametersWidget(this); htmlexportdialog = new cHTMLExportDialog(this); @@ -206,6 +217,8 @@ cMainWindow::cMainWindow() { connect(actionSmilesToMonomers, SIGNAL(triggered()), this, SLOT(gotoSmiles2Monomers())); connect(actionShowIsomers, SIGNAL(triggered()), this, SLOT(updateSpectra())); connect(actionGraph, SIGNAL(triggered()), this, SLOT(showGraph())); + connect(actionSummaryTableOfMatchedPeaks, SIGNAL(triggered()), this, SLOT(showSummaryTableOfMatchedPeaks())); + connect(actionImageWindow, SIGNAL(triggered()), this, SLOT(showImageWindow())); connect(actionLog, SIGNAL(triggered()), this, SLOT(showHideLog())); connect(actionHTMLDocumentation, SIGNAL(triggered()), this, SLOT(showHTMLDocumentation())); connect(actionPDFManual, SIGNAL(triggered()), this, SLOT(showPDFManual())); @@ -214,6 +227,8 @@ cMainWindow::cMainWindow() { connect(rowsfilterbutton, SIGNAL(released()), this, SLOT(filterResults())); connect(rowsfilterclearbutton, SIGNAL(released()), this, SLOT(resetFilter())); + connect(summarytableofmatchedpeaks, SIGNAL(tableCancelled()), this, SLOT(summaryPeaksTableCancelled())); + // add subitems to the items in main menu // menuFile->addAction(actionOpen); menuFile->addAction(actionOpenResults); @@ -236,8 +251,11 @@ cMainWindow::cMainWindow() { menuTools->addAction(actionNorine); menuTools->addAction(actionSmilesToMonomers); menuView->addAction(actionShowIsomers); - menuView->addSeparator(); menuView->addAction(actionGraph); + menuView->addSeparator(); + menuView->addAction(actionSummaryTableOfMatchedPeaks); + menuView->addAction(actionImageWindow); + menuView->addSeparator(); menuView->addAction(actionLog); menuHelp->addAction(actionHTMLDocumentation); menuHelp->addAction(actionPDFManual); @@ -268,6 +286,8 @@ cMainWindow::cMainWindow() { sequencedatabasewidget->hide(); modificationswidget->hide(); drawpeptidewidget->hide(); + summarytableofmatchedpeaks->hide(); + imagewindow->hide(); parameterswidget->hide(); splitter->setOrientation(Qt::Vertical); @@ -293,6 +313,8 @@ cMainWindow::cMainWindow() { lastdirsaveresults = "./"; lastdiropenresults = "./"; + summarytableisprepared = false; + quitapp = false; } @@ -317,6 +339,8 @@ cMainWindow::~cMainWindow() { delete sequencedatabasewidget; delete modificationswidget; delete drawpeptidewidget; + delete summarytableofmatchedpeaks; + delete imagewindow; delete parameterswidget; delete htmlexportdialog; @@ -335,6 +359,8 @@ cMainWindow::~cMainWindow() { delete actionSmilesToMonomers; delete actionShowIsomers; delete actionGraph; + delete actionSummaryTableOfMatchedPeaks; + delete actionImageWindow; delete actionLog; delete actionHTMLDocumentation; delete actionPDFManual; @@ -443,8 +469,8 @@ void cMainWindow::reportSpectrum(int id, cTheoreticalSpectrum& theoreticalspectr switch (parameters.peptidetype) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif case linearpolysaccharide: results->setItem(row, 6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); @@ -461,8 +487,8 @@ void cMainWindow::reportSpectrum(int id, cTheoreticalSpectrum& theoreticalspectr results->item(row, 8 + dbsearchspecificcolumncount)->setText(parameters.searchedmodifications[theoreticalspectrum.getCandidate().getEndModifID()].name.c_str()); break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif results->setItem(row, 6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->item(row, 6 + dbsearchspecificcolumncount)->setData(Qt::DisplayRole, theoreticalspectrum.getNumberOfMatchedBricks()); @@ -583,6 +609,24 @@ void cMainWindow::setAndShowDrawPeptideWidget(int peptidetypeindex, QString sequ } +void cMainWindow::showSummaryTableOfMatchedPeaks() { + summarytableofmatchedpeaks->show(); + summarytableofmatchedpeaks->activateWindow(); + if (!summarytableisprepared) { + summarytableisprepared = true; + rowsfilterwidget->setEnabled(false); + summarytableofmatchedpeaks->prepareToShow(results, ¶meters, &theoreticalspectrumlist); + rowsfilterwidget->setEnabled(true); + } +} + + +void cMainWindow::showImageWindow() { + imagewindow->show(); + imagewindow->activateWindow(); +} + + void cMainWindow::showGraph() { graph->show(); graph->activateWindow(); @@ -607,7 +651,31 @@ void cMainWindow::run() { theoreticalspectrumlist.clear(); spectradetails.clear(); - cMainThread* thread = new cMainThread(parameterswidget->getParameters(), theoreticalspectrumlist, true, false); + cParameters localparameters = parameterswidget->getParameters(); + + regex rx; + rx = "\\.[iI][mM][zZ][mM][lL]$"; + if (regex_search(localparameters.peaklistfilename, rx)) { + string convertedimzml = localparameters.peaklistfilename.substr(0, (int)localparameters.peaklistfilename.size() - 6); + string convertedibd = convertedimzml; + convertedimzml += "_converted.imzML"; + convertedibd += "_converted.ibd"; + + if (QFile::exists(convertedimzml.c_str()) && QFile::exists(convertedibd.c_str())) { + QMessageBox::StandardButton reply; + string s = "The converted imzML file '" + convertedimzml.substr(convertedimzml.rfind('/') + 1) + "' has been found.\n\nDo you want to proceed with this file instead of the original imzML file '"; + s += localparameters.peaklistfilename.substr(localparameters.peaklistfilename.rfind('/') + 1) + "' ?"; + s += "\n\nClick 'Yes' to proceed the converted file.\nClick 'No' to convert the original file again. Note: The conversion may be time-consuming."; + + reply = QMessageBox::question(this, "Do you want to proceed the converted file ?", s.c_str(), QMessageBox::Yes|QMessageBox::No); + + if (reply == QMessageBox::Yes) { + localparameters.peaklistfilename = convertedimzml; + } + } + } + + cMainThread* thread = new cMainThread(localparameters, theoreticalspectrumlist, true, false); connect(thread, SIGNAL(message(QString)), this, SLOT(updateLog(QString))); connect(thread, SIGNAL(enableRunButtonAndSettings(bool)), this, SLOT(enableRunButtonAndSettings(bool))); connect(thread, SIGNAL(enableStopButton(bool)), this, SLOT(enableStopButton(bool))); @@ -617,6 +685,10 @@ void cMainWindow::run() { connect(thread, SIGNAL(setGraph(string)), this, SLOT(setGraph(string))); connect(this, SIGNAL(stopComputation()), thread, SLOT(stopComputation())); + summarytableofmatchedpeaks->deleteTable(true); + summarytableofmatchedpeaks->hide(); + summarytableisprepared = false; + thread->start(); } @@ -660,13 +732,14 @@ void cMainWindow::enableButtonsHandlingResults(bool enable) { actionExportToCsv->setEnabled(enable); actionExportToHTML->setEnabled(enable); rowsfilterwidget->setEnabled(enable); + actionSummaryTableOfMatchedPeaks->setEnabled(enable); if (parameters.mode == dereplication) { actionShowIsomers->setEnabled(false); } else { actionShowIsomers->setEnabled(enable); - } + } } @@ -684,8 +757,8 @@ void cMainWindow::reportSpectra() { switch (parameters.peptidetype) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif case linearpolysaccharide: resultsspecificcolumncount = 2; @@ -694,8 +767,8 @@ void cMainWindow::reportSpectra() { resultsspecificcolumncount = 3; break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif resultsspecificcolumncount = 1; break; @@ -766,8 +839,8 @@ void cMainWindow::reportSpectra() { results->horizontalHeaderItem(8 + dbsearchspecificcolumncount)->setText("C-terminal Modification"); break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif results->setHorizontalHeaderItem(6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(6 + dbsearchspecificcolumncount)->setText("Matched Bricks"); @@ -776,8 +849,8 @@ void cMainWindow::reportSpectra() { results->setHorizontalHeaderItem(6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(6 + dbsearchspecificcolumncount)->setText("Branch Modification"); break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: results->setHorizontalHeaderItem(6 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); results->horizontalHeaderItem(6 + dbsearchspecificcolumncount)->setText("Left Terminal Modification"); results->setHorizontalHeaderItem(7 + dbsearchspecificcolumncount, widgetitemallocator.getNewItem()); @@ -856,6 +929,7 @@ void cMainWindow::reportSpectra() { } QProgressDialog progress("Preparing the report...", /*"Cancel"*/0, 0, theoreticalspectrumlist.size(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -888,7 +962,8 @@ void cMainWindow::updateSpectra() { bool reportisomers = actionShowIsomers->isChecked(); string peptidesequence; - QProgressDialog progress("Updating the report...", /*"Cancel"*/0, 0, theoreticalspectrumlist.size(), this); + QProgressDialog progress("Updating the report...", 0, 0, theoreticalspectrumlist.size(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -899,9 +974,6 @@ void cMainWindow::updateSpectra() { results->item(i, 2 + dbsearchspecificcolumncount)->setText(peptidesequence.c_str()); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} } for (int i = 0; i < results->columnCount(); i++) { @@ -958,12 +1030,14 @@ void cMainWindow::exportToCsv() { if (!filename.isEmpty()) { lastdirexporttocsv = filename; - QProgressDialog progress("Exporting CSV file...", /*"Cancel"*/0, 0, results->rowCount(), this); + QProgressDialog progress("Exporting CSV file...", "Cancel", 0, results->rowCount(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); progress.setWindowModality(Qt::WindowModal); + bool removefile = false; QFile file(filename); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { return; @@ -994,16 +1068,20 @@ void cMainWindow::exportToCsv() { out << endl; progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} + if (progress.wasCanceled()) { + removefile = true; + break; + } } file.close(); + if (removefile) { + file.remove(); + } + progress.setValue(results->rowCount()); } - } @@ -1018,12 +1096,14 @@ void cMainWindow::exportToHTML() { if (!filename.isEmpty()) { lastdirexporttohtml = filename; - QProgressDialog progress("Exporting HTML report...", /*"Cancel"*/0, 0, results->rowCount(), this); + QProgressDialog progress("Exporting HTML report...", "Cancel", 0, results->rowCount(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); progress.setWindowModality(Qt::WindowModal); + bool removefile = false; QFile file(filename); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { return; @@ -1215,9 +1295,10 @@ void cMainWindow::exportToHTML() { out << "

\n"; progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} + if (progress.wasCanceled()) { + removefile = true; + break; + } } } @@ -1229,6 +1310,10 @@ void cMainWindow::exportToHTML() { file.close(); + if (removefile) { + file.remove(); + } + progress.setValue(results->rowCount()); } @@ -1267,12 +1352,14 @@ void cMainWindow::saveResultsFile() { if (!filename.isEmpty()) { lastdirsaveresults = filename; - QProgressDialog progress("Saving the report...", /*"Cancel"*/0, 0, theoreticalspectrumlist.size(), this); + QProgressDialog progress("Saving the report...", "Cancel", 0, theoreticalspectrumlist.size(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); progress.setWindowModality(Qt::WindowModal); + bool removefile = false; ofstream outfile; outfile.open(filename.toStdString().c_str(), ios::out | ios::binary | ios::trunc); @@ -1302,13 +1389,18 @@ void cMainWindow::saveResultsFile() { for (int i = 0; i < theoreticalspectrumlist.size(); i++) { theoreticalspectrumlist[i].store(outfile); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} + if (progress.wasCanceled()) { + removefile = true; + break; + } } // close file outfile.close(); + + if (removefile) { + QFile::remove(filename); + } } progress.setValue(theoreticalspectrumlist.size()); @@ -1357,6 +1449,10 @@ void cMainWindow::openResultsFile() { } deleteResults(); + + summarytableofmatchedpeaks->deleteTable(true); + summarytableofmatchedpeaks->hide(); + summarytableisprepared = false; theoreticalspectrumlist.clear(); spectradetails.clear(); @@ -1386,7 +1482,8 @@ void cMainWindow::openResultsFile() { // load theoretical spectra infile.read((char *)&size, sizeof(int)); - QProgressDialog progress("Loading the report...", /*"Cancel"*/0, 0, size, this); + QProgressDialog progress("Loading the report...", 0, 0, size, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -1396,9 +1493,6 @@ void cMainWindow::openResultsFile() { theoreticalspectrum.load(infile); theoreticalspectrumlist.add(theoreticalspectrum); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} } progress.setValue(size); @@ -1450,13 +1544,18 @@ void cMainWindow::quitApplication() { void cMainWindow::filterResults() { + summarytableofmatchedpeaks->deleteTable(true); + summarytableofmatchedpeaks->hide(); + summarytableisprepared = false; + Qt::CaseSensitivity casesensitive = rowsfiltercasesensitive->isChecked()?Qt::CaseSensitive:Qt::CaseInsensitive; QString str = rowsfilterline->text(); int rowcount = results->rowCount(); bool match; int i, j; - QProgressDialog progress("Updating the report...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating the report...", "Cancel", 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -1472,6 +1571,12 @@ void cMainWindow::filterResults() { } results->setRowHidden(i, !match); progress.setValue(i); + + if (progress.wasCanceled()) { + resetFilter(); + break; + } + } progress.setValue(rowcount); @@ -1479,10 +1584,15 @@ void cMainWindow::filterResults() { void cMainWindow::resetFilter() { + summarytableofmatchedpeaks->deleteTable(true); + summarytableofmatchedpeaks->hide(); + summarytableisprepared = false; + rowsfilterline->setText(""); int rowcount = results->rowCount(); - QProgressDialog progress("Updating the report...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating the report...", 0, 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -1507,6 +1617,10 @@ void cMainWindow::gotoSmiles2Monomers() { } +void cMainWindow::summaryPeaksTableCancelled() { + summarytableisprepared = false; +} + /* void cMainWindow::showContextMenu(const QPoint &pt) { QMenu *menu = logWindow->createStandardContextMenu(); diff --git a/CycloBranch/gui/cMainWindow.h b/CycloBranch/gui/cMainWindow.h index 503cac3..094afcd 100644 --- a/CycloBranch/gui/cMainWindow.h +++ b/CycloBranch/gui/cMainWindow.h @@ -11,6 +11,7 @@ #include #include #include +#include #include "core/utilities.h" #include "core/cAllocator.h" #include "core/cTheoreticalSpectrum.h" @@ -22,9 +23,11 @@ #include "gui/cSequenceDatabaseWidget.h" #include "gui/cModificationsWidget.h" #include "gui/cDrawPeptideWidget.h" +#include "gui/cSummaryPeaksTableWidget.h" #include "gui/cMainThread.h" #include "gui/cDelegate.h" #include "gui/cHTMLExportDialog.h" +#include "gui/cImageWindow.h" // forward declaration @@ -101,6 +104,8 @@ class cMainWindow : public QMainWindow QAction *actionSmilesToMonomers; QAction* actionShowIsomers; QAction* actionGraph; + QAction* actionSummaryTableOfMatchedPeaks; + QAction* actionImageWindow; QAction* actionLog; QAction* actionHTMLDocumentation; QAction* actionPDFManual; @@ -128,6 +133,8 @@ class cMainWindow : public QMainWindow cSequenceDatabaseWidget* sequencedatabasewidget; cModificationsWidget* modificationswidget; cDrawPeptideWidget* drawpeptidewidget; + cSummaryPeaksTableWidget* summarytableofmatchedpeaks; + cImageWindow* imagewindow; cParametersWidget* parameterswidget; cHTMLExportDialog* htmlexportdialog; @@ -143,6 +150,8 @@ class cMainWindow : public QMainWindow QString lastdirsaveresults; QString lastdiropenresults; + bool summarytableisprepared; + cAllocator widgetitemallocator; bool quitapp; @@ -171,6 +180,10 @@ private slots: void showDrawPeptideWidget(); void setAndShowDrawPeptideWidget(int peptidetypeindex, QString sequence); + + void showSummaryTableOfMatchedPeaks(); + + void showImageWindow(); void showGraph(); @@ -228,6 +241,8 @@ private slots: void gotoSmiles2Monomers(); + void summaryPeaksTableCancelled(); + //void showContextMenu(const QPoint &pt); signals: diff --git a/CycloBranch/gui/cModificationsWidget.cpp b/CycloBranch/gui/cModificationsWidget.cpp index 2581d28..f3fcdbd 100644 --- a/CycloBranch/gui/cModificationsWidget.cpp +++ b/CycloBranch/gui/cModificationsWidget.cpp @@ -56,8 +56,8 @@ cModificationsWidget::cModificationsWidget(QWidget* parent) { rowsfilterbutton->setToolTip("Filter Search Results"); rowsfilterbutton->setMinimumWidth(50); - rowsfilterclearbutton = new QPushButton("Clear"); - rowsfilterclearbutton->setToolTip("Clear Form and Reset Search Results"); + rowsfilterclearbutton = new QPushButton("Reset"); + rowsfilterclearbutton->setToolTip("Reset Search Results"); rowsfilterclearbutton->setMinimumWidth(50); rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); @@ -178,7 +178,8 @@ void cModificationsWidget::deleteTable(bool enableprogress) { int rowcount = database->rowCount(); if (enableprogress) { - progress = new QProgressDialog("Clearing the table...", /*"Cancel"*/0, 0, rowcount, this); + progress = new QProgressDialog("Clearing the table...", 0, 0, rowcount, this); + progress->setMinimumWidth(250); progress->installEventFilter(&filter); progress->setMinimumDuration(0); progress->setWindowModality(Qt::WindowModal); @@ -193,9 +194,6 @@ void cModificationsWidget::deleteTable(bool enableprogress) { if (enableprogress) { progress->setValue(i); - //if (progress->wasCanceled()) { - // break; - //} } } @@ -345,7 +343,8 @@ void cModificationsWidget::loadDatabase() { deleteTable(true); - QProgressDialog progress("Loading Modifications...", /*"Cancel"*/0, 0, (int)modifications.size(), this); + QProgressDialog progress("Loading Modifications...", "Cancel", 0, (int)modifications.size(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -380,9 +379,13 @@ void cModificationsWidget::loadDatabase() { database->setCellWidget(i, 5, checkbox); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} + if (progress.wasCanceled()) { + deleteTable(true); + modifications.clear(); + databasefile = ""; + save->setText(" Save "); + break; + } } for (int i = 0; i < database->columnCount(); i++) { @@ -420,7 +423,8 @@ bool cModificationsWidget::saveDatabase() { } else { - QProgressDialog progress("Saving Modifications...", /*"Cancel"*/0, 0, database->rowCount(), this); + QProgressDialog progress("Saving Modifications...", 0, 0, database->rowCount(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -467,9 +471,6 @@ bool cModificationsWidget::saveDatabase() { modifications.push_back(modification); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} } storeModificationsToPlainTextStream(outputstream, modifications); @@ -580,13 +581,15 @@ void cModificationsWidget::filterRows() { bool match; int i, j; - QProgressDialog progress("Updating...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating...", "Cancel", 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); progress.setWindowModality(Qt::WindowModal); for (i = 0; i < rowcount; i++) { + match = false; for (j = 0; j < database->columnCount(); j++) { // ignore non-text fields @@ -601,6 +604,12 @@ void cModificationsWidget::filterRows() { } database->setRowHidden(i, !match); progress.setValue(i); + + if (progress.wasCanceled()) { + resetFilter(); + break; + } + } progress.setValue(rowcount); @@ -611,7 +620,8 @@ void cModificationsWidget::resetFilter() { rowsfilterline->setText(""); int rowcount = database->rowCount(); - QProgressDialog progress("Updating...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating...", 0, 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); diff --git a/CycloBranch/gui/cParametersWidget.cpp b/CycloBranch/gui/cParametersWidget.cpp index 9a95e53..3182e65 100644 --- a/CycloBranch/gui/cParametersWidget.cpp +++ b/CycloBranch/gui/cParametersWidget.cpp @@ -63,9 +63,9 @@ cParametersWidget::cParametersWidget(QWidget* parent) { peptidetype->addItem(tr("Cyclic")); peptidetype->addItem(tr("Branched")); peptidetype->addItem(tr("Branch-cyclic")); -#if POLYKETIDE_SIDEROPHORES == 1 - peptidetype->addItem(tr("Linear oligoketide siderophore")); - peptidetype->addItem(tr("Cyclic oligoketide siderophore")); +#if OLIGOKETIDES == 1 + peptidetype->addItem(tr("Linear oligoketide")); + peptidetype->addItem(tr("Cyclic oligoketide")); #endif peptidetype->addItem(tr("Linear polysaccharide (beta version)")); //peptidetype->addItem(tr("Other")); @@ -666,7 +666,7 @@ void cParametersWidget::peaklistButtonReleased() { #if OS_TYPE != WIN QString filename = QFileDialog::getOpenFileName(this, tr("Select Peaklist..."), lastdirselectpeaklist, tr("Peak Lists (*.txt *.mgf *.mzML *.mzXML *.imzML)")); #else - QString filename = QFileDialog::getOpenFileName(this, tr("Select Peaklist..."), lastdirselectpeaklist, tr("Peak Lists (*.txt *.mgf *.mzML *.mzXML *.baf *.mis *.imzML)")); + QString filename = QFileDialog::getOpenFileName(this, tr("Select Peaklist..."), lastdirselectpeaklist, tr("Peak Lists (*.txt *.mgf *.mzML *.mzXML *.baf *.imzML *.mis)")); #endif if (!filename.isEmpty()) { @@ -796,12 +796,12 @@ bool cParametersWidget::updateParameters() { case branchcyclic: start = a_ion; break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: start = l1h_ion; break; - case cyclicpolyketide: - start = l0h_ion; + case cyclicoligoketide: + start = l1h_ion; // l0h_ion; break; #endif case linearpolysaccharide: @@ -888,12 +888,12 @@ void cParametersWidget::restoreParameters() { case branchcyclic: start = a_ion; break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: start = l1h_ion; break; - case cyclicpolyketide: - start = l0h_ion; + case cyclicoligoketide: + start = l1h_ion; // l0h_ion; break; #endif case linearpolysaccharide: @@ -974,8 +974,8 @@ void cParametersWidget::updateSettingsWhenPeptideTypeChanged(int index) { searchedsequenceCtermmodif->setDisabled(true); searchedsequenceTmodif->setDisabled(false); break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: modificationsline->setDisabled(false); modificationsbutton->setDisabled(false); cyclicnterminus->setDisabled(true); @@ -985,7 +985,7 @@ void cParametersWidget::updateSettingsWhenPeptideTypeChanged(int index) { searchedsequenceCtermmodif->setDisabled(false); searchedsequenceTmodif->setDisabled(true); break; - case cyclicpolyketide: + case cyclicoligoketide: modificationsline->setDisabled(true); modificationsbutton->setDisabled(true); cyclicnterminus->setDisabled(true); @@ -1176,13 +1176,13 @@ void cParametersWidget::resetFragmentIonTypes() { start = a_ion; end = z_ion_dehydrated_and_deamidated; break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: start = l1h_ion; end = r2oh_ion_co_loss_dehydrated_and_deamidated; break; - case cyclicpolyketide: - start = l0h_ion; + case cyclicoligoketide: + start = l1h_ion; // l0h_ion; end = l2h_ion_co_loss_dehydrated_and_deamidated; break; #endif @@ -1223,16 +1223,16 @@ void cParametersWidget::resetFragmentIonTypes() { fragmentiontypes->getList()->item(i-start)->setSelected(true); } break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: if (((eFragmentIonType)i == l1h_ion) || ((eFragmentIonType)i == l2h_ion) || ((eFragmentIonType)i == r1h_ion) || ((eFragmentIonType)i == r2h_ion) || ((eFragmentIonType)i == l1oh_ion) || ((eFragmentIonType)i == l2oh_ion) || ((eFragmentIonType)i == r1oh_ion) || ((eFragmentIonType)i == r2oh_ion) ) { fragmentiontypes->getList()->item(i-start)->setSelected(true); } break; - case cyclicpolyketide: - if (((eFragmentIonType)i == l0h_ion) || ((eFragmentIonType)i == l1h_ion) || ((eFragmentIonType)i == l2h_ion)) { + case cyclicoligoketide: + if (/*((eFragmentIonType)i == l0h_ion) ||*/ ((eFragmentIonType)i == l1h_ion) || ((eFragmentIonType)i == l2h_ion)) { fragmentiontypes->getList()->item(i-start)->setSelected(true); } break; diff --git a/CycloBranch/gui/cSequenceDatabaseWidget.cpp b/CycloBranch/gui/cSequenceDatabaseWidget.cpp index 5760ddb..b6ce155 100644 --- a/CycloBranch/gui/cSequenceDatabaseWidget.cpp +++ b/CycloBranch/gui/cSequenceDatabaseWidget.cpp @@ -58,8 +58,8 @@ cSequenceDatabaseWidget::cSequenceDatabaseWidget(QWidget* parent) { rowsfilterbutton->setToolTip("Filter Search Results"); rowsfilterbutton->setMinimumWidth(50); - rowsfilterclearbutton = new QPushButton("Clear"); - rowsfilterclearbutton->setToolTip("Clear Form and Reset Search Results"); + rowsfilterclearbutton = new QPushButton("Reset"); + rowsfilterclearbutton->setToolTip("Reset Search Results"); rowsfilterclearbutton->setMinimumWidth(50); rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); @@ -145,7 +145,7 @@ cSequenceDatabaseWidget::cSequenceDatabaseWidget(QWidget* parent) { } -cSequenceDatabaseWidget::~cSequenceDatabaseWidget() { +cSequenceDatabaseWidget::~cSequenceDatabaseWidget() { deleteTable(false); for (int i = 0; i < database->columnCount(); i++) { @@ -196,7 +196,8 @@ void cSequenceDatabaseWidget::deleteTable(bool enableprogress) { int rowcount = database->rowCount(); if (enableprogress) { - progress = new QProgressDialog("Clearing the table...", /*"Cancel"*/0, 0, rowcount, this); + progress = new QProgressDialog("Clearing the table...", 0, 0, rowcount, this); + progress->setMinimumWidth(250); progress->installEventFilter(&filter); progress->setMinimumDuration(0); progress->setWindowModality(Qt::WindowModal); @@ -212,9 +213,6 @@ void cSequenceDatabaseWidget::deleteTable(bool enableprogress) { if (enableprogress) { progress->setValue(i); - //if (progress->wasCanceled()) { - // break; - //} } } @@ -293,14 +291,14 @@ bool cSequenceDatabaseWidget::checkSequence(int row) { { case linear: case linearpolysaccharide: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])*$"; break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif rx = "^\\[[^\\[\\]]+\\](-\\[[^\\[\\]]+\\])+$"; break; @@ -439,7 +437,8 @@ void cSequenceDatabaseWidget::loadDatabase() { sequences.clear(); sequences.loadFromPlainTextStream(inputstream); - QProgressDialog progress("Loading the Sequence Databatase...", /*"Cancel"*/0, 0, sequences.size(), this); + QProgressDialog progress("Loading the Sequence Database...", "Cancel", 0, sequences.size(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -490,9 +489,13 @@ void cSequenceDatabaseWidget::loadDatabase() { ((QLabel *)database->cellWidget(i, 10))->setOpenExternalLinks(true); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} + if (progress.wasCanceled()) { + deleteTable(true); + sequences.clear(); + databasefile = ""; + save->setText(" Save "); + break; + } } for (int i = 0; i < database->columnCount(); i++) { @@ -530,7 +533,8 @@ bool cSequenceDatabaseWidget::saveDatabase() { } else { - QProgressDialog progress("Saving the Sequence Databatase...", /*"Cancel"*/0, 0, database->rowCount(), this); + QProgressDialog progress("Saving the Sequence Database...", 0, 0, database->rowCount(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -597,9 +601,6 @@ bool cSequenceDatabaseWidget::saveDatabase() { sequences.push_back(seq); progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} } sequences.storeToPlainTextStream(outputstream); @@ -731,13 +732,15 @@ void cSequenceDatabaseWidget::filterRows() { bool match; int i, j; - QProgressDialog progress("Updating...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating...", "Cancel", 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); progress.setWindowModality(Qt::WindowModal); for (i = 0; i < rowcount; i++) { + match = false; for (j = 0; j < database->columnCount(); j++) { // ignore non-text fields @@ -752,6 +755,12 @@ void cSequenceDatabaseWidget::filterRows() { } database->setRowHidden(i, !match); progress.setValue(i); + + if (progress.wasCanceled()) { + resetFilter(); + break; + } + } progress.setValue(rowcount); @@ -762,7 +771,8 @@ void cSequenceDatabaseWidget::resetFilter() { rowsfilterline->setText(""); int rowcount = database->rowCount(); - QProgressDialog progress("Updating...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating...", 0, 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); diff --git a/CycloBranch/gui/cSpectrumDetailWidget.cpp b/CycloBranch/gui/cSpectrumDetailWidget.cpp index 76268a6..8434d30 100644 --- a/CycloBranch/gui/cSpectrumDetailWidget.cpp +++ b/CycloBranch/gui/cSpectrumDetailWidget.cpp @@ -121,13 +121,13 @@ string cSpectrumDetailWidget::getDetailsAsHTMLString() { s += "

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

"; s += "Left Modification: " + lname + "
"; s += "Right Modification: " + rname + "
"; break; - case cyclicpolyketide: + case cyclicoligoketide: s += "
"; break; #endif @@ -435,6 +435,7 @@ cSpectrumDetailWidget::~cSpectrumDetailWidget() { delete textbrowser; //QProgressDialog progress("Clearing the peaklist...", /*"Cancel"*/0, 0, peakstable->rowCount(), this); + //progress.setMinimumWidth(250); //cEventFilter filter; //progress.installEventFilter(&filter); //progress.setMinimumDuration(0); @@ -482,14 +483,14 @@ cSpectrumDetailWidget::~cSpectrumDetailWidget() { switch (parameters->peptidetype) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif delete linearwidget; break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif delete cyclicwidget; break; @@ -556,14 +557,14 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) { switch (peptidetype) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif linearwidget = new cLinearWidget(); break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif cyclicwidget = new cCyclicWidget(); break; @@ -778,8 +779,8 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) { if (parameters && ((parameters->mode == denovoengine) || (parameters->mode == singlecomparison) || (parameters->mode == databasesearch))) { // cyclic -#if POLYKETIDE_SIDEROPHORES == 1 - if (theoreticalspectrum && ((parameters->peptidetype == cyclic) || (parameters->peptidetype == cyclicpolyketide))) { +#if OLIGOKETIDES == 1 + if (theoreticalspectrum && ((parameters->peptidetype == cyclic) || (parameters->peptidetype == cyclicoligoketide))) { #else if (theoreticalspectrum && (parameters->peptidetype == cyclic)) { #endif @@ -880,14 +881,14 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) { switch (peptidetype) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif hsplitter1->addWidget(linearwidget); break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif hsplitter1->addWidget(cyclicwidget); break; @@ -932,14 +933,14 @@ void cSpectrumDetailWidget::prepareToShow(ePeptideType peptidetype) { switch (peptidetype) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif linearwidget->initialize(parameters, theoreticalspectrum); break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif cyclicwidget->initialize(parameters, theoreticalspectrum); break; @@ -1159,6 +1160,7 @@ void cSpectrumDetailWidget::preparePeaksTable() { peakstable->setRowCount(thpeakscount + theoreticalspectrum->getUnmatchedPeaks()->size()); QProgressDialog progress("Preparing the peaklist...", /*"Cancel"*/0, 0, thpeakscount + theoreticalspectrum->getUnmatchedPeaks()->size(), parent); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); @@ -1371,8 +1373,8 @@ void cSpectrumDetailWidget::exportPeptide() { switch ((ePeptideType)parameters->peptidetype) { case linear: -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: #endif rx = ".+\\.pdf$"; if (!selected && (regex_search(filename.toStdString(), rx))) { @@ -1401,8 +1403,8 @@ void cSpectrumDetailWidget::exportPeptide() { } break; case cyclic: -#if POLYKETIDE_SIDEROPHORES == 1 - case cyclicpolyketide: +#if OLIGOKETIDES == 1 + case cyclicoligoketide: #endif rx = ".+\\.pdf$"; if (!selected && (regex_search(filename.toStdString(), rx))) { @@ -1522,12 +1524,14 @@ void cSpectrumDetailWidget::exportTableToCSV() { if (!filename.isEmpty()) { - QProgressDialog progress("Exporting the CSV file...", /*"Cancel"*/0, 0, peakstable->rowCount(), this); + QProgressDialog progress("Exporting the CSV file...", "Cancel", 0, peakstable->rowCount(), this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); progress.setWindowModality(Qt::WindowModal); + bool removefile = false; QFile file(filename); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { return; @@ -1571,13 +1575,18 @@ void cSpectrumDetailWidget::exportTableToCSV() { out << endl; progress.setValue(i); - //if (progress.wasCanceled()) { - // break; - //} + if (progress.wasCanceled()) { + removefile = true; + break; + } } file.close(); + if (removefile) { + file.remove(); + } + progress.setValue(peakstable->rowCount()); } @@ -1652,7 +1661,8 @@ void cSpectrumDetailWidget::filterPeaksTable() { bool hide; cPeaksList* thpeaks = theoreticalspectrum->getTheoreticalPeaks(); - QProgressDialog progress("Updating...", /*"Cancel"*/0, 0, rowcount, this); + QProgressDialog progress("Updating...", 0, 0, rowcount, this); + progress.setMinimumWidth(250); cEventFilter filter; progress.installEventFilter(&filter); progress.setMinimumDuration(0); diff --git a/CycloBranch/gui/cSpectrumSceneWidget.cpp b/CycloBranch/gui/cSpectrumSceneWidget.cpp index 66c261d..22eb706 100644 --- a/CycloBranch/gui/cSpectrumSceneWidget.cpp +++ b/CycloBranch/gui/cSpectrumSceneWidget.cpp @@ -337,7 +337,7 @@ void cSpectrumSceneWidget::redrawScene() { QFontMetrics fm(myFont); // maximum intensity in the interval - double maxintensity = theoreticalspectrum->getExperimentalSpectrum().getMaximumIntensityFromMZInterval(minmzratio, maxmzratio); + double maxintensity = theoreticalspectrum->getExperimentalSpectrum().getMaximumIntensityFromMZInterval(minmzratio, maxmzratio, hidematched, hideunmatched, parameters->peptidetype, hidescrambled); scene->removeItem(zoomgroup); scene->clear(); @@ -390,6 +390,11 @@ void cSpectrumSceneWidget::redrawScene() { continue; } + // hide scrambled peaks + if ((parameters->peptidetype == cyclic) && hidescrambled && theoreticalspectrum->getExperimentalSpectrum()[i].scrambled) { + continue; + } + visiblepeaks.add(theoreticalspectrum->getExperimentalSpectrum()[i]); } diff --git a/CycloBranch/gui/cSummaryPeaksTableWidget.cpp b/CycloBranch/gui/cSummaryPeaksTableWidget.cpp new file mode 100644 index 0000000..eb1ad4a --- /dev/null +++ b/CycloBranch/gui/cSummaryPeaksTableWidget.cpp @@ -0,0 +1,654 @@ +#include "gui/cSummaryPeaksTableWidget.h" +#include "core/cParameters.h" +#include "core/cTheoreticalSpectrumList.h" +#include "gui/cEventFilter.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +cSummaryPeaksTableWidget::cSummaryPeaksTableWidget(QWidget* parent) { + this->parent = parent; + + setWindowTitle("Summary Table of Matched Peaks"); + setWindowIcon(QIcon(":/images/icons/43.png")); + + close = new QPushButton(tr("Close")); + close->setToolTip("Close the window."); + + exportcsv = new QPushButton(tr("Export")); + exportcsv->setToolTip("Export the table to CSV."); + exportcsv->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); + + rowsfilterline = new QLineEdit(); + rowsfilterline->setMinimumWidth(250); + rowsfilterline->setToolTip("Text to Find"); + + rowsfiltercasesensitive = new QCheckBox(); + rowsfiltercasesensitive->setToolTip("Case Sensitive"); + + rowsfilterbutton = new QPushButton("Filter"); + rowsfilterbutton->setToolTip("Filter Search Results"); + rowsfilterbutton->setMinimumWidth(50); + + rowsfilterclearbutton = new QPushButton("Reset"); + rowsfilterclearbutton->setToolTip("Reset Search Results"); + rowsfilterclearbutton->setMinimumWidth(50); + rowsfilterclearbutton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); + + rowsfilterhbox = new QHBoxLayout(); + rowsfilterhbox->addWidget(rowsfilterline); + rowsfilterhbox->addStretch(); + rowsfilterhbox->addWidget(rowsfiltercasesensitive); + rowsfilterhbox->addStretch(); + rowsfilterhbox->addWidget(rowsfilterbutton); + rowsfilterhbox->addStretch(); + rowsfilterhbox->addWidget(rowsfilterclearbutton); + + rowsfilterwidget = new QWidget(); + rowsfilterwidget->setLayout(rowsfilterhbox); + rowsfilterwidget->setMaximumWidth(420); + + buttons = new QHBoxLayout(); + buttons->addWidget(close); + buttons->addStretch(); + buttons->addWidget(rowsfilterwidget); + buttons->addStretch(); + buttons->addWidget(exportcsv); + + database = new QTableWidget(0, 0, this); + database->setEditTriggers(QAbstractItemView::NoEditTriggers); + database->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); + database->horizontalHeader()->setSectionsMovable(true); + + mainlayout = new QVBoxLayout(); + mainlayout->addWidget(database); + mainlayout->addLayout(buttons); + + connect(database->horizontalHeader(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(headerItemDoubleClicked(int))); + connect(close, SIGNAL(released()), this, SLOT(closeWindow())); + connect(exportcsv, SIGNAL(released()), this, SLOT(exportToCsv())); + connect(rowsfilterbutton, SIGNAL(released()), this, SLOT(filterRows())); + connect(rowsfilterclearbutton, SIGNAL(released()), this, SLOT(resetFilter())); + + setLayout(mainlayout); + + resize(1280, 700); + + lastdirexporttocsv = "./"; +} + + +cSummaryPeaksTableWidget::~cSummaryPeaksTableWidget() { + deleteTable(false); + + for (int i = 0; i < database->columnCount(); i++) { + delete database->horizontalHeaderItem(i); + } + + database->setColumnCount(0); + + delete close; + delete exportcsv; + + delete rowsfilterline; + delete rowsfiltercasesensitive; + delete rowsfilterbutton; + delete rowsfilterclearbutton; + delete rowsfilterhbox; + delete rowsfilterwidget; + + delete database; + delete buttons; + delete mainlayout; +} + + +void cSummaryPeaksTableWidget::closeEvent(QCloseEvent *event) { + closeWindow(); +} + + +void cSummaryPeaksTableWidget::prepareToShow(QTableWidget* tablewidget, cParameters* parameters, cTheoreticalSpectrumList* spectralist) { + if (!parameters || !spectralist || ((int)tablewidget->rowCount() != spectralist->size())) { + return; + } + + + this->parameters = parameters; + + + // delete old data + deleteTable(true); + for (int i = 0; i < database->columnCount(); i++) { + database->setItemDelegateForColumn(i, 0); + delete database->horizontalHeaderItem(i); + } + database->setColumnCount(0); + + + // prepare the header + if (parameters->mode == dereplication) { + if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) { + database->setColumnCount(11); + } + else { + database->setColumnCount(9); + } + } + else { + database->setColumnCount(7); + } + + database->setHorizontalHeaderItem(0, new QTableWidgetItem()); + database->horizontalHeaderItem(0)->setText("ID"); + + int currentcolumn = 1; + if (parameters->mode == dereplication) { + if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) { + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Coordinate X"); + currentcolumn++; + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Coordinate Y"); + currentcolumn++; + } + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Ion Type"); + currentcolumn++; + } + else { + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Fragment Type"); + currentcolumn++; + } + + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Theoretical m/z"); + database->setItemDelegateForColumn(currentcolumn, &columndelegate); + currentcolumn++; + + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Experimental m/z"); + database->setItemDelegateForColumn(currentcolumn, &columndelegate); + currentcolumn++; + + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Intensity [%]"); + database->setItemDelegateForColumn(currentcolumn, &columndelegate); + currentcolumn++; + + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Error [ppm]"); + database->setItemDelegateForColumn(currentcolumn, &columndelegate); + currentcolumn++; + + if (parameters->mode == dereplication) { + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Summary Formula"); + currentcolumn++; + + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Name"); + currentcolumn++; + + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Reference"); + currentcolumn++; + } + else { + database->setHorizontalHeaderItem(currentcolumn, new QTableWidgetItem()); + database->horizontalHeaderItem(currentcolumn)->setText("Sequence"); + currentcolumn++; + } + + database->horizontalHeader()->setStretchLastSection(true); + for (int i = 0; i < database->columnCount(); i++) { + database->resizeColumnToContents(i); + } + + headersort.resize(database->columnCount()); + for (int i = 0; i < database->columnCount(); i++) { + headersort[i] = -1; + } + + + // fill new data + QProgressDialog* progress; + cEventFilter filter; + int spectracount = spectralist->size(); + + progress = new QProgressDialog("Preparing the table...", "Cancel", 0, spectracount, this); + progress->setMinimumWidth(250); + progress->installEventFilter(&filter); + progress->setMinimumDuration(0); + progress->setWindowModality(Qt::WindowModal); + progress->setValue(0); + + int thpeakscount; + int secondspace, langle, rangle, tmp1, tmp2; + cPeaksList* thpeaks; + cPeak* peak; + bool isred; + string stmp; + int currentrow; + int spectrumindex; + + QBrush brush; + brush.setColor(QColor(0, 0, 0)); + + for (int i = 0; i < spectracount; i++) { + + if (tablewidget->isRowHidden(i)) { + progress->setValue(i); + continue; + } + + spectrumindex = tablewidget->item(i, 1)->data(Qt::DisplayRole).toInt() - 1; + + if ((*spectralist)[spectrumindex].getNumberOfMatchedPeaks() == 0) { + progress->setValue(i); + continue; + } + + if (parameters->mode == dereplication) { + thpeaks = new cPeaksList(); + for (int j = 0; j < (int)((*spectralist)[spectrumindex].getTheoreticalPeaks()->size()); j++) { + peak = &((*((*spectralist)[spectrumindex].getTheoreticalPeaks()))[j]); + if (peak->matchedmz > 0) { + thpeaks->add(*peak); + } + } + thpeakscount = thpeaks->size(); + } + else { + thpeaks = (*spectralist)[spectrumindex].getTheoreticalPeaks(); + thpeakscount = (*spectralist)[spectrumindex].getTheoreticalPeaks()->size(); + } + + // theoretical peaks + for (int j = 0; j < thpeakscount; j++) { + peak = &((*thpeaks)[j]); + + if (peak->matchedmz > 0) { + isred = true; + } + else { + isred = false; + } + + if (!isred) { + continue; + } + + currentrow = database->rowCount(); + currentcolumn = 0; + + database->insertRow(currentrow); + database->setRowHeight(currentrow, 20); + + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setData(Qt::DisplayRole, spectrumindex + 1); + currentcolumn++; + + if (parameters->mode == dereplication) { + if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) { + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setData(Qt::DisplayRole, (*spectralist)[spectrumindex].getExperimentalSpectrum().getCoordinateX()); + currentcolumn++; + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setData(Qt::DisplayRole, (*spectralist)[spectrumindex].getExperimentalSpectrum().getCoordinateY()); + currentcolumn++; + } + secondspace = (int)peak->description.find(' ', peak->description.find(' ') + 1); + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setText(peak->description.substr(0, secondspace).c_str()); + currentcolumn++; + } + else { + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setText(peak->description.substr(0, peak->description.find(':')).c_str()); + currentcolumn++; + } + + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->mzratio)); + currentcolumn++; + + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->matchedmz)); + currentcolumn++; + + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->matchedintensity)); + currentcolumn++; + + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setData(Qt::DisplayRole, cropPrecisionToSixDecimals(peak->matchedppm)); + currentcolumn++; + + if (parameters->mode == dereplication) { + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setText(peak->description.substr(peak->description.rfind('(') + 1, peak->description.rfind(')') - peak->description.rfind('(') - 1).c_str()); + currentcolumn++; + + langle = (int)peak->description.rfind('<'); + rangle = (int)peak->description.find('>'); + if ((langle != string::npos) && (rangle != string::npos)) { + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setText(peak->description.substr(rangle + 1, langle - rangle - 1).c_str()); + currentcolumn++; + + tmp1 = (int)peak->description.find('<'); + tmp2 = (int)peak->description.rfind('>'); + stmp = peak->description.substr(tmp1, rangle - tmp1 + 1) + "view" + peak->description.substr(langle, tmp2 - langle + 1); + database->setCellWidget(currentrow, currentcolumn, new QLabel(stmp.c_str())); + ((QLabel *)database->cellWidget(currentrow, currentcolumn))->setTextFormat(Qt::RichText); + ((QLabel *)database->cellWidget(currentrow, currentcolumn))->setTextInteractionFlags(Qt::TextBrowserInteraction); + ((QLabel *)database->cellWidget(currentrow, currentcolumn))->setOpenExternalLinks(true); + currentcolumn++; + } + else { + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setText(peak->description.substr(secondspace + 1, peak->description.rfind('(') - secondspace - 2).c_str()); + currentcolumn++; + } + } + else { + if (peak->description.find(':') + 2 < peak->description.size()) { + database->setItem(currentrow, currentcolumn, widgetitemallocator.getNewItem()); + database->item(currentrow, currentcolumn)->setForeground(brush); + database->item(currentrow, currentcolumn)->setText(peak->description.substr(peak->description.find(':') + 2).c_str()); + currentcolumn++; + } + } + + } + + if (parameters->mode == dereplication) { + delete thpeaks; + } + + progress->setValue(i); + if (progress->wasCanceled()) { + deleteTable(true); + emit tableCancelled(); + break; + } + + } + + for (int i = 0; i < database->columnCount(); i++) { + database->resizeColumnToContents(i); + } + + progress->setValue(spectracount); + delete progress; +} + + +void cSummaryPeaksTableWidget::deleteTable(bool enableprogress) { + QProgressDialog* progress; + cEventFilter filter; + int rowcount = database->rowCount(); + + if (enableprogress) { + progress = new QProgressDialog("Clearing the table...", 0, 0, rowcount, this); + progress->setMinimumWidth(250); + progress->installEventFilter(&filter); + progress->setMinimumDuration(0); + progress->setWindowModality(Qt::WindowModal); + progress->setValue(0); + } + + widgetitemallocator.reset(); + + for (int i = 0; i < rowcount; i++) { + if (parameters->mode == dereplication) { + if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) { + delete database->cellWidget(rowcount - i - 1, 10); + } + else { + delete database->cellWidget(rowcount - i - 1, 8); + } + } + + if (enableprogress) { + progress->setValue(i); + } + } + + database->setRowCount(0); + + if (enableprogress) { + progress->setValue(rowcount); + delete progress; + } +} + + +void cSummaryPeaksTableWidget::keyPressEvent(QKeyEvent *event) { + if (event->key() == Qt::Key_Escape) { + closeWindow(); + } + + if ((event->key() == Qt::Key_Enter) || (event->key() == Qt::Key_Return)) { + if (rowsfilterline->hasFocus()) { + filterRows(); + } + } + + if (event->key() == Qt::Key_F1) { + #if OS_TYPE == WIN + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/summarypeakstable.html").absoluteFilePath())); + #else + QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/summarypeakstable.html").absoluteFilePath())); + #endif + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_F)) { + rowsfilterline->setFocus(); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_N)) { + rowsfiltercasesensitive->setChecked(!rowsfiltercasesensitive->isChecked()); + } + + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_E)) { + exportToCsv(); + } +} + + +void cSummaryPeaksTableWidget::closeWindow() { + hide(); +} + + +void cSummaryPeaksTableWidget::headerItemDoubleClicked(int index) { + if (headersort[index] == -1) { + database->sortByColumn(index, Qt::AscendingOrder); + headersort[index] = 1; + return; + } + + if (headersort[index] == 0) { + database->sortByColumn(index, Qt::AscendingOrder); + headersort[index] = 1; + } + else { + database->sortByColumn(index, Qt::DescendingOrder); + headersort[index] = 0; + } +} + + +void cSummaryPeaksTableWidget::filterRows() { + Qt::CaseSensitivity casesensitive = rowsfiltercasesensitive->isChecked()?Qt::CaseSensitive:Qt::CaseInsensitive; + QString str = rowsfilterline->text(); + int rowcount = database->rowCount(); + bool match; + int i, j; + + QProgressDialog progress("Updating...", "Cancel", 0, rowcount, this); + progress.setMinimumWidth(250); + cEventFilter filter; + progress.installEventFilter(&filter); + progress.setMinimumDuration(0); + progress.setWindowModality(Qt::WindowModal); + + for (i = 0; i < rowcount; i++) { + + match = false; + for (j = 0; j < database->columnCount(); j++) { + // ignore non-text fields + if (parameters->mode == dereplication) { + if ((parameters->peaklistfileformat == mis) || (parameters->peaklistfileformat == imzML)) { + if (j == 10) { + continue; + } + } + else { + if (j == 8) { + continue; + } + } + } + + if (database->item(i, j)->text().contains(str, casesensitive)) { + match = true; + break; + } + } + database->setRowHidden(i, !match); + progress.setValue(i); + + if (progress.wasCanceled()) { + resetFilter(); + break; + } + + } + + progress.setValue(rowcount); +} + + +void cSummaryPeaksTableWidget::resetFilter() { + rowsfilterline->setText(""); + int rowcount = database->rowCount(); + + QProgressDialog progress("Updating...", 0, 0, rowcount, this); + progress.setMinimumWidth(250); + cEventFilter filter; + progress.installEventFilter(&filter); + progress.setMinimumDuration(0); + progress.setWindowModality(Qt::WindowModal); + + for (int i = 0; i < rowcount; i++) { + database->setRowHidden(i, false); + progress.setValue(i); + } + + progress.setValue(rowcount); +} + + +void cSummaryPeaksTableWidget::exportToCsv() { + QString filename = QFileDialog::getSaveFileName(this, tr("Export to CSV"), lastdirexporttocsv, tr("Files (*.csv)")); + + if (!filename.isEmpty()) { + lastdirexporttocsv = filename; + + QProgressDialog progress("Exporting CSV file...", "Cancel", 0, database->rowCount(), this); + progress.setMinimumWidth(250); + cEventFilter filter; + progress.installEventFilter(&filter); + progress.setMinimumDuration(0); + progress.setWindowModality(Qt::WindowModal); + + bool removefile = false; + QFile file(filename); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + return; + } + + QTextStream out(&file); + + for (int i = 0; i < database->columnCount(); i++) { + out << "\"" << database->horizontalHeaderItem(i)->text() << "\""; + if (i < database->columnCount() - 1) { + out << ","; + } + } + out << endl; + + for (int i = 0; i < database->rowCount(); i++) { + + if (database->isRowHidden(i)) { + continue; + } + + for (int j = 0; j < database->columnCount(); j++) { + if (database->item(i, j)) { + out << "\"" << database->item(i, j)->data(Qt::DisplayRole).toString() << "\""; + if (j < database->columnCount() - 1) { + out << ","; + } + } + else if (database->cellWidget(i, j)) { + out << "\"" << ((QLabel *)(database->cellWidget(i, j)))->text() << "\""; + if (j < database->columnCount() - 1) { + out << ","; + } + } + else { + if (j < database->columnCount() - 1) { + out << ","; + } + } + } + out << endl; + + progress.setValue(i); + if (progress.wasCanceled()) { + removefile = true; + break; + } + } + + file.close(); + + if (removefile) { + file.remove(); + } + + progress.setValue(database->rowCount()); + } +} + diff --git a/CycloBranch/gui/cSummaryPeaksTableWidget.h b/CycloBranch/gui/cSummaryPeaksTableWidget.h new file mode 100644 index 0000000..9b1642b --- /dev/null +++ b/CycloBranch/gui/cSummaryPeaksTableWidget.h @@ -0,0 +1,144 @@ +/** + \file cSummaryPeaksTableWidget.h + \brief Summary table of matched peaks. +*/ + + +#ifndef _CSUMMARYPEAKSTABLEWIDGET_H +#define _CSUMMARYPEAKSTABLEWIDGET_H + +#include +#include +#include +#include +//#include +#include "core/utilities.h" +#include "core/cAllocator.h" +#include "gui/cDelegate.h" + +using namespace std; + + +// forward declaration +class cParameters; +class cTheoreticalSpectrumList; +class QHBoxLayout; +class QVBoxLayout; +class QTableWidget; +class QTableWidgetItem; +class QPushButton; +class QCheckBox; +class QLineEdit; + + +/** + \brief Summary table of matched peaks. +*/ +class cSummaryPeaksTableWidget : public QWidget +{ + Q_OBJECT + +public: + + + /** + \brief The constructor. + \param parent pointer to a parent widget + */ + cSummaryPeaksTableWidget(QWidget* parent = (QWidget *)0); + + + /** + \brief The destructor. + */ + ~cSummaryPeaksTableWidget(); + + + /** + \brief Handle the window close event. + \param event pointer to QCloseEvent + */ + void closeEvent(QCloseEvent *event); + + + /** + \brief Prepare the widget to show. + \param tablewidget a pointer to the main window table widget with the results + \param parameters parameters of the application + \param spectralist list of spectra + */ + void prepareToShow(QTableWidget* tablewidget, cParameters* parameters, cTheoreticalSpectrumList* spectralist); + + + /** + \brief Delete the table content. + \param enableprogress if true, the progress dialog is shown; if false, the dialog is hidden + */ + void deleteTable(bool enableprogress); + + +private: + + cParameters* parameters; + QWidget* parent; + QPushButton* close; + QPushButton* exportcsv; + + QWidget* rowsfilterwidget; + QHBoxLayout* rowsfilterhbox; + QLineEdit* rowsfilterline; + QCheckBox* rowsfiltercasesensitive; + QPushButton* rowsfilterbutton; + QPushButton* rowsfilterclearbutton; + + QTableWidget* database; + QHBoxLayout* buttons; + QVBoxLayout* mainlayout; + + vector headersort; + cDelegate columndelegate; + + QString lastdirexporttocsv; + + cAllocator widgetitemallocator; + + +protected: + + + /** + \brief Handle a key press event. + \param event pointer to QKeyEvent + */ + void keyPressEvent(QKeyEvent *event); + + +private slots: + + void closeWindow(); + + + void headerItemDoubleClicked(int index); + + + void filterRows(); + + + void resetFilter(); + + + void exportToCsv(); + + +signals: + + + /** + \brief The table was not generated because the process was cancelled. + */ + void tableCancelled(); + + +}; + +#endif diff --git a/CycloBranch/images.qrc b/CycloBranch/images.qrc index a67a20b..fcfad08 100644 --- a/CycloBranch/images.qrc +++ b/CycloBranch/images.qrc @@ -33,5 +33,7 @@ images/icons/66.png images/icons/5.png images/icons/25.png + images/icons/43.png + images/icons/23.png diff --git a/CycloBranch/images/icons/23.png b/CycloBranch/images/icons/23.png new file mode 100644 index 0000000..f2e81bf Binary files /dev/null and b/CycloBranch/images/icons/23.png differ diff --git a/CycloBranch/images/icons/43.png b/CycloBranch/images/icons/43.png new file mode 100644 index 0000000..65af05d Binary files /dev/null and b/CycloBranch/images/icons/43.png differ diff --git a/CycloBranch/parallel/cGraphReaderThread.cpp b/CycloBranch/parallel/cGraphReaderThread.cpp index 75b5dcb..9b5b8fa 100644 --- a/CycloBranch/parallel/cGraphReaderThread.cpp +++ b/CycloBranch/parallel/cGraphReaderThread.cpp @@ -97,19 +97,19 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate candidate.setCandidate(composition, perspectivepath, startmodifID, endmodifID, middlemodifID, middlepos); } -#if POLYKETIDE_SIDEROPHORES == 1 - if ((parameters->peptidetype == linearpolyketide) && candidate.hasLastBrickArtificial(*bricksdatabasewithcombinations) && (composition.size() > 0) && (perspectivepath.size() > 0)) { +#if OLIGOKETIDES == 1 + if ((parameters->peptidetype == linearoligoketide) && candidate.hasLastBrickArtificial(*bricksdatabasewithcombinations) && (composition.size() > 0) && (perspectivepath.size() > 0)) { if ((*graph)[perspectivepath[0].nodeid].checkIonAnnotation(l1h_ion)) { - switch (candidate.getResidueLossType(*bricksdatabasewithcombinations)) + switch (candidate.getKetidePrecursorType(*bricksdatabasewithcombinations)) { - case water: + case ketide_precursor_h2o: bid = atoi(composition.back().c_str()) + 1; // offset of -H2O brick break; - case h2: + case ketide_precursor_h2: bid = atoi(composition.back().c_str()) + 3; // offset of -H2 brick break; - case h2o2: + case ketide_precursor_h2o2: bid = atoi(composition.back().c_str()) + 8; // offset of -H2O2 brick break; default: @@ -122,15 +122,15 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate } if ((*graph)[perspectivepath[0].nodeid].checkIonAnnotation(l2h_ion)) { - switch (candidate.getResidueLossType(*bricksdatabasewithcombinations)) + switch (candidate.getKetidePrecursorType(*bricksdatabasewithcombinations)) { - case water: + case ketide_precursor_h2o: bid = atoi(composition.back().c_str()) + 4; // offset of -O brick break; - case h2: + case ketide_precursor_h2: bid = atoi(composition.back().c_str()); // nop break; - case h2o2: + case ketide_precursor_h2o2: bid = atoi(composition.back().c_str()) + 6; // offset of -O2 brick break; default: @@ -143,15 +143,15 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate } if ((*graph)[perspectivepath[0].nodeid].checkIonAnnotation(l1oh_ion)) { - switch (candidate.getResidueLossType(*bricksdatabasewithcombinations)) + switch (candidate.getKetidePrecursorType(*bricksdatabasewithcombinations)) { - case water: + case ketide_precursor_h2o: bid = atoi(composition.back().c_str()) + 3; // offset of -H2 brick break; - case h2: + case ketide_precursor_h2: bid = atoi(composition.back().c_str()) + 7; // offset of -H2+O brick break; - case h2o2: + case ketide_precursor_h2o2: bid = atoi(composition.back().c_str()) + 1; // offset of -H2O brick break; default: @@ -164,15 +164,15 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate } if ((*graph)[perspectivepath[0].nodeid].checkIonAnnotation(l2oh_ion)) { - switch (candidate.getResidueLossType(*bricksdatabasewithcombinations)) + switch (candidate.getKetidePrecursorType(*bricksdatabasewithcombinations)) { - case water: + case ketide_precursor_h2o: bid = atoi(composition.back().c_str()); // nop break; - case h2: + case ketide_precursor_h2: bid = atoi(composition.back().c_str()) + 5; // offset of +O brick break; - case h2o2: + case ketide_precursor_h2o2: bid = atoi(composition.back().c_str()) + 4; // offset of -O brick break; default: @@ -190,8 +190,8 @@ int cGraphReaderThread::getCandidatesIter(bool cterminalstartingnode, cCandidate if ((candidate.getComposition().compare("") != 0) && !candidate.hasOnlyArtificialBricks(*bricksdatabasewithcombinations) && !candidate.hasLastBrickInvalid(*bricksdatabasewithcombinations)) { if (isInPpmMassErrorTolerance(precursormass, candidate.getPrecursorMass(*bricksdatabasewithcombinations, parameters), parameters->precursormasserrortolerance) -#if POLYKETIDE_SIDEROPHORES == 1 - && (((parameters->peptidetype != linearpolyketide) && (parameters->peptidetype != cyclicpolyketide)) || candidate.checkPolyketideBlocks(*bricksdatabasewithcombinations, parameters->peptidetype)) +#if OLIGOKETIDES == 1 + && (((parameters->peptidetype != linearoligoketide) && (parameters->peptidetype != cyclicoligoketide)) || candidate.checkKetideBlocks(*bricksdatabasewithcombinations, parameters->peptidetype)) #endif ) { @@ -326,8 +326,8 @@ void cGraphReaderThread::run() { } } break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: +#if OLIGOKETIDES == 1 + case linearoligoketide: for (int i = 1; i <= lastsystemnode; i++) { if (i - 4 > 0) { startmodifID = i - 4; @@ -338,7 +338,7 @@ void cGraphReaderThread::run() { } } break; - case cyclicpolyketide: + case cyclicoligoketide: for (int i = 1; i <= lastsystemnode; i++) { if (getCandidatesIter(false, candidates, i, composition, unchargedprecursormass, 0, 0, 0, -1, perspectivepath, (*graph)[i].getMZRatio(), terminatecomputation) == -1) { // terminated diff --git a/CycloBranch/parallel/cSpectrumComparatorThread.cpp b/CycloBranch/parallel/cSpectrumComparatorThread.cpp index 2a8586a..83e9222 100644 --- a/CycloBranch/parallel/cSpectrumComparatorThread.cpp +++ b/CycloBranch/parallel/cSpectrumComparatorThread.cpp @@ -142,12 +142,12 @@ void cSpectrumComparatorThread::run() { case branchcyclic: theoreticalpeaksrealsize = tsp.compareBranchCyclic(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); break; -#if POLYKETIDE_SIDEROPHORES == 1 - case linearpolyketide: - theoreticalpeaksrealsize = tsp.compareLinearPolyketideSiderophore(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); +#if OLIGOKETIDES == 1 + case linearoligoketide: + theoreticalpeaksrealsize = tsp.compareLinearOligoketide(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); break; - case cyclicpolyketide: - theoreticalpeaksrealsize = tsp.compareCyclicPolyketideSiderophore(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); + case cyclicoligoketide: + theoreticalpeaksrealsize = tsp.compareCyclicOligoketide(peaklist, *bricksdatabasewithcombinations, false, *rxsequencetag, *rxsearchedsequence); break; #endif case linearpolysaccharide: