diff --git a/README.md b/README.md index 405261104a7..53ff51f5cf4 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,11 @@ OpenMS [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/93e71bad214f46d2a534ec92dbc2efc9)](https://www.codacy.com/app/OpenMS/OpenMS?utm_source=github.com&utm_medium=referral&utm_content=OpenMS/OpenMS&utm_campaign=badger) -[![Build Status](https://travis-ci.org/OpenMS/OpenMS.svg?branch=develop)](https://travis-ci.org/OpenMS/OpenMS) [![Project Stats](https://www.openhub.net/p/open-ms/widgets/project_thin_badge.gif)](https://www.ohloh.net/p/open-ms) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OpenMS/OpenMS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Build Status](https://travis-ci.org/OpenMS/OpenMS.svg?branch=develop)](https://travis-ci.org/OpenMS/OpenMS) +[![Project Stats](https://www.openhub.net/p/open-ms/widgets/project_thin_badge.gif)](https://www.ohloh.net/p/open-ms) +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OpenMS/OpenMS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square)](http://bioconda.github.io/recipes/openms/README.html) +[![documentation](https://codedocs.xyz/doxygen/doxygen.svg)](https://ftp.mi.fu-berlin.de/pub/OpenMS/develop-documentation/html/index.html) OpenMS @@ -34,8 +37,11 @@ Berlin, and the ETH Zürich. Features -------- -- Core C++ library -- TOPP Tools, 150+ analysis tools (150+), covering most MS and LC-MS data processing and mining tasks. +- Core C++ library under three-clause BSD licence. +- Python bindings to the C++ API through pyOpenMS. +- Over 150+ individual analysis tools (TOPP Tools), covering most MS and LC-MS data processing and mining tasks. +- Powerful 2D and 3D visualization tools (TOPPView) +- Support for most MS identification and quantification workflows (label-free, isobaric and stable isotope). - Support for all major platforms (Windows [XP, 7, 8, 10], macOS and Linux). Licence @@ -49,4 +55,5 @@ The file [AUTHORS](AUTHORS) contains a list of all authors who worked on OpenMS. Documentation ------------- Users and developers should start by reading the [OpenMS wiki](https://github.com/OpenMS/OpenMS/wiki) and consult the [current documentation](http://www.openms.de/current_doxygen/). +Documentation for the Python bindings pyOpenMS can be found on the [pyOpenMS online documentation](https://pyopenms.readthedocs.io). diff --git a/doc/code_examples/Tutorial_Labeled.cpp b/doc/code_examples/Tutorial_Labeled.cpp index 0007d5af2c7..4ac573851b0 100644 --- a/doc/code_examples/Tutorial_Labeled.cpp +++ b/doc/code_examples/Tutorial_Labeled.cpp @@ -49,12 +49,12 @@ int main(int argc, const char** argv) FeatureXMLFile feature_file; feature_file.load(tutorial_data_path + "/data/Tutorial_Labeled.featureXML", maps[0]); ConsensusMap out; - out.getFileDescriptions()[0].filename = "data/Tutorial_Labeled.featureXML"; - out.getFileDescriptions()[0].size = maps[0].size(); - out.getFileDescriptions()[0].label = "light"; - out.getFileDescriptions()[1].filename = "data/Tutorial_Labeled.featureXML"; - out.getFileDescriptions()[1].size = maps[0].size(); - out.getFileDescriptions()[1].label = "heavy"; + out.getColumnHeaders()[0].filename = "data/Tutorial_Labeled.mzML"; + out.getColumnHeaders()[0].size = maps[0].size(); + out.getColumnHeaders()[0].label = "light"; + out.getColumnHeaders()[1].filename = "data/Tutorial_Labeled.mzML"; + out.getColumnHeaders()[1].size = maps[0].size(); + out.getColumnHeaders()[1].label = "heavy"; FeatureGroupingAlgorithmLabeled algorithm; // ... set parameters diff --git a/doc/code_examples/Tutorial_Unlabeled.cpp b/doc/code_examples/Tutorial_Unlabeled.cpp index 107ea9eaa64..17c4c02d41c 100644 --- a/doc/code_examples/Tutorial_Unlabeled.cpp +++ b/doc/code_examples/Tutorial_Unlabeled.cpp @@ -51,10 +51,11 @@ int main(int argc, const char** argv) feature_file.load(tutorial_data_path + "/data/Tutorial_Unlabeled_2.featureXML", maps[1]); ConsensusMap out; - out.getFileDescriptions()[0].filename = "/data/Tutorial_Unlabeled_1.featureXML"; - out.getFileDescriptions()[0].size = maps[0].size(); - out.getFileDescriptions()[1].filename = "/data/Tutorial_Unlabeled_2.featureXML"; - out.getFileDescriptions()[1].size = maps[1].size(); + out.getColumnHeaders()[0].filename = "/data/Tutorial_Unlabeled_1.mzML"; + out.getColumnHeaders()[0].size = maps[0].size(); + out.getColumnHeaders()[1].filename = "/data/Tutorial_Unlabeled_2.mzML"; + out.getColumnHeaders()[1].size = maps[1].size(); + FeatureGroupingAlgorithmUnlabeled algorithm; // ... set parameters diff --git a/doc/doxygen/install/common-cmake-parameters.doxygen b/doc/doxygen/install/common-cmake-parameters.doxygen index 8454e5ec7f9..ae130e241b0 100644 --- a/doc/doxygen/install/common-cmake-parameters.doxygen +++ b/doc/doxygen/install/common-cmake-parameters.doxygen @@ -5,7 +5,7 @@ The most important CMake variables are: - diff --git a/doc/doxygen/install/install-win.doxygen b/doc/doxygen/install/install-win.doxygen index 63c720e6d42..fac4cddc418 100644 --- a/doc/doxygen/install/install-win.doxygen +++ b/doc/doxygen/install/install-win.doxygen @@ -117,8 +117,8 @@
  1. non-commercial:
      -
    1. install perl (e.g. Strawberry Perl) and git -
    2. download Qt5 source via git: +
    3. install perl (e.g. Strawberry Perl), Python and git +
    4. download Qt5 source via git or as a source package from the website: \code git clone git://github.com/qt/qt5 --branch 5.9 qt-5.9 \endcode @@ -133,9 +133,10 @@ \endcode
    5. if you have multiple versions of VS installed you might need to provide the -platform param for the next configure command (e.g., -platform win32-msvc2012)
    6. To save disk space, we use the -prefix switch do install only the required parts of Qt to a new directory of your choice (called <path-to-qt>, e.g. c:/dev/Qt/5.9/). - Check more options and supported compilers here: http://doc.qt.io/qt-5/configure-options.html (especially for developers) + Check more options and supported compilers here: http://doc.qt.io/qt-5/configure-options.html (especially for developers). Note that part of Qt requires Python to compile, so its a good idea to add the Python executable to your path \code - configure -release -nomake example -nomake demos -nomake tests -opensource -confirm-license -prefix -platform win32-msvc + PATH=%PATH%;C:\Python27\ + configure -opensource -skip speech -skip location -nomake tests -nomake examples -confirm-license -opengl dynamic -prefix -platform win32-msvc \endcode
    7. \code @@ -276,8 +277,16 @@ MSBuild.exe /maxcpucount /target: /p:Configuration= \endcode - @note Since the call can be a bit lengthy, there is a batch file in OpenMS/tools/build.bat and in the root of your build tree (copied there by cmake for convenience), which allows to build the most important targets (TOPP, UTILS, Gui, Tests, Doc) in Release or Debug using very short notation. Call it without arguments to see its usage help text. + @note Since the call can be a bit lengthy, there is a batch file in + OpenMS/tools/build.bat and in the root of your build tree (copied + there by cmake for convenience), which allows to build the most important + targets (TOPP, UTILS, Gui, Tests, Doc) in Release or Debug using very short + notation. Call it without arguments to see its usage help text. For example + to build only the OpenMS library in release mode, call + \code + build OpenMS r + \endcode */ diff --git a/doc/doxygen/public/UTILS.doxygen b/doc/doxygen/public/UTILS.doxygen index 7e27ab0315b..6407b043efd 100644 --- a/doc/doxygen/public/UTILS.doxygen +++ b/doc/doxygen/public/UTILS.doxygen @@ -88,7 +88,8 @@ Quantitation - @subpage UTILS_ERPairFinder - Evaluate pair ratios on enhanced resolution (zoom) scans. - @subpage UTILS_FeatureFinderSuperHirn - Find Features using the SuperHirn Algorithm (it can handle centroided or profile data, see .ini file). - - @subpage UTILS_MetaboliteAdductDecharger - Decharges and merges different feature charge variants of the same small molecule. + - @subpage UTILS_ProteomicsLFQ - A standard Proteomics LFQ pipeline. + - @subpage UTILS_MetaboliteAdductDecharger - Decharges and merges different feature charge variants of the same small molecule. - @subpage UTILS_MRMPairFinder - Evaluate labeled pair ratios on MRM features. - @subpage UTILS_OpenSwathWorkflow - Complete workflow to run OpenSWATH. - @subpage UTILS_SILACWorkflow - Complete workflow to run SILAC analysis. diff --git a/share/OpenMS/CHEMISTRY/unimod.xml b/share/OpenMS/CHEMISTRY/unimod.xml index 096c84fe78a..3ebf6958752 100644 --- a/share/OpenMS/CHEMISTRY/unimod.xml +++ b/share/OpenMS/CHEMISTRY/unimod.xml @@ -216,7 +216,7 @@ PNAS 2006 103: 18574-18579 Journal - http://dx.doi.org/10.1073/pnas.0608995103 + https://doi.org/10.1073/pnas.0608995103 C.-H. Feng, C.-Y. Lu, Analytica Chimica Acta 684 (2011) 80–86 Journal - http://dx.doi.org/10.1016/j.aca.2010.10.042 + https://doi.org/10.1016/j.aca.2010.10.042 Rapid Communications in Mass Spectrometry, Volume 15, Issue 24 , Pages 2387 - 2392 Journal - http://dx.doi.org/10.1002/rcm.517 + https://doi.org/10.1002/rcm.517 Agilent Lys Tag 4H Reagent Kit @@ -3485,7 +3485,7 @@ Rapid Communications in Mass Spectrometry, Volume 15, Issue 24 , Pages 2387 - 2392 Journal - http://dx.doi.org/10.1002/rcm.517 + https://doi.org/10.1002/rcm.517 Agilent Lys Tag 4H Reagent Kit @@ -6141,7 +6141,7 @@ corrected by subtraction of a further -O at 8.6.2010 Mapping PARP-1 auto-ADP-ribosylation sites by liquid chromatography-tandem mass spectrometry Journal - http://dx.doi.org/10.1021/pr301219h + https://doi.org/10.1021/pr301219h ADP @@ -6166,7 +6166,7 @@ corrected by subtraction of a further -O at 8.6.2010 Identification of the ADP-ribosylation sites in the PARP-1 automodification domain: analysis and implications Journal - http://dx.doi.org/10.1021/ja906135d + https://doi.org/10.1021/ja906135d Structure @@ -6176,7 +6176,7 @@ corrected by subtraction of a further -O at 8.6.2010 P-T modification of Lysine Journal - http://dx.doi.org/10.1093/nar/gkq463 + https://doi.org/10.1093/nar/gkq463 AA0237 @@ -15126,7 +15126,7 @@ corrected by subtraction of a further -O at 8.6.2010 Biochemistry 2005 vol 44 pp 1833-1845 Journal - http://dx.doi.org/10.1021/bi048228c + https://doi.org/10.1021/bi048228c B. Schilling, C.B. Yoo, C.J. Collins, B.W. Gibson, Determining Cysteine Oxidation Status Using Differential Alkylation, Int. J. Mass Spectrom., 2004, 236 (1-3), 117-121 Journal - http://dx.doi.org/10.1016/j.ijms.2004.06.004 + https://doi.org/10.1016/j.ijms.2004.06.004 Weibin Chen et. al., Anal. Chem.2007, 79,1583-1590 Journal - http://dx.doi.org/10.1021/ac061670b + https://doi.org/10.1021/ac061670b Sadagopan, N. and Watson, J. T., Journal of the American Society For Mass Spectrometry 11 107-119 (2000) @@ -15451,14 +15451,14 @@ corrected by subtraction of a further -O at 8.6.2010 Ong, S-E, I. Kratchmarova, and M. Mann (2003). J Proteome Research 2: 173-181 Journal - http://dx.doi.org/10.1021/pr0255708 + https://doi.org/10.1021/pr0255708 Peng J, Schwartz D, Elias JE, Thoreen CC, Cheng D, Marsischky G, Roelofs J, Finley D, Gygi SP. Nat Biotechnol. 2003 Aug;21(8):921-6 Journal - http://dx.doi.org/10.1038/nbt849 + https://doi.org/10.1038/nbt849 The two glycine residues left on SILAC labeled ubiquitinylated lysine after tryptic digestion @@ -15545,7 +15545,7 @@ Nat Biotechnol. 2003 Aug;21(8):921-6 PLoS ONE 5(11): e14056 Journal - http://dx.doi.org/10.1371/journal.pone.0014056 + https://doi.org/10.1371/journal.pone.0014056 J. Mass. Spectrom. 2007; 42:89-100. Journal - http://dx.doi.org/10.1002/jms.1144 + https://doi.org/10.1002/jms.1144 Wohlschlegel, J. A. et al., J Proteome Res. 5 761 2006 Journal - http://dx.doi.org/10.1021/pr050451o + https://doi.org/10.1021/pr050451o antiserum and mass spectrometric analysis Misc. URL - http://dx.doi.org/10.1007/s00726-014-1879-8 + https://doi.org/10.1007/s00726-014-1879-8 Fluorescence depletion mechanisms in super-resolving STED microscopy Journal - http://dx.doi.org/10.1016/j.cplett.2007.06.017 + https://doi.org/10.1016/j.cplett.2007.06.017 Enrichment and site-mapping of O-Linked N-Acetylglucosamine by a combination of chemical/enzymatic tagging, photochemical cleavage, and electron transfer dissociation (ETD) mass spectrometry Journal - http://dx.doi.org/10.1074/mcp.M900268-MCP200 + https://doi.org/10.1074/mcp.M900268-MCP200 Formation of E-Formyllysine on Silver-stained Proteins Journal - http://dx.doi.org/10.1074/mcp.M600279-MCP200 + https://doi.org/10.1074/mcp.M600279-MCP200 formaldeyde induced formation of thioproline @@ -18336,7 +18336,7 @@ Efficient incorporation of unsaturated methionine analogues into proteins in viv C.-H. Feng, C.-Y. Lu, Analytica Chimica Acta 684 (2011) 80–86 Journal - http://dx.doi.org/10.1016/j.aca.2010.10.042 + https://doi.org/10.1016/j.aca.2010.10.042 Quantification of Protein Sulfenic Acid Modifications Using Isotope-Coded Dimedone and Iododimedone Journal - http://dx.doi.org/10.1002/anie.201007175 + https://doi.org/10.1002/anie.201007175 Quantification of Protein Sulfenic Acid Modifications Using Isotope-Coded Dimedone and Iododimedone Journal - http://dx.doi.org/10.1002/anie.201007175 + https://doi.org/10.1002/anie.201007175 Journal - http://dx.doi.org/10.1007/s00726-014-1879-8 + https://doi.org/10.1007/s00726-014-1879-8 Deoxyhypusine synthase catalyzes the formation of a deoxyhypusine by transferring an aminobutyl moiety from spermidine onto a conserved lysine residue within the eIF5A @@ -23002,7 +23002,7 @@ Glushchenko A. V., Jacobsen D. W. Antioxid. Redox Signal. 2007. V. 9. P. 1883– J. Proteome Res., 2009, 8 (2), pp 900–906 Journal - http://dx.doi.org/10.1021/pr8005155 + https://doi.org/10.1021/pr8005155 Anal. Chem., 2010, 82 (7), pp 2817–2825 Journal - http://dx.doi.org/10.1021/ac902778d + https://doi.org/10.1021/ac902778d Different channels have the same nominal mass but slightly different exact masses. @@ -23725,7 +23725,7 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide Anal. Chem., 2010, 82 (7), pp 2817–2825 Journal - http://dx.doi.org/10.1021/ac902778d + https://doi.org/10.1021/ac902778d Different channels have the same nominal mass but slightly different exact masses. @@ -23756,7 +23756,7 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide Anal. Chem., 2010, 82 (7), pp 2817–2825 Journal - http://dx.doi.org/10.1021/ac902778d + https://doi.org/10.1021/ac902778d Different channels have the same nominal mass but slightly different exact masses. @@ -23785,7 +23785,7 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide Anal. Chem., 2010, 82 (7), pp 2817–2825 Journal - http://dx.doi.org/10.1021/ac902778d + https://doi.org/10.1021/ac902778d Different channels have the same nominal mass but slightly different exact masses. @@ -24027,7 +24027,7 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide Identification of 67 Histone Marks and Histone Lysine Crotonylation as a New Type of Histone Modification, Tan et al., Cell 146(6) 1016–1028 2011 Journal - http://dx.doi.org/10.1016/j.cell.2011.08.008 + https://doi.org/10.1016/j.cell.2011.08.008 Revival of deuterium-labeled reagents for protein quantitation, Zeng D. and Li S. Journal - http://dx.doi.org/10.1039/b906335h + https://doi.org/10.1039/b906335h Novel and cost-effective 6-plex isobaric tagging reagent, DiART, is effective for identification and relative quantification of complex protein mixtures using PQD fragmentation, Ramsubramaniam N. et al. Journal - http://dx.doi.org/10.1002/jms.3249 + https://doi.org/10.1002/jms.3249 Different tags have the same nominal mass but slightly different exact masses. Use this modification for all tags for quantitation purposes. Monoisotopic masses of the fragment ions to be quantified are 114.12827, 115.12531, 116.14082, 117.13786, 118.14752, 119.14456 @@ -24811,12 +24811,12 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide Revival of deuterium-labeled reagents for protein quantitation, Zeng D. and Li S. Journal - http://dx.doi.org/10.1039/b906335h + https://doi.org/10.1039/b906335h Novel and cost-effective 6-plex isobaric tagging reagent, DiART, is effective for identification and relative quantification of complex protein mixtures using PQD fragmentation, Ramsubramaniam N. et al. Journal - http://dx.doi.org/10.1002/jms.3249 + https://doi.org/10.1002/jms.3249 Different tags have the same nominal mass but slightly different exact masses. @@ -24852,12 +24852,12 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide Novel and cost-effective 6-plex isobaric tagging reagent, DiART, is effective for identification and relative quantification of complex protein mixtures using PQD fragmentation, Ramsubramaniam N. et al. Journal - http://dx.doi.org/10.1002/jms.3249 + https://doi.org/10.1002/jms.3249 Revival of deuterium-labeled reagents for protein quantitation, Zeng D. and Li S. Journal - http://dx.doi.org/10.1039/b906335h + https://doi.org/10.1039/b906335h Different tags have the same nominal mass but slightly different exact masses. @@ -24892,12 +24892,12 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide Revival of deuterium-labeled reagents for protein quantitation, Zeng D. and Li S. Journal - http://dx.doi.org/10.1039/b906335h + https://doi.org/10.1039/b906335h Novel and cost-effective 6-plex isobaric tagging reagent, DiART, is effective for identification and relative quantification of complex protein mixtures using PQD fragmentation, Ramsubramaniam N. et al. Journal - http://dx.doi.org/10.1002/jms.3249 + https://doi.org/10.1002/jms.3249 Different tags have the same nominal mass but slightly different exact masses. @@ -24932,12 +24932,12 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide Revival of deuterium-labeled reagents for protein quantitation, Zeng D. and Li S. Journal - http://dx.doi.org/10.1039/b906335h + https://doi.org/10.1039/b906335h Novel and cost-effective 6-plex isobaric tagging reagent, DiART, is effective for identification and relative quantification of complex protein mixtures using PQD fragmentation, Ramsubramaniam N. et al. Journal - http://dx.doi.org/10.1002/jms.3249 + https://doi.org/10.1002/jms.3249 Different tags have the same nominal mass but slightly different exact masses. @@ -25391,7 +25391,7 @@ M. Zimnicka, et al. "Tunable Charge Tags for Electron-Based Methods of Peptide antiserum and mass spectrometric analysis Misc. URL - http://dx.doi.org/10.1007/s00726-014-1879-8 + https://doi.org/10.1007/s00726-014-1879-8 Photo-cross-linking and high-resolution mass spectrometry for assignment of RNRNA-binding sites in RNRNA-binding proteins Journal - http://dx.doi.org/10.1038/nmeth.3092 + https://doi.org/10.1038/nmeth.3092 ])[^ \t\\r\n\\v\\f])+)" [PSI:PI, http://dx.doi.org/] +def: "(10[.][0-9]\{4,\}(?:[.][0-9]+)*/(?:(?![\"&\'<>])[^ \t\\r\n\\v\\f])+)" [PSI:PI, https://doi.org/] is_a: MS:1002479 ! regular expression [Term] diff --git a/share/OpenMS/examples/FRACTIONS/BSA_design.tsv b/share/OpenMS/examples/FRACTIONS/BSA_design.tsv index 5c95f0181d4..a86b06ca4ae 100644 --- a/share/OpenMS/examples/FRACTIONS/BSA_design.tsv +++ b/share/OpenMS/examples/FRACTIONS/BSA_design.tsv @@ -1,7 +1,7 @@ -Run Spectra File Fraction Technical Replicate -1 BSA1_F1.mzML 1 1 -2 BSA1_F2.mzML 2 1 -3 BSA2_F1.mzML 1 1 -4 BSA2_F2.mzML 2 1 -5 BSA3_F1.mzML 1 1 -6 BSA3_F2.mzML 2 1 +Fraction_Group Fraction Spectra_Filepath Label Sample +1 1 BSA1_F1.mzML 1 1 +1 2 BSA1_F2.mzML 1 1 +2 1 BSA2_F1.mzML 1 2 +2 2 BSA2_F2.mzML 1 2 +3 1 BSA3_F1.mzML 1 3 +3 2 BSA3_F2.mzML 1 3 diff --git a/src/openms/CMakeLists.txt b/src/openms/CMakeLists.txt index 858ef06e7fd..155f283df44 100644 --- a/src/openms/CMakeLists.txt +++ b/src/openms/CMakeLists.txt @@ -140,22 +140,28 @@ foreach (includedir endforeach() #set(OpenMS_sources ${OpenMS_sources} openms_pch.cpp) -openms_add_library(TARGET_NAME OpenMS - SOURCE_FILES ${OpenMS_sources} - HEADER_FILES ${OpenMS_sources_h} - ${OpenMS_configured_headers} - INTERNAL_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include - ${CMAKE_CURRENT_BINARY_DIR}/include - PRIVATE_INCLUDES ${EOL_BSPLINE_INCLUDE_DIRECTORY} - EXTERNAL_INCLUDES ${OPENMS_CONTRIB_INCLUDE_DIRS} - ${OpenSwathAlgo_INCLUDE_DIRECTORIES} - ${INCLUDES_FROM_CONTRIB} - ${INCLUDES_FROM_SYSTEM} - ${Qt5Core_INCLUDE_DIRS} - ${Qt5Network_INCLUDE_DIRS} - LINK_LIBRARIES OpenSwathAlgo - ${OPENMS_DEP_LIBRARIES} - DLL_EXPORT_PATH "OpenMS/") +openms_add_library(TARGET_NAME OpenMS + SOURCE_FILES + ${OpenMS_sources} + HEADER_FILES + ${OpenMS_sources_h} + ${OpenMS_configured_headers} + INTERNAL_INCLUDES + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_BINARY_DIR}/include + PRIVATE_INCLUDES + ${EOL_BSPLINE_INCLUDE_DIRECTORY} + EXTERNAL_INCLUDES + ${OpenSwathAlgo_INCLUDE_DIRECTORIES} + ${EVERGREEN_INCLUDE_DIRECTORY} + ${INCLUDES_FROM_CONTRIB} + ${INCLUDES_FROM_SYSTEM} + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Network_INCLUDE_DIRS} + LINK_LIBRARIES + OpenSwathAlgo + ${OPENMS_DEP_LIBRARIES} + DLL_EXPORT_PATH "OpenMS/") #------------------------------------------------------------------------------ # since the share basically belongs to OpenMS core we control its installation diff --git a/src/openms/include/OpenMS/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.h b/src/openms/include/OpenMS/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.h new file mode 100644 index 00000000000..2c3a856b3de --- /dev/null +++ b/src/openms/include/OpenMS/ANALYSIS/ID/BayesianProteinInferenceAlgorithm.h @@ -0,0 +1,77 @@ +// -------------------------------------------------------------------------- +// OpenMS -- Open-Source Mass Spectrometry +// -------------------------------------------------------------------------- +// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen, +// ETH Zurich, and Freie Universitaet Berlin 2002-2017. +// +// This software is released under a three-clause BSD license: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of any author or any participating institution +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// For a full list of authors, refer to the file AUTHORS. +// -------------------------------------------------------------------------- +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING +// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// -------------------------------------------------------------------------- +// $Maintainer: Julianus Pfeuffer $ +// $Authors: Julianus Pfeuffer $ +// -------------------------------------------------------------------------- +#ifndef OPENMS_ANALYSIS_ID_BAYESIANPROTEININFERENCE_H +#define OPENMS_ANALYSIS_ID_BAYESIANPROTEININFERENCE_H + + +#include +#include +#include +#include +#include +#include +#include + +namespace OpenMS +{ + class OPENMS_DLLAPI BayesianProteinInferenceAlgorithm : + public DefaultParamHandler, + public ProgressLogger + { + public: + /// Constructor + BayesianProteinInferenceAlgorithm(); + + /// Destructor + ~BayesianProteinInferenceAlgorithm() override = default; + + /// A function object to pass into the IDBoostGraph class to perform algorithms on + /// connected components + class FilteredGraphInferenceFunctor; + + /// Deprecated: A function object to pass into the IDBoostGraph class to perform algorithms on + /// connected components and on the fly finding groups (no preannotation needed) + class FilteredGraphInferenceFunctorNoGroups; + + /// A function object to pass into the GridSearch; + struct GridSearchEvaluator; + + /// Perform inference. Writes its results into proteins (as new score) and peptides. + void inferPosteriorProbabilities(std::vector& proteinIDs, std::vector& peptideIDs); + + private: + GridSearch grid{{0.008,0.032,0.128},{0.001},{0.5}}; + }; +} +#endif // OPENMS_ANALYSIS_ID_BAYESIANPROTEININFERENCE_H diff --git a/src/openms/include/OpenMS/ANALYSIS/ID/ConsensusIDAlgorithmSimilarity.h b/src/openms/include/OpenMS/ANALYSIS/ID/ConsensusIDAlgorithmSimilarity.h index 7e5fc590c93..81193fd1737 100644 --- a/src/openms/include/OpenMS/ANALYSIS/ID/ConsensusIDAlgorithmSimilarity.h +++ b/src/openms/include/OpenMS/ANALYSIS/ID/ConsensusIDAlgorithmSimilarity.h @@ -43,7 +43,7 @@ namespace OpenMS Similarity-based algorithms require posterior error probabilities (PEPs) as peptide scores, in order to combine scores and similarities into a consensus score for each peptide. See the following publication for the formula governing this calculation: - Nahnsen et al.: Probabilistic consensus scoring improves tandem mass spectrometry peptide identification (J. Proteome Res., 2011, PMID: 21644507). + Nahnsen et al.: Probabilistic consensus scoring improves tandem mass spectrometry peptide identification (J. Proteome Res., 2011, PMID: 21644507). Derived classes should implement getSimilarity_(), which defines how similarity of two peptide sequences is quantified. diff --git a/src/openms/include/OpenMS/ANALYSIS/ID/FalseDiscoveryRate.h b/src/openms/include/OpenMS/ANALYSIS/ID/FalseDiscoveryRate.h index 71350376797..abf3d5b97b8 100644 --- a/src/openms/include/OpenMS/ANALYSIS/ID/FalseDiscoveryRate.h +++ b/src/openms/include/OpenMS/ANALYSIS/ID/FalseDiscoveryRate.h @@ -77,37 +77,183 @@ namespace OpenMS void apply(std::vector & fwd_ids, std::vector & rev_ids) const; /** - @brief Calculates the FDR of one run from a concatenated sequence db search + @brief Calculates the FDR of one run from a concatenated sequence db search - @param id peptide identifications, containing target and decoy hits + @param id peptide identifications, containing target and decoy hits */ void apply(std::vector & id) const; /** - @brief Calculates the FDR of two runs, a forward run and decoy run on protein level + @brief Calculates the FDR of two runs, a forward run and decoy run on protein level - @param fwd_ids forward protein identifications - @param rev_ids reverse protein identifications + @param fwd_ids forward protein identifications + @param rev_ids reverse protein identifications */ - void apply(std::vector & fwd_ids, std::vector & rev_ids) const; + void apply(std::vector& fwd_ids, std::vector& rev_ids) const; /** - @brief Calculate the FDR of one run from a concatenated sequence db search + @brief Calculate the FDR of one run from a concatenated sequence db search + @param ids protein identifications, containing target and decoy hits + */ + void apply(std::vector& ids) const; + + /** + @brief Calculate the FDR based on PEPs pr PPs (if present) and modifies the IDs inplace + + @param ids protein identifications, containing PEP scores (not necessarily) annotated with target decoy. + */ + void applyEstimated(std::vector& ids) const; + + /** + @brief Calculate a linear combination of the area of the difference in estimated vs. empirical (TD) FDR + and the ROC-N value (AUC up to first N false positives). - @param ids protein identifications, containing target and decoy hits + @param ids protein identifications, containing PEP scores annotated with target decoy. If vector, only first will be evaluated- + @param pepCutoff up to which PEP should the differences between the two FDRs be calculated + @param fpCutoff up to which nr. of false positives should the target-decoy AUC be evaluated + @param diffWeight which weight should the difference get. The ROC-N value gets 1 - this weight. */ - void apply(std::vector & ids) const; + double applyEvaluateProteinIDs(const std::vector& ids, double pepCutoff = 1.0, UInt fpCutoff = 50, double diffWeight = 0.2); + double applyEvaluateProteinIDs(const ProteinIdentification& ids, double pepCutoff = 1.0, UInt fpCutoff = 50, double diffWeight = 0.2); + + void applyBasic(std::vector & ids); + void applyBasic(ProteinIdentification & id); + private: + ///Not implemented FalseDiscoveryRate(const FalseDiscoveryRate &); ///Not implemented FalseDiscoveryRate & operator=(const FalseDiscoveryRate &); - /// calculates the fdr stored into fdrs, given two vectors of scores - void calculateFDRs_(Map & score_to_fdr, std::vector & target_scores, std::vector & decoy_scores, bool q_value, bool higher_score_better) const; + //TODO we could add identifier here. If we need to combine runs. + void getScores_( + std::vector>& scores_labels, + const ProteinIdentification & id) const; + + void getScores_( + std::vector>& scores_labels, + const std::vector & ids, + bool all_hits, + int charge, String identifier) const; + + void getScores_( + std::vector>& scores_labels, + const std::vector & targets, + const std::vector & decoys, + bool all_hits, + int charge, + const String& identifier) const; + + void setScores_( + const std::map& scores_to_FDR, + std::vector & id, + const std::string& score_type, + bool higher_better) const; + + template + void setScores_(const std::map& scores_to_FDR, IDType & id, const std::string& score_type, bool higher_better) const + { + String old_score_type = id.getScoreType() + "_score"; + id.setScoreType(score_type); + id.setHigherScoreBetter(higher_better); + for (auto& hit : id.getHits()) + { + double old_score = hit.getScore(); + hit.setScore(scores_to_FDR.lower_bound(hit.getScore())->second); + hit.setMetaValue(old_score_type, old_score); + } + } + + template + void checkTDAnnotation_ (const IDType & id) const + { + for (auto const& hit : id.getHits()) + { + if (!hit.metaValueExists("target_decoy")) + { + throw Exception::MissingInformation(__FILE__, + __LINE__, + OPENMS_PRETTY_FUNCTION, + "Meta value 'target_decoy' does not exist in all ProteinHits! Reindex the idXML file with 'PeptideIndexer'"); + } + } + } + + template + struct GetLabelFunctor: std::function + { + bool operator() (const HitType& hit) + { + if (!hit.metaValueExists("target_decoy")) + { + throw Exception::MissingInformation(__FILE__, + __LINE__, + OPENMS_PRETTY_FUNCTION, + "Meta value 'target_decoy' does not exist in all ProteinHits! Reindex the idXML file with 'PeptideIndexer'"); + } + else + { + return std::string(hit.getMetaValue("target_decoy"))[0] == 't'; + } + } + }; + + template + struct TrueFunctor: std::function + { + bool operator() (const HitType& /*hit*/) + { + return true; + } + }; + + template + struct FalseFunctor: std::function + { + bool operator() (const HitType& /*hit*/) + { + return false; + } + }; + + + template + std::pair getScoreLabel_(const HitType& hit, std::function fun) const + { + return std::make_pair(hit.getScore(), fun(hit)); + } + + + /// calculates the fdr given two vectors of scores and fills a map for lookup in scores_to_FDR + void calculateFDRs_(Map& score_to_fdr, std::vector& target_scores, std::vector& decoy_scores, bool q_value, bool higher_score_better) const; + + /// calculates an estimated FDR (based on P(E)Ps) given a vector of score value pairs and fills a map for lookup + /// in scores_to_FDR + void calculateEstimatedQVal_(std::map &scores_to_FDR, + std::vector> &scores_labels, + bool higher_score_better) const; + + /// calculates the FDR with a basic and faster algorithm + void calculateFDRBasic_(std::map& scores_to_FDR, std::vector>& scores_labels, bool qvalue, bool higher_score_better); + + //TODO the next two methods could potentially be merged for speed (they iterate over the same structure) + //But since they have different cutoff types and it is more generic, I leave it like this. + /// calculates the area of the difference between estimated and empirical FDR on the fly. Does not store results. + double diffEstimatedEmpirical_(const std::vector>& scores_labels, double pepCutoff = 1.0); + /// calculates AUC of empirical FDR up to the first fpCutoff false positives on the fly. Does not store results. + double rocN_(std::vector> const &scores_labels, UInt fpCutoff = 50); + + /// calculates the error area around the x=x line between two consecutive values of expected and actual + /// i.e. it assumes exp2 > exp1 + double trapezoidal_area_xEqy(double exp1, double exp2, double act1, double act2); + + /// calculates the trapezoidal area for a trapezoid with a flat horizontal base e.g. for an AUC + double trapezoidal_area(double x1, double x2, double y1, double y2); + }; diff --git a/src/openms/include/OpenMS/ANALYSIS/ID/IDBoostGraph.h b/src/openms/include/OpenMS/ANALYSIS/ID/IDBoostGraph.h new file mode 100644 index 00000000000..6b47b186e72 --- /dev/null +++ b/src/openms/include/OpenMS/ANALYSIS/ID/IDBoostGraph.h @@ -0,0 +1,259 @@ +// -------------------------------------------------------------------------- +// OpenMS -- Open-Source Mass Spectrometry +// -------------------------------------------------------------------------- +// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen, +// ETH Zurich, and Freie Universitaet Berlin 2002-2017. +// +// This software is released under a three-clause BSD license: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of any author or any participating institution +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// For a full list of authors, refer to the file AUTHORS. +// -------------------------------------------------------------------------- +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING +// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// -------------------------------------------------------------------------- +// $Maintainer: Julianus Pfeuffer $ +// $Authors: Julianus Pfeuffer $ +// -------------------------------------------------------------------------- + +#ifndef OPENMS_ANALYSIS_ID_IDBOOSTGRAPH_H +#define OPENMS_ANALYSIS_ID_IDBOOSTGRAPH_H + +#include //included in BPI +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace OpenMS +{ + + /** + @brief Creates and maintains a boost graph based on the OpenMS ID datastructures + + For finding connected components and applying functions to them. + VERY IMPORTANT NOTE: If you add Visitors here, make sure they do not touch members of the + underlying ID objects that are responsible for the graph structure. E.g. the (protein/peptide)_hits vectors + or the lists in ProteinGroups. You can set information like scores or metavalues, though. + + @ingroup Analysis_ID + */ + class IDBoostGraph + { + + public: + + BOOST_STRONG_TYPEDEF(char, PeptideCluster) + BOOST_STRONG_TYPEDEF(char, ProteinGroup) + + //typedefs + //typedef ProteinIdentification::ProteinGroup ProteinGroup; + + typedef boost::variant IDPointer; + typedef boost::variant IDPointerConst; + //TODO check the impact of different datastructures to store nodes/edges (maybe also use directed graph?) + typedef boost::adjacency_list Graph; + typedef boost::adjacency_list GraphConst; + typedef boost::graph_traits::vertex_descriptor vertex_t; + typedef boost::graph_traits::edge_descriptor edge_t; + typedef boost::filtered_graph, boost::function > FilteredGraph; + + + /// Constructor + IDBoostGraph(ProteinIdentification &proteins, std::vector& idedSpectra); + + /// Do sth on connected components + void applyFunctorOnCCs(std::function functor); + void annotateIndistinguishableGroups(); + + + /// Visits nodes in the boost graph (ptrs to an ID Object) and depending on their type creates a label + class LabelVisitor: + public boost::static_visitor + { + public: + + OpenMS::String operator()(const PeptideHit* pep) const + { + return pep->getSequence().toUnmodifiedString(); + } + + OpenMS::String operator()(const ProteinHit* prot) const + { + return prot->getAccession(); + } + + OpenMS::String operator()(const ProteinGroup* /*protgrp*/) const + { + return String("PG"); + } + + OpenMS::String operator()(const PeptideCluster* /*pc*/) const + { + return String("PepClust"); + } + + }; + + /// Visits nodes in the boost graph (ptrs to an ID Object) and depending on their type prints the address. For debug + class PrintAddressVisitor: + public boost::static_visitor<> + { + public: + + void operator()(PeptideHit* pep) const + { + std::cout << pep->getSequence().toUnmodifiedString() << ": " << pep << std::endl; + } + + void operator()(ProteinHit* prot) const + { + std::cout << prot->getAccession() << ": " << prot << std::endl; + } + + void operator()(const ProteinGroup* protgrp) const + { + std::cout << "PG" << std::endl; + } + + void operator()(const PeptideCluster* /*pc*/) const + { + std::cout << "PepClust" << std::endl; + } + + }; + + /// Visits nodes in the boost graph (ptrs to an ID Object) and depending on their type sets the posterior + /// Don't forget to set higherScoreBetter and score names in the parent ID objects. + class SetPosteriorVisitor: + public boost::static_visitor<> + { + public: + + void operator()(PeptideHit* pep, double posterior) const + { + pep->setScore(posterior); + } + + void operator()(ProteinHit* prot, double posterior) const + { + std::cout << "set score " << posterior << " for " << prot->getAccession() << std::endl; + prot->setScore(posterior); + } + + void operator()(ProteinGroup* /*protgrp*/, double /*posterior*/) const + { + // do nothing + //protgrp->probability = posterior; + } + + void operator()(const PeptideCluster* /*pc*/, double /*posterior*/) const + { + // do nothing + } + + }; + + /// Visits nodes in the boost graph (ptrs to an ID Object) and depending on their type creates a random + /// variable or "Dependency" to add into the InferenceGraph + /*class DependencyVisitor: + public boost::static_visitor + { + public: + const MessagePasserFactory& mpf; + + DependencyVisitor(const MessagePasserFactory& mpf): + mpf(mpf) + {} + + Dependency operator()(const PeptideHit* pep, const std::vector& neighbors, const FilteredGraph& fg) const + { + std::vector incoming{}; + for (const auto& nb : neighbors) + { + if (fg[nb].which() <= 2) + { + incoming.push_back(nb); + } + } + if (incoming.size() != 1) + { + std::cerr << "Incoming nodes for pep are more than 1. Sth went wrong." << std::endl; + } + return mpf.createPeptideEvidenceFactor() + } + + Dependency operator()(const ProteinHit* prot, const std::vector& neighbors, const FilteredGraph& fg) const + { + return prot->getAccession(); + } + + Dependency operator()(const PeptideCluster* pc, const std::vector& neighbors, const FilteredGraph& fg) const + { + return pep->getSequence().toUnmodifiedString(); + } + + Dependency operator()(const ProteinGroup* pg, const std::vector& neighbors, const FilteredGraph& fg) const + { + return prot->getAccession(); + } + + };*/ + + /// Compute connected component on the static graph. Needs to be recomputed if graph is changed. + void computeConnectedComponents(); + + /// Initialize and store the graph + /// IMPORTANT: Once the graph is built, editing members like (protein/peptide)_hits_ will invalidate it! + /// @param protein ProteinIdentification object storing IDs and groups + /// @param idedSpectra vector of ProteinIdentifications with links to the proteins and PSMs in its PeptideHits + /// @param use_all_psms If all or just the FIRST psm should be used + void buildGraph(bool use_all_psms); + //void buildGraph(const ProteinIdentification& protein, const std::vector& peptides); + + private: + Graph g; + static PeptideCluster staticPC; + static ProteinGroup staticPG; + //GraphConst gconst; + ProteinIdentification& proteins_; + std::vector& idedSpectra_; + std::vector componentProperty_; + unsigned int numCCs_ = 0; + + vertex_t addVertexWithLookup_(IDPointer& ptr, std::unordered_map>& vertex_map); + //vertex_t addVertexWithLookup_(IDPointerConst& ptr, std::unordered_map>& vertex_map); + }; + + + +} //namespace OpenMS + +#endif // OPENMS_ANALYSIS_ID_IDBOOSTGRAPH_H diff --git a/src/openms/include/OpenMS/ANALYSIS/ID/IDConflictResolverAlgorithm.h b/src/openms/include/OpenMS/ANALYSIS/ID/IDConflictResolverAlgorithm.h index 004cd6f547f..794aa4bcbad 100644 --- a/src/openms/include/OpenMS/ANALYSIS/ID/IDConflictResolverAlgorithm.h +++ b/src/openms/include/OpenMS/ANALYSIS/ID/IDConflictResolverAlgorithm.h @@ -29,7 +29,7 @@ // // -------------------------------------------------------------------------- // $Maintainer: Hendrik Weisser $ -// $Authors: Hendrik Weisser, Lucia Espona $ +// $Authors: Hendrik Weisser, Lucia Espona, Moritz Freidank $ // -------------------------------------------------------------------------- #ifndef OPENMS_ANALYSIS_ID_IDCONFLICTRESOLVERALGORITHM @@ -59,8 +59,6 @@ using namespace std; The peptide identifications are filtered so that only one identification with a single hit (with the best score) is associated to each feature. (If two IDs have the same best score, either one of them may be selected.) - - */ namespace OpenMS @@ -81,7 +79,22 @@ class OPENMS_DLLAPI IDConflictResolverAlgorithm **/ static void resolve(ConsensusMap & features); + /** @brief In a single (feature/consensus) map, features with the same (possibly modified) sequence and charge state may appear. + This filter removes the peptide sequence annotations from features, if a higher-intensity feature with the same (charge, sequence) + combination exists in the map. The total number of features remains unchanged. In the final output, each (charge, sequence) combination + appears only once, i.e. no multiplicities. + **/ + static void resolveBetweenFeatures(FeatureMap & features); + + /** @brief In a single (feature/consensus) map, features with the same (possibly modified) sequence and charge state may appear. + This filter removes the peptide sequence annotations from features, if a higher-intensity feature with the same (charge, sequence) + combination exists in the map. The total number of features remains unchanged. In the final output, each (charge, sequence) combination + appears only once, i.e. no multiplicities. + **/ + static void resolveBetweenFeatures(ConsensusMap & features); + protected: + template static void resolveConflict_(T & map) { @@ -99,7 +112,7 @@ class OPENMS_DLLAPI IDConflictResolverAlgorithm c.getUniqueId()); } } - + // compare peptide IDs by score of best hit (hits must be sorted first!) // (note to self: the "static" is necessary to avoid cryptic "no matching // function" errors from gcc when the comparator is used below) @@ -110,6 +123,82 @@ class OPENMS_DLLAPI IDConflictResolverAlgorithm vector & peptides, vector & removed, UInt64 uid); + + template + static void resolveBetweenFeatures_(T & map) + { + // unassigned peptide identifications in this map + std::vector& unassigned = map.getUnassignedPeptideIdentifications(); + + // A std::map tracking the set of unique features. + // Uniqueness criterion/key is a pair for each feature. The peptide sequence may be modified, i.e. is not stripped. + typedef std::map, typename T::value_type*> FeatureSet; + FeatureSet feature_set; + + // Create a std::map `feature_set` mapping pairs to a pointer to + // the feature with the highest intensity for this sequence. + for (typename T::value_type& element : map) + { + std::vector& pep_ids = element.getPeptideIdentifications(); + + if (!pep_ids.empty()) + { + if (pep_ids.size() != 1) + { + // Should never happen. In IDConflictResolverAlgorithm TOPP tool + // IDConflictResolverAlgorithm::resolve() is called before IDConflictResolverAlgorithm::resolveBetweenFeatures(). + throw OpenMS::Exception::IllegalArgument(__FILE__, __LINE__, __FUNCTION__, "Feature does contain multiple identifications."); + } + + // Make sure best hit is in front, i.e. sort hits first. + pep_ids.front().sort(); + const std::vector& hits = pep_ids.front().getHits(); + + if (!hits.empty()) + { + const PeptideHit& highest_score_hit = hits.front(); + + // Pair of charge of the new feature and the sequence of its highest scoring peptide hit. + std::pair pair = std::make_pair(element.getCharge(), highest_score_hit.getSequence()); + + // If a pair is not yet in the FeatureSet or new feature `feature_in_set` + // has higher intensity than its counterpart `feature_set[]` + // store a pointer to `feature_in_set` in `feature_set`. + typename FeatureSet::iterator feature_in_set = feature_set.find(pair); + if (feature_in_set != feature_set.end()) + { + // Identical (charge, sequence) key found. Remove annotations from either the old or new feature. + + if (feature_in_set->second->getIntensity() < element.getIntensity()) + { + // Remove annotations from the old low-intensity feature. But only after moving these annotations to the unassigned list. + std::vector& obsolete = feature_in_set->second->getPeptideIdentifications(); + unassigned.insert(unassigned.end(), obsolete.begin(), obsolete.end()); + std::vector pep_ids_empty; + feature_in_set->second->setPeptideIdentifications(pep_ids_empty); + + // Replace feature in the set. + feature_in_set->second = &(element); + } + else + { + // Remove annotations from the new low-intensity feature. But only after moving these annotations to the unassigned list. + std::vector& obsolete = element.getPeptideIdentifications(); + unassigned.insert(unassigned.end(), obsolete.begin(), obsolete.end()); + std::vector pep_ids_empty; + element.setPeptideIdentifications(pep_ids_empty); + } + } + else + { + // Feature is not yet in our set -- add it. + feature_set[pair] = &(element); + } + } + } + } + } + }; } diff --git a/src/openms/include/OpenMS/ANALYSIS/ID/MessagePasserFactory.h b/src/openms/include/OpenMS/ANALYSIS/ID/MessagePasserFactory.h new file mode 100644 index 00000000000..b3ea4ea0509 --- /dev/null +++ b/src/openms/include/OpenMS/ANALYSIS/ID/MessagePasserFactory.h @@ -0,0 +1,262 @@ +// -------------------------------------------------------------------------- +// OpenMS -- Open-Source Mass Spectrometry +// -------------------------------------------------------------------------- +// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen, +// ETH Zurich, and Freie Universitaet Berlin 2002-2017. +// +// This software is released under a three-clause BSD license: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of any author or any participating institution +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// For a full list of authors, refer to the file AUTHORS. +// -------------------------------------------------------------------------- +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING +// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// -------------------------------------------------------------------------- +// $Maintainer: Julianus Pfeuffer $ +// $Authors: Julianus Pfeuffer $ +// -------------------------------------------------------------------------- + +#ifndef OPENMS_ANALYSIS_ID_MESSAGEPASSERFACTORY_HPP +#define OPENMS_ANALYSIS_ID_MESSAGEPASSERFACTORY_HPP + +#include +#include +#include + +typedef unsigned long int uiint; + +template +class MessagePasserFactory { +private: + const int minInputsPAF = 3; + double alpha, beta, gamma, p; + Label offset; + + inline double notConditionalGivenSum(double summ) { + return std::pow((1.0 - alpha), summ) * (1.0 - beta); + } + +public: + TableDependency
\c OPENMS_CONTRIB_LIBSSeperate search path for the contrib libraries from github.com/OpenMS/contrib that is internally considered before + Separate search path for the contrib libraries from github.com/OpenMS/contrib that is internally considered before CMAKE_PREFIX_PATH for searching, linking and adding include directories.