1 // ==========================================================================
2 // RABEMA Read Alignment Benchmark
3 // ==========================================================================
4 // Copyright (C) 2010-1012 Manuel Holtgrewe, FU Berlin
5 //
6 // This program is free software: you can redistribute it and/or modify it
7 // under the terms of the GNU General Public License as published by the Free
8 // Software Foundation, either version 3 of the License, or (at your option)
9 // any later version.
10 //
11 // This program is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 // more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with this program. If not, see <http://www.gnu.org/licenses/>.
18 //
19 // ==========================================================================
20 // Author: Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>
21 // ==========================================================================
22 // Globally shared code for the rabema tool.
23 // ==========================================================================
24
25 #ifndef SEQAN_APPS_RABEMA_RABEMA_H_
26 #define SEQAN_APPS_RABEMA_RABEMA_H_
27
28 #include <seqan/basic.h>
29 #include <seqan/sequence.h>
30
31 using namespace seqan;
32
33 // ============================================================================
34 // Enums, Tags, Classes.
35 // ============================================================================
36
37 // Tag for global options.
38 struct Global_ {};
39 typedef Tag<Global_> Global;
40
41 // Tag for the build golden standard subprogram, also used for
42 // specializing the Options class for the subprogram.
43 struct BuildGoldStandard_ {};
44 typedef Tag<BuildGoldStandard_> BuildGoldStandard;
45
46 // Tag for the evaluation subprogram, also used for specializing the
47 // Options class for the subprogram.
48 struct EvaluateResults_ {};
49 typedef Tag<EvaluateResults_> EvaluateResults;
50
51 // Enum for selecting a subprogram.
52 enum SelectedCommand
53 {
54 COMMAND_NONE,
55 COMMAND_BUILD_STANDARD,
56 COMMAND_EVALUATE
57 };
58
59 // Class for storing options.
60 template <typename TSpec>
61 class Options;
62
63 // Global options used in rabema.cpp.
64 template <>
65 class Options<Global>
66 {
67 public:
68 // True iff verbose mode is enabled.
69 bool verbose;
70 // True iff very verbose mode is enabled.
71 bool veryVerbose;
72
73 // The selected command to execute.
74 SelectedCommand selectedCommand;
75
76 // Path to the file to write the output to. "-" for stdout.
77 CharString outputFile;
78
Options()79 Options() :
80 verbose(false), veryVerbose(false), selectedCommand(COMMAND_NONE), outputFile("-")
81 {}
82 };
83
84 // ============================================================================
85 // Metafunctions
86 // ============================================================================
87
88 // ============================================================================
89 // Functions
90 // ============================================================================
91
92 // Ceil away from Zero.
93 //
94 // ceilAwayFromZero(-1.5) == -2
95 // ceilAwayFromZero(1.5) == 2
96 template <typename T>
ceilAwayFromZero(const T & x)97 inline T ceilAwayFromZero(const T & x)
98 {
99 if (x < 0)
100 return floor(x);
101
102 return ceil(x);
103 }
104
setUpCommandLineParser(CommandLineParser & parser)105 void setUpCommandLineParser(CommandLineParser & parser)
106 {
107 addVersionLine(parser, "0.1");
108
109 addTitleLine(parser, "*************************************");
110 addTitleLine(parser, "* RABEMA - Read Alignment Benchmark *");
111 addTitleLine(parser, "*************************************");
112 addTitleLine(parser, "");
113 addTitleLine(parser, "(c) 2010 by Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>");
114 }
115
116 #endif // #ifndef SEQAN_APPS_RABEMA_RABEMA_H_
117