Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
PrecursorIonSelection.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-2017.
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 #ifndef OPENMS_ANALYSIS_TARGETED_PRECURSORIONSELECTION_H
37 #define OPENMS_ANALYSIS_TARGETED_PRECURSORIONSELECTION_H
38 
42 #include <set>
43 
44 namespace OpenMS
45 {
46  class PrecursorIonSelectionPreprocessing;
47  class PSProteinInference;
53  class OPENMS_DLLAPI PrecursorIonSelection :
54  public DefaultParamHandler
55  {
56 public:
57 
75  enum Type
76  {
77  IPS,
79  SPS,
82  DEX
83  };
84 
88 
89  const double & getMaxScore() const;
90  void setMaxScore(const double & max_score);
91 
92 
94  struct TotalScoreMore :
95  std::binary_function<Feature, Feature, bool>
96  {
97  inline bool operator()(Feature const & left, Feature const & right) const
98  {
99  return (double)left.getMetaValue("msms_score") > (double)right.getMetaValue("msms_score");
100  }
101 
102  };
103 
106  std::binary_function<Feature, Feature, bool>
107  {
108  inline bool operator()(Feature const & left, Feature const & right) const
109  {
110  if (left.getRT() < right.getRT()) return true;
111  else if (left.getRT() > right.getRT()) return false;
112  else return (double)left.getMetaValue("msms_score") > (double)right.getMetaValue("msms_score");
113  }
114 
115  };
116 
117 
121  void sortByTotalScore(FeatureMap & features)
122  {
123  FeatureMap::Iterator beg = features.begin();
124  FeatureMap::Iterator end = features.end();
125  std::sort(beg, end, TotalScoreMore());
126  }
127 
135  void getNextPrecursors(FeatureMap & features, FeatureMap & next_features, UInt number);
136  void getNextPrecursorsSeq(FeatureMap & features, FeatureMap & next_features, UInt number, double & rt);
137  void getNextPrecursors(std::vector<Int> & solution_indices, std::vector<PSLPFormulation::IndexTriple> & variable_indices, std::set<Int> & measured_variables,
138  FeatureMap & features, FeatureMap & new_features, UInt step_size, PSLPFormulation & ilp);
139 
140 // /**
141 // @brief Change scoring of features using peptide identifications only from spectra of the last
142 // iteration
143 //
144 // @param features FeatureMap with all possible precursors
145 // @param new_pep_ids Peptide identifications
146 // @param preprocessed_db Information from preprocessed database
147 //
148 // */
149 // void rescoreIncremental(FeatureMap& features,std::vector<PeptideIdentification>& new_pep_ids,
150 // std::vector<ProteinIdentification>& prot_ids,
151 // PrecursorIonSelectionPreprocessing& preprocessed_db);
152 
153 
163  void rescore(FeatureMap & features, std::vector<PeptideIdentification> & new_pep_ids,
164  std::vector<ProteinIdentification> & prot_ids,
165  PrecursorIonSelectionPreprocessing & preprocessed_db, bool check_meta_values = true);
166 
167 
178  void simulateRun(FeatureMap & features, std::vector<PeptideIdentification> & pep_ids,
179  std::vector<ProteinIdentification> & prot_ids,
180  PrecursorIonSelectionPreprocessing & preprocessed_db,
181  String path, PeakMap & experiment, String precursor_path = "");
182 
184  {
185  solver_ = solver;
186  std::cout << " LPSolver set to " << solver_ << std::endl;
187  }
188 
190  {
191  return solver_;
192  }
193 
194  void reset();
195 
196  const std::map<String, std::set<String> > & getPeptideProteinCounter()
197  {
198  return prot_id_counter_;
199  }
200 
201 private:
202  void simulateILPBasedIPSRun_(FeatureMap & features, PeakMap & experiment,
203  std::vector<PeptideIdentification> & pep_ids,
204  std::vector<ProteinIdentification> & prot_ids,
205  PrecursorIonSelectionPreprocessing & preprocessed_db,
206  String output_path, String precursor_path = "");
207 
208  void simulateRun_(FeatureMap & features, std::vector<PeptideIdentification> & pep_ids,
209  std::vector<ProteinIdentification> & prot_ids,
210  PrecursorIonSelectionPreprocessing & preprocessed_db, String path, String precursor_path = "");
211 
212  void shiftDown_(FeatureMap & features, PrecursorIonSelectionPreprocessing & preprocessed_db, String protein_acc);
213 
214  void shiftUp_(FeatureMap & features, PrecursorIonSelectionPreprocessing & preprocessed_db, String protein_acc);
215 
217  void updateMembers_();
218 
219  void rescore_(FeatureMap & features, std::vector<PeptideIdentification> & new_pep_ids,
220  PrecursorIonSelectionPreprocessing & preprocessed_db, PSProteinInference & protein_inference);
221 
227  void checkForRequiredUserParams_(FeatureMap & features);
228 
234  UInt filterProtIds_(std::vector<ProteinIdentification> & prot_ids);
235 
236  std::vector<PeptideIdentification> filterPeptideIds_(std::vector<PeptideIdentification> & pep_ids);
237 
238  void convertPeptideIdScores_(std::vector<PeptideIdentification> & pep_ids);
239 
243  double max_score_;
247  std::map<String, std::set<String> > prot_id_counter_;
249  std::vector<Size> fraction_counter_;
257 
259 
260  };
261 
262 }
263 
264 #endif // #ifndef OPENMS_ANALYSIS_ID_PRECURSORIONSELECTION_H
Definition: PrecursorIonSelection.h:77
void setLPSolver(LPWrapper::SOLVER solver)
Definition: PrecursorIonSelection.h:183
LPWrapper::SOLVER getLPSolver()
Definition: PrecursorIonSelection.h:189
double max_score_
maximal score in the FeatureMap
Definition: PrecursorIonSelection.h:243
A more convenient string class.
Definition: String.h:57
Size x_variable_number_
Definition: PrecursorIonSelection.h:256
SOLVER
Definition: LPWrapper.h:129
Type type_
precursor ion selection strategy
Definition: PrecursorIonSelection.h:245
A container for features.
Definition: FeatureMap.h:94
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
Compare by score.
Definition: PrecursorIonSelection.h:105
Definition: PrecursorIonSelection.h:78
Definition: PrecursorIonSelection.h:80
double mz_tolerance_
precursor ion error tolerance
Definition: PrecursorIonSelection.h:251
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Definition: PrecursorIonSelection.h:79
const DataValue & getMetaValue(const String &name) const
Returns the value corresponding to a string (or DataValue::EMPTY if not found)
void sortByTotalScore(FeatureMap &features)
Sort features by total score.
Definition: PrecursorIonSelection.h:121
This class implements the database preprocessing needing for precursor ion selection.
Definition: PrecursorIonSelectionPreprocessing.h:56
Type
Precursor ion selection type (iterative, static, upshift, downshift, dynamic exclusion).
Definition: PrecursorIonSelection.h:75
bool operator()(Feature const &left, Feature const &right) const
Definition: PrecursorIonSelection.h:97
bool operator()(Feature const &left, Feature const &right) const
Definition: PrecursorIonSelection.h:108
Base::iterator Iterator
Definition: FeatureMap.h:138
An LC-MS feature.
Definition: Feature.h:70
String mz_tolerance_unit_
precursor ion error tolerance unit (ppm or Da)
Definition: PrecursorIonSelection.h:253
This class implements protein inference for the precursor ion selection strategies.
Definition: PSProteinInference.h:53
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
CoordinateType getRT() const
Returns the RT coordinate (index 0)
Definition: Peak2D.h:209
const std::map< String, std::set< String > > & getPeptideProteinCounter()
Definition: PrecursorIonSelection.h:196
std::vector< Size > fraction_counter_
stores the number of selected precursors per fraction
Definition: PrecursorIonSelection.h:249
UInt min_pep_ids_
minimal number of peptides identified for a protein to be declared identified
Definition: PrecursorIonSelection.h:241
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
Compare by score.
Definition: PrecursorIonSelection.h:94
UInt max_iteration_
maximal number of iterations
Definition: PrecursorIonSelection.h:255
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
LPWrapper::SOLVER solver_
Definition: PrecursorIonSelection.h:258
std::map< String, std::set< String > > prot_id_counter_
stores the peptide sequences for all protein identifications
Definition: PrecursorIonSelection.h:247
Definition: PrecursorIonSelection.h:81
This class implements different precursor ion selection strategies.
Definition: PrecursorIonSelection.h:53
Implements ILP formulation of precursor selection problems.
Definition: PSLPFormulation.h:56

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:03 using doxygen 1.8.13