OpenMS
Loading...
Searching...
No Matches
NuXLModificationsGenerator.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, 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
15#include <vector>
16#include <map>
17#include <set>
18#include <iostream>
19#include <iterator>
20
21namespace OpenMS
22{
23 class AASequence;
24 class Residue;
25 class ResidueModification;
26
43 {
46 {
47 bool operator () (const std::string & p_lhs, const std::string & p_rhs) const
48 {
49 const size_t lhsLength = p_lhs.length() ;
50 const size_t rhsLength = p_rhs.length() ;
51 if(lhsLength == rhsLength)
52 {
53 return (p_lhs < p_rhs) ; // when two strings have the same
54 // length, defaults to the normal
55 // string comparison
56 }
57 return (lhsLength < rhsLength) ; // compares with the length
58 }
59 };
60 std::map<std::string, double> formula2mass;
61
63 using NucleotideFormulas = std::set<std::string, MyStringLengthCompare>;
65 using MapSumFormulaToNucleotideFormulas = std::map<std::string, NucleotideFormulas>;
67
70 {
71 const std::string* sum_formula = nullptr;
72 const std::string* adduct = nullptr;
73 };
74
83 PrecursorAdduct findPrecursorAdduct(Size NA_mod_index, Size NA_adduct_amb_index) const
84 {
85 if (NA_mod_index >= mod_combinations.size()) { return {}; }
86 auto mod_combinations_it = std::next(mod_combinations.cbegin(), NA_mod_index);
87 if (NA_adduct_amb_index >= mod_combinations_it->second.size()) { return {}; }
88 return {&mod_combinations_it->first, &*std::next(mod_combinations_it->second.cbegin(), NA_adduct_amb_index)};
89 }
90 };
91
113 {
114 public:
161 const StringList& nt_groups,
162 const std::set<char>& can_xl,
163 const StringList& mappings,
164 const StringList& modifications,
165 std::string sequence_restriction = "",
166 bool cysteine_adduct = false,
167 Int max_length = 4);
168
181 static const ResidueModification* registerPrecursorAdduct(const std::string& nucleotide_composition,
182 const EmpiricalFormula& adduct_formula,
183 const Residue& residue);
184 private:
193 static bool notInSeq(const std::string& res_seq, const std::string& query);
194
207 static void generateTargetSequences(const std::string& res_seq, Size param_pos, const std::map<char, std::vector<char> >& map_source2target, StringList& target_sequences);
208 };
209}
210
Representation of an empirical formula.
Definition EmpiricalFormula.h:62
Enumerator of precursor-adduct masses for NuXL cross-link searches.
Definition NuXLModificationsGenerator.h:113
static bool notInSeq(const std::string &res_seq, const std::string &query)
Test whether query is not present as a sorted-window permutation of res_seq.
Definition NuXLModificationsGenerator.cpp:64
static void generateTargetSequences(const std::string &res_seq, Size param_pos, const std::map< char, std::vector< char > > &map_source2target, StringList &target_sequences)
Recursively expand res_seq into every target-substituted variant according to map_source2target.
Definition NuXLModificationsGenerator.cpp:540
static NuXLModificationMassesResult initModificationMassesNA(const StringList &target_nucleotides, const StringList &nt_groups, const std::set< char > &can_xl, const StringList &mappings, const StringList &modifications, std::string sequence_restriction="", bool cysteine_adduct=false, Int max_length=4)
Build the full set of precursor adducts (formula + mass + nucleotide composition) for the given confi...
Definition NuXLModificationsGenerator.cpp:84
static const ResidueModification * registerPrecursorAdduct(const std::string &nucleotide_composition, const EmpiricalFormula &adduct_formula, const Residue &residue)
Register the precursor adduct as a named modification of residue.
Definition NuXLModificationsGenerator.cpp:26
Representation of a modification on an amino acid residue.
Definition ResidueModification.h:55
Representation of an amino acid residue.
Definition Residue.h:41
int Int
Signed integer type.
Definition Types.h:72
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition TypeAliases.h:39
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Comparator that orders strings primarily by length (shortest first) and lexicographically within the ...
Definition NuXLModificationsGenerator.h:46
bool operator()(const std::string &p_lhs, const std::string &p_rhs) const
Definition NuXLModificationsGenerator.h:47
Result of NuXLModificationsGenerator::initModificationMassesNA — empirical formulas with their monois...
Definition NuXLModificationsGenerator.h:43
std::set< std::string, MyStringLengthCompare > NucleotideFormulas
Length-ordered set of nucleotide-composition strings producing the same empirical formula.
Definition NuXLModificationsGenerator.h:63
const std::string * adduct
Entry in the set of nucleotide compositions with that sum formula, nullptr if not found.
Definition NuXLModificationsGenerator.h:72
MapSumFormulaToNucleotideFormulas mod_combinations
Empirical formula → all nucleotide compositions yielding that formula (kept as a set because mutation...
Definition NuXLModificationsGenerator.h:66
PrecursorAdduct findPrecursorAdduct(Size NA_mod_index, Size NA_adduct_amb_index) const
Looks up the precursor adduct that a hit refers to by its indices.
Definition NuXLModificationsGenerator.h:83
const std::string * sum_formula
Key in mod_combinations, nullptr if not found.
Definition NuXLModificationsGenerator.h:71
std::map< std::string, NucleotideFormulas > MapSumFormulaToNucleotideFormulas
Empirical formula → NucleotideFormulas.
Definition NuXLModificationsGenerator.h:65
std::map< std::string, double > formula2mass
Empirical formula → monoisotopic mass.
Definition NuXLModificationsGenerator.h:60
Sum formula and precursor adduct (nucleotide composition) returned by findPrecursorAdduct.
Definition NuXLModificationsGenerator.h:70