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: Mathias Walzer$
26
// --------------------------------------------------------------------------
29
#include <OpenMS/APPLICATIONS/TOPPBase.h>
30
#include <OpenMS/FILTERING/TRANSFORMERS/WindowMower.h>
31
#include <OpenMS/FORMAT/MzMLFile.h>
35
using namespace OpenMS;
39
@page TOPP_SpectraFilterWindowMower SpectraFilterWindowMower
41
@brief Filters the top Peaks in the given spectra according to a given schema/thresholdset
46
<td ALIGN = "center" BGCOLOR="#EBEBEB"> pot. predecessor tools </td>
47
<td VALIGN="middle" ROWSPAN=2> \f$ \longrightarrow \f$ SpectraFilter \f$ \longrightarrow \f$</td>
48
<td ALIGN = "center" BGCOLOR="#EBEBEB"> pot. successor tools </td>
51
<td VALIGN="middle" ALIGN = "center" ROWSPAN=1> @ref TOPP_PeakPickerWavelet </td>
52
<td VALIGN="middle" ALIGN = "center" ROWSPAN=1> any tool operating on MS peak data @n (in mzML format)</td>
59
<B>The command line parameters of this tool are:</B>
60
@verbinclude TOPP_SpectraFilterWindowMower.cli
62
For the parameters of the algorithm section see the class documentation: @n
63
@ref OpenMS::WindowMower @n
67
// We do not want this class to show up in the docu:
70
class TOPPSpectraFilterWindowMower
74
TOPPSpectraFilterWindowMower()
75
: TOPPBase("SpectraFilterWindowMower", "Applies thresholdfilter to peak spectra.")
81
void registerOptionsAndFlags_()
83
registerInputFile_("in", "<file>", "", "input file ");
84
setValidFormats_("in",StringList::create("mzML"));
85
registerOutputFile_("out", "<file>", "", "output file ");
86
setValidFormats_("out",StringList::create("mzML"));
88
// register one section for each algorithm
89
registerSubsection_("algorithm","Algorithm parameter subsection.");
93
Param getSubsectionDefaults_(const String& /*section*/) const
95
return WindowMower().getParameters();
98
ExitCodes main_(int , const char**)
100
//-------------------------------------------------------------
101
// parameter handling
102
//-------------------------------------------------------------
105
String in(getStringOption_("in"));
106
String out(getStringOption_("out"));
108
//-------------------------------------------------------------
110
//-------------------------------------------------------------
114
f.setLogType(log_type_);
117
//-------------------------------------------------------------
118
// if meta data arrays are present, remove them and warn
119
//-------------------------------------------------------------
120
if (exp.clearMetaDataArrays())
122
writeLog_("Warning: Spectrum meta data arrays cannot be sorted. They are deleted.");
125
//-------------------------------------------------------------
127
//-------------------------------------------------------------
128
Param filter_param = getParam_().copy("algorithm:", true);
129
writeDebug_("Used filter parameters", filter_param, 3);
132
filter.setParameters(filter_param);
133
filter.filterPeakMap(exp);
135
//-------------------------------------------------------------
137
//-------------------------------------------------------------
139
//annotate output with data processing info
140
addDataProcessing_(exp, getProcessingInfo_(DataProcessing::FILTERING));
151
int main( int argc, const char** argv )
153
TOPPSpectraFilterWindowMower tool;
154
return tool.main(argc,argv);