1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
14
// This library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
// --------------------------------------------------------------------------
24
// $Maintainer: Lars Nilse $
25
// $Authors: Lars Nilse, Holger Plattfaut $
26
// --------------------------------------------------------------------------
28
#include <OpenMS/CONCEPT/ClassTest.h>
30
#include <OpenMS/FILTERING/DATAREDUCTION/SILACFilter.h>
31
#include <OpenMS/FILTERING/DATAREDUCTION/SILACFiltering.h>
32
#include <OpenMS/FORMAT/MzMLFile.h>
33
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/PeakWidthEstimator.h>
35
using namespace OpenMS;
38
START_TEST(SILACFiltering, "$Id: SILACFiltering_test.C 9214 2011-11-21 16:54:37Z waldi $")
41
MzMLFile().load(OPENMS_GET_TEST_DATA_PATH("SILACFiltering_test.mzML"), input);
42
const PeakWidthEstimator::Result peak_width(PeakWidthEstimator::estimateFWHM(input));
44
/////////////////////////////////////////////////////////////
45
/////////////////////////////////////////////////////////////
47
std::vector<DoubleReal> mass_separations;
48
mass_separations.push_back(8.0142);
49
SILACFiltering filtering(input, peak_width, 0);
50
SILACFilter filter(mass_separations, 2, 2, 3, 0, .9, false);
52
START_SECTION((SILACFiltering(MSExperiment< Peak1D > &exp, const PeakWidthEstimator::Result &, const DoubleReal intensity_cutoff, const String debug_filebase_="")))
54
TEST_EQUAL(filtering.filters_.size(), 0);
55
TEST_EQUAL(filtering.blacklist.size(), 0);
59
START_SECTION((void addFilter(SILACFilter &filter)))
61
filtering.addFilter(filter);
62
TEST_EQUAL(filtering.filters_.size(), 1);
66
START_SECTION((void filterDataPoints()))
68
filtering.filterDataPoints();
69
SILACFiltering::Filters::iterator filter_it = filtering.filters_.begin();
71
std::vector<SILACPattern> &p = filter_it->getElements();
72
TEST_EQUAL(p.size(), 3);
73
TEST_REAL_SIMILAR(p[0].rt, 830);
74
TEST_REAL_SIMILAR(p[0].mz, 670.84);
75
TEST_REAL_SIMILAR(p[1].rt, 830);
76
TEST_REAL_SIMILAR(p[1].mz, 670.84);
77
TEST_REAL_SIMILAR(p[2].rt, 833);
78
TEST_REAL_SIMILAR(p[2].mz, 670.84);
82
START_SECTION([SILACFiltering::SpectrumInterpolation] SpectrumInterpolation(const MSSpectrum<> &, const SILACFiltering &))
83
SILACFiltering::SpectrumInterpolation si(input[0], filtering);
86
START_SECTION([SILACFiltering::SpectrumInterpolation] ~SpectrumInterpolation())
87
SILACFiltering::SpectrumInterpolation si(input[0], filtering);
90
START_SECTION([SILACFiltering::SpectrumInterpolation] DoubleReal operator()(DoubleReal mz) const)
91
SILACFiltering::SpectrumInterpolation si(input[0], filtering);
92
TEST_REAL_SIMILAR(si(670.5), 0)
93
TEST_REAL_SIMILAR(si(671.1), 0)
96
/////////////////////////////////////////////////////////////
97
/////////////////////////////////////////////////////////////