| OpenMS 2.5.0

PrecursorIonSelectionPreprocessing.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-2020.
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: $
33 // --------------------------------------------------------------------------
34 //
35
36 #pragma once
37
38 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
39 #include <OpenMS/CHEMISTRY/AASequence.h>
40 #include <OpenMS/FORMAT/FASTAFile.h>
41 #include <OpenMS/KERNEL/FeatureMap.h>
42
43 #include <algorithm>
44 #include <cmath>
45 #include <set>
46 #include <fstream>
47 namespace OpenMS
48 {
49
55 class OPENMS_DLLAPI PrecursorIonSelectionPreprocessing :
56 public DefaultParamHandler
57 {
58 public:
59 PrecursorIonSelectionPreprocessing();
60 PrecursorIonSelectionPreprocessing(const PrecursorIonSelectionPreprocessing & source);
61 ~PrecursorIonSelectionPreprocessing() override;
62
63 PrecursorIonSelectionPreprocessing & operator=(const PrecursorIonSelectionPreprocessing & source);
64
65
66 const std::map<String, std::vector<double> > & getProtMasses() const;
67
68
69 const std::vector<double> & getMasses(String acc) const;
70
71 const std::map<String, std::vector<double> > & getProteinRTMap() const;
72 const std::map<String, std::vector<double> > & getProteinPTMap() const;
73 const std::map<String, std::vector<String> > & getProteinPeptideSequenceMap() const;
74
75
85 void dbPreprocessing(String db_path, bool save = true);
86
98 void dbPreprocessing(String db_path, String rt_model_path, String dt_model_path, bool save = true);
99
100
108 void loadPreprocessing();
109
111 double getWeight(double mass);
112
113 double getRT(String prot_id, Size peptide_index);
114
115 double getPT(String prot_id, Size peptide_index);
116
117 void setFixedModifications(StringList & modifications);
118 const std::map<char, std::vector<String> > & getFixedModifications()
119 {
120 return fixed_modifications_;
121 }
122
123 void setGaussianParameters(double mu, double sigma);
124 double getGaussMu()
125 {
126 return mu_;
127 }
128
129 double getGaussSigma()
130 {
131 return sigma_;
132 }
133
134 double getRTProbability(String prot_id, Size peptide_index, Feature & feature);
135 double getRTProbability(double pred_rt, Feature & feature);
136
137 protected:
139 void savePreprocessedDB_(String db_path, String path);
140 void savePreprocessedDBWithRT_(String db_path, String path);
142 void loadPreprocessedDB_(String path);
144 void filterTaxonomyIdentifier_(FASTAFile::FASTAEntry & entry);
145 Int getScanNumber_(double rt);
146 double getRTProbability_(double min_obs_rt, double max_obs_rt, double pred_rt);
148 void updateMembers_() override;
149
151 std::vector<double> masses_;
153 std::set<AASequence> sequences_;
155 std::map<String, std::vector<double> > prot_masses_;
157 std::vector<double> bin_masses_;
159 std::vector<UInt> counter_;
161 UInt f_max_;
162
163 bool fixed_mods_;
164 std::map<String, std::vector<double> > rt_prot_map_;
165 std::map<String, std::vector<double> > pt_prot_map_;
166 std::map<String, std::vector<String> > prot_peptide_seq_map_;
167 std::map<char, std::vector<String> > fixed_modifications_;
168 double sigma_;
169 double mu_;
170
171
172 };
173 }
174
OpenMS::Feature
An LC-MS feature.
Definition: Feature.h:70
OpenMS::PrecursorIonSelectionPreprocessing::mu_
double mu_
Definition: PrecursorIonSelectionPreprocessing.h:169
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::PrecursorIonSelectionPreprocessing::getGaussSigma
double getGaussSigma()
Definition: PrecursorIonSelectionPreprocessing.h:129
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
OpenMS::PrecursorIonSelectionPreprocessing::masses_
std::vector< double > masses_
all tryptic masses of the distinct peptides in the database
Definition: PrecursorIonSelectionPreprocessing.h:151
AASequence.h
OpenMS::PrecursorIonSelectionPreprocessing::bin_masses_
std::vector< double > bin_masses_
the masses of the bins used for preprocessing (only used if bins are not equidistant, i.e. with ppm)
Definition: PrecursorIonSelectionPreprocessing.h:157
OpenMS::PrecursorIonSelectionPreprocessing::pt_prot_map_
std::map< String, std::vector< double > > pt_prot_map_
Definition: PrecursorIonSelectionPreprocessing.h:165
OpenMS::PrecursorIonSelectionPreprocessing::counter_
std::vector< UInt > counter_
counter for the bins
Definition: PrecursorIonSelectionPreprocessing.h:159
OpenMS::PrecursorIonSelectionPreprocessing::f_max_
UInt f_max_
maximal relative frequency of a mass
Definition: PrecursorIonSelectionPreprocessing.h:161
OpenMS::PrecursorIonSelectionPreprocessing
This class implements the database preprocessing needing for precursor ion selection.
Definition: PrecursorIonSelectionPreprocessing.h:55
OpenMS::PrecursorIonSelectionPreprocessing::fixed_modifications_
std::map< char, std::vector< String > > fixed_modifications_
Definition: PrecursorIonSelectionPreprocessing.h:167
OpenMS::PrecursorIonSelectionPreprocessing::getFixedModifications
const std::map< char, std::vector< String > > & getFixedModifications()
Definition: PrecursorIonSelectionPreprocessing.h:118
OpenMS::PrecursorIonSelectionPreprocessing::fixed_mods_
bool fixed_mods_
Definition: PrecursorIonSelectionPreprocessing.h:163
FeatureMap.h
FASTAFile.h
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::FASTAFile::FASTAEntry
FASTA entry type (identifier, description and sequence)
Definition: FASTAFile.h:76
DefaultParamHandler.h
OpenMS::PrecursorIonSelectionPreprocessing::sigma_
double sigma_
Definition: PrecursorIonSelectionPreprocessing.h:168
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::PrecursorIonSelectionPreprocessing::rt_prot_map_
std::map< String, std::vector< double > > rt_prot_map_
Definition: PrecursorIonSelectionPreprocessing.h:164
OpenMS::PrecursorIonSelectionPreprocessing::getGaussMu
double getGaussMu()
Definition: PrecursorIonSelectionPreprocessing.h:124
OpenMS::PrecursorIonSelectionPreprocessing::prot_masses_
std::map< String, std::vector< double > > prot_masses_
stores masses of tryptic peptides for proteins, key is the accession number
Definition: PrecursorIonSelectionPreprocessing.h:155
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
int
OpenMS::PrecursorIonSelectionPreprocessing::prot_peptide_seq_map_
std::map< String, std::vector< String > > prot_peptide_seq_map_
Definition: PrecursorIonSelectionPreprocessing.h:166
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
OpenMS::PrecursorIonSelectionPreprocessing::sequences_
std::set< AASequence > sequences_
the sequences of the tryptic peptides
Definition: PrecursorIonSelectionPreprocessing.h:153