1 #ifndef _RNAFORESTER_OPTIONS_H
2 #define _RNAFORESTER_OPTIONS_H
3 
4 //#ifndef WIN32
5 //#include "config.h"
6 //#endif
7 
8 //#ifndef HAVE_LIBRNA
9 //#undef HAVE_LIBG2
10 //#endif
11 
12 #include "config.h"
13 #include "Arguments.h"
14 
15 class Options {
16 private:
17     struct OptionsInfo {
18         std::string tag;
19         std::string parameter;
20         std::string filler;
21         std::string description;
22         bool hidden;
23     };
24 
25 public:
26     enum RNAforesterOption {
27 			  // general options
28         Help=0,
29         SecretHelp,
30         Version,
31         ReadFromFile,
32         SpaceTimeInfo,
33         ShowOnlyScore,
34         NoScale,
35         Tables,
36         Backtrace,
37 				// computation properties
38 				Topdown,
39         CalculateDistance,
40         RelativeScore,
41         LocalSimilarity,
42         LocalSubopts,
43         SmallInLarge,
44 				Anchoring,
45 				Affine,
46         Multiple,
47         RIBOSUMScore,
48         TreeEdit,
49         GlobalAlignment,
50 				// progressive alignment
51         ConsensusMinBaseProb,
52         ConsensusMinPairProb,
53         ClusterThreshold,
54         ClusterJoinCutoff,
55 #ifdef HAVE_LIBRNA
56         PredictProfile,
57         PredictMinPairProb,
58 #endif
59         SaveProfile,
60         ProfileSearch,
61 				// score values
62         BpRepScore,
63         BpDelScore,
64         BpDelOpenScore,
65         BMatchScore,
66         BRepScore,
67         BDelScore,
68         BDelOpenScore,
69 				// squiggle plot options
70 #ifdef HAVE_LIBG2
71         MakeSquigglePlot,
72         SquiggleHideBaseNumbers,
73         SquiggleBaseNumberInterval,
74         SquiggleGreyColors,
75         SquiggleScaleFactor,
76         SquiggleGenerateFIG,
77 #ifdef HAVE_LIBGD
78         SquiggleGeneratePNG,
79         SquiggleGenerateJPG,
80 #endif
81 #endif
82 				// other output options
83         FastaOutput,
84         MakeDotForInputTrees,
85         OutputAlignmentDotFormat,
86 #ifdef HAVE_LIBXMLPLUSPLUS
87 #ifdef HAVE_LIBXML2
88         GenerateXML,
89         XmlOutputFile,
90 #endif
91 #endif
92         NumberOfOptions
93     };
94 
95     class IncompatibleException {
96     private:
97         std::string tag1_;
98         std::string tag2_;
99 
100     public:
IncompatibleException(std::string tag1,std::string tag2)101         IncompatibleException(std::string tag1,std::string tag2)
102                 : tag1_(tag1), tag2_(tag2) {};
103 
104         void showError();
105     };
106 
107     class RequiresException {
108     private:
109         std::string tag1_;
110         std::string tag2_;
111 
112     public:
RequiresException(std::string tag1,std::string tag2)113         RequiresException(std::string tag1,std::string tag2)
114                 : tag1_(tag1), tag2_(tag2) {};
115 
116         void showError();
117     };
118 
119     Options(int argc, const char **argv);
120     ~Options();
121 
122     bool has(RNAforesterOption option) const;
123     const char** getArgs() const;
124     const unsigned int getNrOfOptions() const;
125 
126     template<class T>
get(RNAforesterOption option,T & var,T def)127     void get(RNAforesterOption option, T &var, T def) const {
128         args_->get(options_[option].tag,var,def);
129     }
130 
131     void help();
132     void secretHelp();
133     std::string generateFilename(RNAforesterOption option, const std::string &suffix, const std::string &defName, unsigned int count=0) const;
134 
135 private:
136     OptionsInfo *options_;
137     Arguments *args_;
138     const char **argv_;
139     unsigned int nrArgs;
140 
141     inline void setOption(RNAforesterOption,std::string tag, std::string parameter, std::string filler, std::string description, bool hidden);
142     void exclude(RNAforesterOption opt1, RNAforesterOption opt2);
143     void requires(RNAforesterOption opt1, RNAforesterOption opt2);
144 
145 };
146 
147 #endif
148