ProteoWizard
SearchNeighborhoodCalculator.hpp
Go to the documentation of this file.
1 //
2 // $Id: SearchNeighborhoodCalculator.hpp 1539 2009-11-19 20:12:28Z khoff $
3 //
4 //
5 // Original author: Kate Hoff <katherine.hoff@proteowizard.org>
6 //
7 // Copyright 2009 Center for Applied Molecular Medicine
8 // University of Southern California, Los Angeles, CA
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 //
22 
23 ///
24 /// SearchNeighborhoodCalculator.hpp
25 ///
26 
27 #ifndef _SEARCHNEIGHBORHOODCALCULATOR_HPP_
28 #define _SEARCHNEIGHBORHOODCALCULATOR_HPP_
29 
30 #include "DataFetcherContainer.hpp"
32 
33 using namespace pwiz::data::pepxml;
34 
35 namespace pwiz{
36 namespace eharmony{
37 
38 typedef boost::shared_ptr<DataFetcherContainer> DfcPtr;
39 
41 {
42  SearchNeighborhoodCalculator() : _id("default"), _mzTol(.005), _rtTol(60) {}
43  SearchNeighborhoodCalculator(double mzTol, double rtTol) : _mzTol(mzTol), _rtTol(rtTol) { _id = ("naive[" + boost::lexical_cast<string>(_mzTol) + "," + boost::lexical_cast<string>(_rtTol) + "]").c_str();}
44 
45  virtual void calculateTolerances(const DataFetcherContainer& dfc) {}
46  virtual bool close(const SpectrumQuery& a, const Feature& b) const;
47  virtual double score(const SpectrumQuery& a, const Feature& b) const;
48 
49  string _id;
50  double _mzTol;
51  double _rtTol;
52 
54 
55  virtual bool operator==(const SearchNeighborhoodCalculator& that) const;
56  virtual bool operator!=(const SearchNeighborhoodCalculator& that) const;
57 
58 };
59 
60 
62 {
63  NormalDistributionSearch(double threshold = 0.95) : _threshold(threshold)
64  {
65  _id = ("normalDistribution[" + boost::lexical_cast<string>(_threshold) + "]").c_str();
66  }
67 
68  virtual void calculateTolerances(const DfcPtr dfc);
69  virtual double score(const SpectrumQuery& a, const Feature& b) const;
70  virtual bool close(const SpectrumQuery& a, const Feature& b) const;
71 
72  double _mu_mz;
73  double _sigma_mz;
74 
75  double _mu_rt;
76  double _sigma_rt;
77 
78  double _threshold;
79 
80 };
81 
82 } // eharmony
83 } // pwiz
84 
85 #endif
86