OpenMS
NuXLParameterParsing.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Timo Sachsenberg $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
18 #include <vector>
19 #include <map>
20 #include <set>
21 #include <iostream>
22 
23 namespace OpenMS
24 {
25 
26 // fast (flat) data structure to store feasible x-,y-,a-ion fragment adducts and observable marker ions
27 using NucleotideToFeasibleFragmentAdducts = std::pair<char, std::vector<NuXLFragmentAdductDefinition> >;
28 
29 // stores the fragment adducts and marker ions for a given precursor adduct
31 {
32  std::vector<NucleotideToFeasibleFragmentAdducts> feasible_adducts;
33  std::vector<NuXLFragmentAdductDefinition> marker_ions;
34 };
35 
36 // helper struct to facilitate parsing of parameters (modifications, nucleotide adducts, ...)
37 struct OPENMS_DLLAPI NuXLParameterParsing
38 {
40  static std::vector<ResidueModification> getModifications(StringList modNames);
41 
42  // Map a nucleotide (e.g. U to all possible fragment adducts)
43  using NucleotideToFragmentAdductMap = std::map<char, std::set<NuXLFragmentAdductDefinition> >;
44  // @brief Parse tool parameter to create map from target nucleotide to all its fragment adducts
45  // It maps a single letter nucleotide (e.g., 'T', 'C', ...)
46  // to the maximum set of fragment adducts that may arise if the nucleotide is cross-linked.
47  // Losses, that might reduce this set, are not considered in this data structure and handled later
48  // when specific precursor adducts are considered.
50 
51  // @brief Determines the fragment adducts and marker ions for a given precursor.
52  // The precursor adduct (the oligo including losses, e.g.: "TC-H3PO4") is mapped to all contained nucleotides
53  // and their marker ions. In addition, each cross-linkable nucleotide is mapped to its chemically feasible fragment adducts.
54  // Chemical feasible means in this context, that the fragment or marker ion adduct is a subformula of the precursor adduct.
56  const String& exp_pc_adduct,
57  const String& exp_pc_formula,
58  const NucleotideToFragmentAdductMap& nucleotide_to_fragment_adducts,
59  const std::set<char>& can_xl,
60  const bool always_add_default_marker_ions,
61  const bool default_marker_ions_RNA
62  );
63 
64  // Maps a precursor adduct (e.g.: "UU-H2O") to all chemically feasible fragment adducts.
65  using PrecursorsToMS2Adducts = std::map<std::string, MS2AdductsOfSinglePrecursorAdduct>;
66 
67  // @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)
68  static std::vector<NuXLFragmentAdductDefinition> getMarkerIonsMassSet(const PrecursorsToMS2Adducts& pc2adducts);
69 
70  // @brief Calculate all chemically feasible fragment adducts for all possible precursor adducts
71  // Same as getFeasibleFragmentAdducts but calculated from all precursor adducts
73  const NuXLModificationMassesResult& precursor_adducts,
74  const NucleotideToFragmentAdductMap& nucleotide_to_fragment_adducts,
75  const std::set<char>& can_xl,
76  const bool always_add_default_marker_ions,
77  const bool default_marker_ions_RNA
78  );
79 };
80 
81 }
82 
A more convenient string class.
Definition: String.h:34
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::vector< NucleotideToFeasibleFragmentAdducts > feasible_adducts
Definition: NuXLParameterParsing.h:32
std::pair< char, std::vector< NuXLFragmentAdductDefinition > > NucleotideToFeasibleFragmentAdducts
Definition: NuXLParameterParsing.h:27
std::vector< NuXLFragmentAdductDefinition > marker_ions
Definition: NuXLParameterParsing.h:33
Definition: NuXLParameterParsing.h:31
Definition: NuXLModificationsGenerator.h:34
Definition: NuXLParameterParsing.h:38
static std::vector< ResidueModification > getModifications(StringList modNames)
Query ResidueModifications (given as strings) from ModificationsDB.
static std::vector< NuXLFragmentAdductDefinition > getMarkerIonsMassSet(const PrecursorsToMS2Adducts &pc2adducts)
static NucleotideToFragmentAdductMap getTargetNucleotideToFragmentAdducts(StringList fragment_adducts)
static MS2AdductsOfSinglePrecursorAdduct getFeasibleFragmentAdducts(const String &exp_pc_adduct, const String &exp_pc_formula, const NucleotideToFragmentAdductMap &nucleotide_to_fragment_adducts, const std::set< char > &can_xl, const bool always_add_default_marker_ions, const bool default_marker_ions_RNA)
static PrecursorsToMS2Adducts getAllFeasibleFragmentAdducts(const NuXLModificationMassesResult &precursor_adducts, const NucleotideToFragmentAdductMap &nucleotide_to_fragment_adducts, const std::set< char > &can_xl, const bool always_add_default_marker_ions, const bool default_marker_ions_RNA)
std::map< std::string, MS2AdductsOfSinglePrecursorAdduct > PrecursorsToMS2Adducts
Definition: NuXLParameterParsing.h:65
std::map< char, std::set< NuXLFragmentAdductDefinition > > NucleotideToFragmentAdductMap
Definition: NuXLParameterParsing.h:43