ProteoWizard
PeakFamilyDetectorFTTest.cpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Darren Kessner <darren@proteowizard.org>
6//
7// Copyright 2008 Spielberg Family Center for Applied Proteomics
8// Cedars-Sinai Medical Center, Los Angeles, California 90048
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
27
28using namespace pwiz::util;
29using namespace pwiz::analysis;
30using namespace pwiz::data;
31using namespace pwiz::data::peakdata;
32using namespace pwiz;
33using namespace pwiz::msdata;
34
35
36ostream* os_ = 0;
37
38
39extern double peakFamilyDetectorFTTestData_[];
41
42
43void test()
44{
45 // instantiate PeakFamilyDetectorFT
46
48 config.log = os_;
50 PeakFamilyDetectorFT detector(config);
51
52 // detect
53
54 vector<PeakFamily> result;
55 const MZIntensityPair* begin =
56 reinterpret_cast<const MZIntensityPair*>(&peakFamilyDetectorFTTestData_[0]);
58
59 detector.detect(begin, end, result);
60
61 if (os_)
62 {
63 *os_ << setprecision(10) << "result: " << result.size() << endl;
64 copy(result.begin(), result.end(), ostream_iterator<PeakFamily>(*os_, "\n"));
65 }
66
67 unit_assert(result.size() == 1);
68 unit_assert_equal(result[0].mzMonoisotopic, 810.4148, .005);
69}
70
71
72int main(int argc, char* argv[])
73{
74 TEST_PROLOG(argc, argv)
75
76 try
77 {
78 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
79 if (os_) *os_ << "PeakFamilyDetectorFTTest\n";
80 test();
81 }
82 catch (exception& e)
83 {
84 TEST_FAILED(e.what())
85 }
86 catch (...)
87 {
88 TEST_FAILED("Caught unknown exception.")
89 }
90
92}
93
int main(int argc, char *argv[])
double peakFamilyDetectorFTTestData_[]
int peakFamilyDetectorFTTestDataSize_
ostream * os_
FT-specific implementation of PeakFamilyDetector.
virtual void detect(const MZIntensityPair *begin, const MZIntensityPair *end, std::vector< PeakFamily > &result)
find peak families in a specified array of MZIntensityPair
static CalibrationParameters thermo_FT()
The data point type of a mass spectrum.
Definition MSData.hpp:423
#define unit_assert(x)
Definition unit.hpp:85
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define unit_assert_equal(x, y, epsilon)
Definition unit.hpp:99
#define TEST_PROLOG(argc, argv)
Definition unit.hpp:175