ProteoWizard
DatabaseQueryTest.cpp
Go to the documentation of this file.
1 //
2 // $Id: DatabaseQueryTest.cpp 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 /// DatabaseQueryTest.cpp
25 ///
26 
27 #include "DatabaseQuery.hpp"
29 
30 using namespace pwiz;
31 using namespace eharmony;
32 using namespace pwiz::util;
33 
34 void test()
35 {
36  double mu1 = 1;
37  double mu2 = 2;
38  double sigma1 = 2;
39  double sigma2 = 4;
40  double threshold = 0.7;
41 
43 
44  // Given a normal distribution fit to mz and rt differences, calculate the folded normal distribution correspoding to the parameters of the original distribution. Using this distribution and an explicit approximation to the error function, calculate the region of mz x rt space that it is necessary to search in order to find all the matches that would score higher than the given threshold.
45 
46  pair<double,double> radii = dbQuery.calculateSearchRegion(mu1, mu2, sigma1, sigma2, threshold);
47  unit_assert_equal(radii.first, 10.047046209584696, .000001);
48 
49 }
50 
51 int main()
52 {
53  test();
54  return 0;
55 }