From 0ad968ea9c0ecaced15dafb880b6c2029c81b793 Mon Sep 17 00:00:00 2001 From: Samuel Wein Date: Fri, 22 Oct 2021 12:09:39 +0200 Subject: [PATCH 1/5] added quick tutorial for hyperscoring, added NA mzml and fasta for future oligo tutorial --- docs/source/hyperscore.rst | 81 ++++++++ src/data/NucleicAcidSearchEngine_1.fasta | 8 + src/data/NucleicAcidSearchEngine_1.mzML | 249 +++++++++++++++++++++++ 3 files changed, 338 insertions(+) create mode 100644 docs/source/hyperscore.rst create mode 100644 src/data/NucleicAcidSearchEngine_1.fasta create mode 100644 src/data/NucleicAcidSearchEngine_1.mzML diff --git a/docs/source/hyperscore.rst b/docs/source/hyperscore.rst new file mode 100644 index 000000000..bb7e36f86 --- /dev/null +++ b/docs/source/hyperscore.rst @@ -0,0 +1,81 @@ +Scoring spectra with HyperScore +=============================== + +In the event that we want to generate scores from directly comparing theoretical and experimental spectra, +we can use HyperScore. + +Background +********** + +HyperScore computes the (ln transformed) X!Tandem HyperScore of theoretical spectrum, +calculated from a peptide/oligonucleotide sequence, with an experimental spectrum, +loaded from an mzML file. + + 1. the dot product of peak intensities between matching peaks in experimental and theoretical spectrum is calculated + 2. the HyperScore is calculated from the dot product by multiplying by factorials of matching b- and y-ions + +.. code-block:: python + + from urllib.request import urlretrieve + from pyopenms import * + gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-extra/master" + urlretrieve (gh +"/src/data/SimpleSearchEngine_1.mzML", "searchfile.mzML") + +Generate a theoretical spectrum +******************************* + +We now use the TheoreticalSpectrumGenerator generate a theoretical spectrum for the sequence we are interested in, +``RPGADSDIGGFGGLFDLAQAGFR``, and compare the peaks to a spectra from our file. + + +.. code-block:: python + + tsg = TheoreticalSpectrumGenerator() + thspec = MSSpectrum() + p = Param() + p.setValue("add_metainfo", "true") + tsg.setParameters(p) + peptide = AASequence.fromString("RPGADSDIGGFGGLFDLAQAGFR") + tsg.getSpectrum(thspec, peptide, 1, 1) + # Iterate over annotated ions and their masses + for ion, peak in zip(thspec.getStringDataArrays()[0], thspec): + print(ion, peak.getMZ()) + + e = MSExperiment() + MzMLFile().load("searchfile.mzML", e) + spectrum_of_interest = e[2] + print ("Spectrum native id", spectrum_of_interest.getNativeID() ) + mz,i = spectrum_of_interest.get_peaks() + peaks = [(mz,i) for mz,i in zip(mz,i) if i > 1500 and mz > 300] + for peak in peaks: + print (peak[0], "mz", peak[1], "int") + +Comparing the theoretical spectrum and the experimental spectrum for +``RPGADSDIGGFGGLFDLAQAGFR`` we can easily see that the most abundant ions in the +spectrum are y8 (877.452 m/z), b10 (926.432), y9 (1024.522 m/z) and b13 +(1187.544 m/z). + +Getting a score +*************** + +We now run HyperScore to compute the similarity of the theoretical spectrum +and the experimental spectrum and print the result + + +.. code-block:: python + + hscore = HyperScore() + fragment_mass_tolerance = 5.0 + is_tol_in_ppm = True + result = hscore.compute(fragment_mass_tolerance, is_tol_in_ppm, spectrum_of_interest, thspec) + result + +If we didn't know ahead of time which spectrum was a match we can loop through all the spectra from our file, + calculate scores for all of them, and print the result: + +.. code-block:: python + + for f in e: + score = hscore.compute(fragment_mass_tolerance, is_tol_in_ppm, f, thspec) + print(f.getNativeID() + ":" + str(score) ) + diff --git a/src/data/NucleicAcidSearchEngine_1.fasta b/src/data/NucleicAcidSearchEngine_1.fasta new file mode 100644 index 000000000..c99623ae4 --- /dev/null +++ b/src/data/NucleicAcidSearchEngine_1.fasta @@ -0,0 +1,8 @@ +>dme-let-7-5p MIMAT0000396 Drosophila melanogaster let-7-5p +UGAGGUAGUAGGUUGUAUAGU +>DECOY_dme-let-7-5p MIMAT0000396 Drosophila melanogaster let-7-5p +UGAUAUGUUGGAUGAUGGAGU +>dme-let-7-5p-methyl MIMAT0000396 Drosophila melanogaster let-7-5p +UGAGGUAGUAGGUUGUAUAG[Um] +>DECOY_dme-let-7-5p-methyl MIMAT0000396 Drosophila melanogaster let-7-5p +[Um]GAUAUGUUGGAUGAUGGAGU diff --git a/src/data/NucleicAcidSearchEngine_1.mzML b/src/data/NucleicAcidSearchEngine_1.mzML new file mode 100644 index 000000000..d5a765dab --- /dev/null +++ b/src/data/NucleicAcidSearchEngine_1.mzML @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AAAAoNkBaUAAAAAAeHxpQAAAAMAHYGpAAAAAQOp/akAAAACga8BqQAAAAACvgWxAAAAAIEbAbEAAAACAhtxtQAAAAAD1h25AAAAAYAfCbkAAAADgZfFuQAAAAEBJ3m9AAAAAwD4xcEAAAADAMmBwQAAAAID4z3BAAAAAwFAPcUAAAABAXh9xQAAAAKBcgHFAAAAAgB7wcUAAAADg6hVyQAAAAIB9L3JAAAAAoNyjckAAAAAgSRBzQAAAAKBVIHNAAAAAoFBAc0AAAABgjWBzQAAAAEB0MHRAAAAAgINAdEAAAACAd2B0QAAAAOCJcHRAAAAAALiAdEAAAAAgme50QAAAACCjgHVAAAAAAOOgdUAAAAAgN4Z2QAAAAMDOoHZAAAAAwJLvdkAAAACAog93QAAAAKC9D3hAAAAAIM0feEAAAAAg0S94QAAAAGD/X3hAAAAA4J4QeUAAAAAA6i95QAAAAED5P3lAAAAAgOxfeUAAAACALoB5QAAAAIA3kHlAAAAAwK6keUAAAADAK615QAAAAAC4rXlAAAAAoPKteUAAAACAyTB6QAAAAGDbf3pAAAAAABmAekAAAADAWaB6QAAAAMD0UHtAAAAAQPuAe0AAAACAOqF7QAAAAIAL73tAAAAAQB8PfEAAAACAJqF8QAAAAIDq73xAAAAAoDUPfUAAAABgRC99QAAAAEB4X31AAAAAQFLBfUAAAABgFxB+QAAAAMAkIH5AAAAAg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kbOI6xFpuogRk6WVUeERZNGlsXbRbTrk0b8LR1HWYfeRf92vEV0CuFF6SkdRo5ZykV2bstFPrTdRvROGEYcDSRGCJkDRmIdtUaSd+9Fob+oRUJHG0eodING/VqwRSQFyUaYPfpFUaXzRsSGmUU+YupFqjAFRsJjkEaH3wlGCdqpRbHx6kbG9bxF1ivXRq0R1EVQdshFZasERga6dUegSgVHMZ++RReX50abxd5F6+zRRal+yEV8cg1GFImiRZINykXowpRGZValRW5wFkaDdcNFyD7ORQFP6EXdpM5GHn2SRpnohEa0VRlGNwG2RaJiFUYe1QVHNAz4RXwYn0X5fLtF7MHFRTiTs0WXc9tFTcynRVMMzEUqocRF + + + + + + + + + 13686 + + +24901 +0 + \ No newline at end of file From b64bcf2c8aa5486072c668c1ab01e93470736c85 Mon Sep 17 00:00:00 2001 From: Samuel Wein Date: Fri, 22 Oct 2021 14:58:53 +0200 Subject: [PATCH 2/5] fix capitalization and linking issues --- docs/source/build_from_source.rst | 2 +- docs/source/chemistry.rst | 2 +- docs/source/chromatographic_analysis.rst | 2 +- docs/source/index.rst | 2 +- docs/source/metabolomics_targeted_feature_extraction.rst | 2 +- docs/source/normalization.rst | 2 +- docs/source/pyopenms_in_r.rst | 6 +++--- docs/source/wrap_classes.rst | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/source/build_from_source.rst b/docs/source/build_from_source.rst index a5dd2d0ce..0c2e62752 100644 --- a/docs/source/build_from_source.rst +++ b/docs/source/build_from_source.rst @@ -5,7 +5,7 @@ To install pyOpenMS from :index:`source`, you will first have to compile OpenMS successfully on your platform of choice (note that for MS Windows you will need to match your compiler and Python version). Please follow the `official documenation -`_ +`_ in order to compile OpenMS for your platform. Next you will need to install the following software packages diff --git a/docs/source/chemistry.rst b/docs/source/chemistry.rst index 656558ce6..0e8fa443c 100644 --- a/docs/source/chemistry.rst +++ b/docs/source/chemistry.rst @@ -351,7 +351,7 @@ Hydrogen clearly distinguished while the coarse (unit resolution) isotopic distribution contains summed probabilities for each isotopic peak without the hyperfine resolution. -Please refer to our previous discussion on the `mass defect <#mass-defect>`_ to understand the +Please refer to our previous discussion on the `mass defect <#Mass-Defect>`_ to understand the results of the hyperfine algorithm and why different elements produce slightly different masses. In this example, the hyperfine isotopic distribution will diff --git a/docs/source/chromatographic_analysis.rst b/docs/source/chromatographic_analysis.rst index 008ccc0c8..d96c6d4cf 100644 --- a/docs/source/chromatographic_analysis.rst +++ b/docs/source/chromatographic_analysis.rst @@ -5,7 +5,7 @@ In targeted proteomics, such as SRM / MRM / PRM / DIA applications, groups of chromatograms need to be analyzed frequently. OpenMS provides several powerful tools for analysis of chromatograms. Most of them are part of the OpenSWATH suite of tools and are also discussed in the `OpenSwath documentation -`_. +`_. Peak Detection ************** diff --git a/docs/source/index.rst b/docs/source/index.rst index 9d7936602..c9dfaac8f 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,7 +10,7 @@ pyOpenMS is an open-source Python library for mass spectrometry, specifically fo PyOpenMS provides functionality that is commonly used in computational mass spectrometry. The pyOpenMS package contains Python bindings for a large part of the OpenMS -library (http://www.open-ms.de) for mass spectrometry based proteomics. It thus +library (http://www.openms.de) for mass spectrometry based proteomics. It thus provides facile access to a feature-rich, open-source algorithm library for mass-spectrometry based proteomics analysis. diff --git a/docs/source/metabolomics_targeted_feature_extraction.rst b/docs/source/metabolomics_targeted_feature_extraction.rst index 0a3b48237..ade83c98d 100644 --- a/docs/source/metabolomics_targeted_feature_extraction.rst +++ b/docs/source/metabolomics_targeted_feature_extraction.rst @@ -6,7 +6,7 @@ specified in an assay library (a tab-separated text file). Detected ``Features`` stored in a ``FeatureXMLFile``. This tool is useful for the targeted extraction of ``Features`` for a well defined set of compounds with known sum formulas and retention times. For more information on the format of the assay library and available parameters visit the `FeatureFinderMetaboIdent documentation -`_. +`_. The pyOpenMS ``FeatureFinderAlgorithmMetaboIdent`` needs a list of ``FeatureFinderMetaboIdentCompound`` objects as an assay libray for it's diff --git a/docs/source/normalization.rst b/docs/source/normalization.rst index 744e631e8..bfe3614d0 100644 --- a/docs/source/normalization.rst +++ b/docs/source/normalization.rst @@ -1,7 +1,7 @@ Spectrum normalization ====================== -Another very basic spectrum processing step is normalization by base peak intensity (=the maximum intensity of a spectrum). +Another very basic spectrum processing step is normalization by base peak intensity (the maximum intensity of a spectrum). Let's first load the raw data. diff --git a/docs/source/pyopenms_in_r.rst b/docs/source/pyopenms_in_r.rst index 7de2597cc..11c85a916 100644 --- a/docs/source/pyopenms_in_r.rst +++ b/docs/source/pyopenms_in_r.rst @@ -91,7 +91,7 @@ In this case, the help function indicates that the ``idXML$load()`` function req - an empty vector for pyopenms.ProteinIdentification objects - an empty vector for pyopenms.PeptideIdentification objects -In order to read peptide identification data, we can download the `idXML example file `_ +In order to read peptide identification data, we can download the `idXML example file `_ Creating an empty R ``list()`` unfortunately is not equal to the empty python ``list []``. @@ -131,11 +131,11 @@ Reading an mzML File pyOpenMS supports a variety of different files through the implementations in OpenMS. In order to read mass spectrometric data, we can download the `mzML -example file `_ +example file `_ .. code-block:: R - download.file("https://github.com/OpenMS/OpenMS/raw/master/share/OpenMS/examples/BSA/BSA1.mzML", "BSA1.mzML") + download.file("https://raw.githubusercontent.com/OpenMS/OpenMS/develop/share/OpenMS/examples/BSA/BSA1.mzML", "BSA1.mzML") library(reticulate) ropenms=import("pyopenms", convert = FALSE) diff --git a/docs/source/wrap_classes.rst b/docs/source/wrap_classes.rst index e8fe1e7d1..3571a3528 100644 --- a/docs/source/wrap_classes.rst +++ b/docs/source/wrap_classes.rst @@ -48,7 +48,7 @@ Open it and add your new function *with the correct indentation*: - Ex: ``T*`` will stay ``T*`` (indicating ``T`` needs to copied back to Python) - One exception is ``OpenMS::String``, you can leave ``const String&`` as-is - STL constructs are replaced with Cython constructs: ``std::vector`` becomes ``libcpp_vector[ X ]`` etc. -- Most complex STL constructs can be wrapped even if they are nested, however mixing them with user-defined types does not always work, see Limitations_ below. Nested ``std::vector`` constructs work well even with user-defined (OpenMS-defined) types. However, ``std::map`` does not work (since ``String`` is user-defined, however a primitive C++ type such as ``std::map`` would work). +- Most complex STL constructs can be wrapped even if they are nested, however mixing them with user-defined types does not always work, see `Limitations <#Limitations>`_ below. Nested ``std::vector`` constructs work well even with user-defined (OpenMS-defined) types. However, ``std::map`` does not work (since ``String`` is user-defined, however a primitive C++ type such as ``std::map`` would work). - Python cannot pass primitive data types by reference (therefore no ``int& res1``) - Replace ``boost::shared_ptr`` with ``shared_ptr[X]`` and add ``from smart_ptr cimport shared_ptr`` to the top - Public members are simply added with ``Type member_name`` @@ -271,7 +271,7 @@ itself, allowing us to call C++ functions on both pointers. This makes it easy to generate the required iterators and process the container efficiently. -.. _Limitations: +.. _Limitations Section: Considerations and limitations ------------------------------ From 0808ad48bb86a9a762be5b6d8896efb2e218e5bd Mon Sep 17 00:00:00 2001 From: Samuel Wein Date: Fri, 14 Jan 2022 12:10:36 +0100 Subject: [PATCH 3/5] updated wrapclasses --- docs/source/wrap_classes.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/wrap_classes.rst b/docs/source/wrap_classes.rst index 3571a3528..2637dc86c 100644 --- a/docs/source/wrap_classes.rst +++ b/docs/source/wrap_classes.rst @@ -58,13 +58,13 @@ Open it and add your new function *with the correct indentation*: - Warning: For a single-line comment, there should not be a space between wrap-doc and the following comment. - Note: The space between the hash and wrap-doc (# wrap-doc) is not necessary, but used for consistency. - Note: Please start the comment with a caplital letter. - -See the next section for a SimpleExample_ and a more AdvancedExample_ of a wrapped class with several functions. + +See the next section for a `simple example <#Simple-Example>`_ and a more AdvancedExample_ of a wrapped class with several functions. How to wrap new classes ^^^^^^^^^^^^^^^^^^^^^^^ -.. _SimpleExample: +.. _Simple Example: A simple example ---------------- From d05f37b31b5ae02b5c7174813481dabb8d623a83 Mon Sep 17 00:00:00 2001 From: Samuel Wein Date: Thu, 27 Oct 2022 12:26:39 +0200 Subject: [PATCH 4/5] Create wrap_classes.rst --- docs/source/wrap_classes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/wrap_classes.rst b/docs/source/wrap_classes.rst index 2637dc86c..ddad3875e 100644 --- a/docs/source/wrap_classes.rst +++ b/docs/source/wrap_classes.rst @@ -59,7 +59,7 @@ Open it and add your new function *with the correct indentation*: - Note: The space between the hash and wrap-doc (# wrap-doc) is not necessary, but used for consistency. - Note: Please start the comment with a caplital letter. -See the next section for a `simple example <#Simple-Example>`_ and a more AdvancedExample_ of a wrapped class with several functions. +See the next section for a `simple example <#Simple-Example>`_ and a more `advanced example <#AdvancedExample>`_ of a wrapped class with several functions. How to wrap new classes ^^^^^^^^^^^^^^^^^^^^^^^ From 64504ca8aa5a586639cdafab867fba4d8c2100b3 Mon Sep 17 00:00:00 2001 From: Samuel Wein Date: Sun, 25 Feb 2024 11:39:58 +0200 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- docs/source/hyperscore.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/hyperscore.rst b/docs/source/hyperscore.rst index 3ff5eca8c..856102a08 100644 --- a/docs/source/hyperscore.rst +++ b/docs/source/hyperscore.rst @@ -25,7 +25,7 @@ loaded from an mzML file. from pyopenms import * gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-docs/master" - urlretrieve (gh + "/src/data/SimpleSearchEngine_1.mzML", "searchfile.mzML") + urlretrieve(gh + "/src/data/SimpleSearchEngine_1.mzML", "searchfile.mzML") Generate a theoretical spectrum @@ -52,11 +52,11 @@ We now use the TheoreticalSpectrumGenerator to generate a theoretical spectrum f e = MSExperiment() MzMLFile().load("searchfile.mzML", e) spectrum_of_interest = e[2] - print ("Spectrum native id", spectrum_of_interest.getNativeID() ) - mz,i = spectrum_of_interest.get_peaks() - peaks = [(mz,i) for mz,i in zip(mz,i) if i > 1500 and mz > 300] + print("Spectrum native id", spectrum_of_interest.getNativeID()) + mz, i = spectrum_of_interest.get_peaks() + peaks = [(mz, i) for mz, i in zip(mz, i) if i > 1500 and mz > 300] for peak in peaks: - print (peak[0], "mz", peak[1], "int") + print(peak[0], "mz", peak[1], "int") Comparing the theoretical spectrum and the experimental spectrum for ``RPGADSDIGGFGGLFDLAQAGFR`` we can easily see that the most abundant ions in the @@ -85,5 +85,5 @@ If we didn't know ahead of time which spectrum was a match we can loop through a for f in e: score = hscore.compute(fragment_mass_tolerance, is_tol_in_ppm, f, thspec) - print(f.getNativeID() + ":" + str(score) ) + print(f.getNativeID() + ":" + str(score))