1
// --------------------------------------------------------------------------
2
// OpenMS -- Open-Source Mass Spectrometry
3
// --------------------------------------------------------------------------
4
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
7
// This software is released under a three-clause BSD license:
8
// * Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// * Redistributions in binary form must reproduce the above copyright
11
// notice, this list of conditions and the following disclaimer in the
12
// documentation and/or other materials provided with the distribution.
13
// * Neither the name of any author or any participating institution
14
// may be used to endorse or promote products derived from this software
15
// without specific prior written permission.
16
// For a full list of authors, refer to the file AUTHORS.
17
// --------------------------------------------------------------------------
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
// --------------------------------------------------------------------------
31
// $Maintainer: Mathias Walzer $
32
// $Author: Mathias Walzer $
33
// --------------------------------------------------------------------------
35
#include <OpenMS/APPLICATIONS/TOPPBase.h>
36
#include <OpenMS/FORMAT/CsvFile.h>
37
#include <OpenMS/KERNEL/StandardTypes.h>
38
#include <OpenMS/DATASTRUCTURES/String.h>
39
#include <OpenMS/FORMAT/QcMLFile.h>
46
//~ #include <QIODevice>
51
using namespace OpenMS;
54
//-------------------------------------------------------------
56
//-------------------------------------------------------------
59
@page UTILS_QCShrinker QCShrinker
61
@brief This application is used to remove the verbose table attachments from a qcml file that are not needed anymore, e.g. for a final report.
66
<td ALIGN = "center" BGCOLOR="#EBEBEB"> pot. predecessor tools </td>
67
<td VALIGN="middle" ROWSPAN=3> \f$ \longrightarrow \f$ QCShrinker \f$ \longrightarrow \f$</td>
68
<td ALIGN = "center" BGCOLOR="#EBEBEB"> pot. successor tools </td>
71
<td VALIGN="middle" ALIGN = "center" ROWSPAN=2> @ref UTILS_QCMerger </td>
74
<td VALIGN="middle" ALIGN = "center" ROWSPAN=1> ... </td>
79
If there is a lot of verbose or deprecated information in the given qcml file at @p in that can be purged.
81
- @p qp_accessions A list of cv accessions that should be removed. If empty, the usual suspects will be removed.
82
- @p run the file that defined the run under which the qp for the attachment is aggregated as MZML file. The file is only used to extract the run name from the file name;
83
- @p name if no file for the run was given (or if the target qp is contained in a set), at least a name of the target run/set containing the the qp for the attachment has to be given;
85
Output is in qcML format (see parameter @p out) which can be viewed directly in a modern browser (chromium, firefox).
87
<B>The command line parameters of this tool are:</B>
88
@verbinclude UTILS_QCShrinker.cli
89
<B>INI file documentation of this tool:</B>
90
@htmlinclude UTILS_QCShrinker.html
94
// We do not want this class to show up in the docu:
96
class TOPPQCShrinker :
101
TOPPBase("QCShrinker", "This application is used to remove the verbose table attachments from a qcml file that are not needed anymore, e.g. for a final report.", false)
106
void registerOptionsAndFlags_()
108
registerInputFile_("in", "<file>", "", "Input qcml file");
109
setValidFormats_("in", StringList::create("qcML"));
110
//~ registerFlag_("tables", "Remove all tables. (Of all runs and sets if these are not given with parameter name or run.)");
111
registerStringList_("qp_accessions", "<names>", StringList(), "A list of cv accessions that should be removed. If empty, the usual suspects will be removed!", false);
112
registerStringOption_("name", "<string>", "", "The name of the target run or set that contains the requested quality parameter.", false);
113
registerInputFile_("run", "<file>", "", "The file from which the name of the target run that contains the requested quality parameter is taken. This overrides the name parameter!", false);
114
setValidFormats_("run", StringList::create("mzML"));
115
registerOutputFile_("out", "<file>", "", "Output extended/reduced qcML file");
116
setValidFormats_("out", StringList::create("qcML"));
119
ExitCodes main_(int, const char**)
121
//-------------------------------------------------------------
122
// parsing parameters
123
//-------------------------------------------------------------
124
String in = getStringOption_("in");
125
String out = getStringOption_("out");
126
String target_run = getStringOption_("name");
127
String target_file = getStringOption_("run");
128
StringList qp_accs = getStringList_("qp_accessions");
130
//-------------------------------------------------------------
132
//------------------------------------------------------------
133
if (target_file != "")
135
target_run = QFileInfo(QString::fromStdString(target_file)).baseName();
138
//~ !getFlag_("tables")
145
qp_accs << "QC:0000044";
146
qp_accs << "QC:0000047";
147
qp_accs << "QC:0000022";
148
qp_accs << "QC:0000038";
149
qp_accs << "QC:0000049";
152
//TODO care for QualityParameter s
153
if (target_run == "")
155
for (Size i = 0; i < qp_accs.size(); ++i)
157
qcmlfile.removeAllAttachments(qp_accs[i]);
162
for (Size i = 0; i < qp_accs.size(); ++i)
164
qcmlfile.removeAttachment(target_run,qp_accs[i]);
173
int main(int argc, const char** argv)
176
return tool.main(argc, argv);