OpenMS  3.0.0
NuXLParameterParsing.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2018.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
44 #include <vector>
45 #include <map>
46 #include <set>
47 #include <iostream>
48 
49 namespace OpenMS
50 {
51 
52 // fast (flat) data structure to store feasible x-,y-,a-ion fragment adducts and observable marker ions
53 using NucleotideToFeasibleFragmentAdducts = std::pair<char, std::vector<NuXLFragmentAdductDefinition> >;
54 
55 // stores the fragment adducts and marker ions for a given precursor adduct
57 {
58  std::vector<NucleotideToFeasibleFragmentAdducts> feasible_adducts;
59  std::vector<NuXLFragmentAdductDefinition> marker_ions;
60 };
61 
62 // helper struct to facilitate parsing of parameters (modifications, nucleotide adducts, ...)
63 struct OPENMS_DLLAPI NuXLParameterParsing
64 {
66  static std::vector<ResidueModification> getModifications(StringList modNames);
67 
68  // Map a nucleotide (e.g. U to all possible fragment adducts)
69  using NucleotideToFragmentAdductMap = std::map<char, std::set<NuXLFragmentAdductDefinition> >;
70  // @brief Parse tool parameter to create map from target nucleotide to all its fragment adducts
71  // It maps a single letter nucleotide (e.g., 'T', 'C', ...)
72  // to the maximum set of fragment adducts that may arise if the nucleotide is cross-linked.
73  // Losses, that might reduce this set, are not considered in this data structure and handled later
74  // when specific precursor adducts are considered.
75  static NucleotideToFragmentAdductMap getTargetNucleotideToFragmentAdducts(StringList fragment_adducts);
76 
77  // @brief Determines the fragment adducts and marker ions for a given precursor.
78  // The precursor adduct (the oligo including losses, e.g.: "TC-H3PO4") is mapped to all contained nucleotides
79  // and their marker ions. In addition, each cross-linkable nucleotide is mapped to its chemically feasible fragment adducts.
80  // Chemical feasible means in this context, that the fragment or marker ion adduct is a subformula of the precursor adduct.
81  static MS2AdductsOfSinglePrecursorAdduct getFeasibleFragmentAdducts(
82  const String& exp_pc_adduct,
83  const String& exp_pc_formula,
84  const NucleotideToFragmentAdductMap& nucleotide_to_fragment_adducts,
85  const std::set<char>& can_xl,
86  const bool always_add_default_marker_ions,
87  const bool default_marker_ions_RNA
88  );
89 
90  // Maps a precursor adduct (e.g.: "UU-H2O") to all chemically feasible fragment adducts.
91  using PrecursorsToMS2Adducts = std::map<std::string, MS2AdductsOfSinglePrecursorAdduct>;
92 
93  // @brief extract all marker ions into a vector and make it unique according to mass. (e.g., used for matching agains all possible marker ions for MIC calculation)
94  static std::vector<NuXLFragmentAdductDefinition> getMarkerIonsMassSet(const PrecursorsToMS2Adducts& pc2adducts);
95 
96  // @brief Calculate all chemically feasible fragment adducts for all possible precursor adducts
97  // Same as getFeasibleFragmentAdducts but calculated from all precursor adducts
98  static PrecursorsToMS2Adducts getAllFeasibleFragmentAdducts(
99  const NuXLModificationMassesResult& precursor_adducts,
100  const NucleotideToFragmentAdductMap& nucleotide_to_fragment_adducts,
101  const std::set<char>& can_xl,
102  const bool always_add_default_marker_ions,
103  const bool default_marker_ions_RNA
104  );
105 };
106 
107 }
108 
std::pair< char, std::vector< NuXLFragmentAdductDefinition > > NucleotideToFeasibleFragmentAdducts
Definition: NuXLParameterParsing.h:53
A more convenient string class.
Definition: String.h:58
Definition: NuXLModificationsGenerator.h:59
Definition: NuXLParameterParsing.h:56
std::vector< NucleotideToFeasibleFragmentAdducts > feasible_adducts
Definition: NuXLParameterParsing.h:58
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
std::map< char, std::set< NuXLFragmentAdductDefinition > > NucleotideToFragmentAdductMap
Definition: NuXLParameterParsing.h:69
std::map< std::string, MS2AdductsOfSinglePrecursorAdduct > PrecursorsToMS2Adducts
Definition: NuXLParameterParsing.h:91
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
std::vector< NuXLFragmentAdductDefinition > marker_ions
Definition: NuXLParameterParsing.h:59
Definition: NuXLParameterParsing.h:63