35 #ifndef OPENMS_APPLICATIONS_TOPPBASE_H 36 #define OPENMS_APPLICATIONS_TOPPBASE_H 74 BaseException(file, line, function,
"UnregisteredParameter", parameter)
86 BaseException(file, line, function,
"WrongParameterType", parameter)
98 BaseException(file, line, function,
"RequiredParameterNotGiven", parameter)
163 TOPPBase(
const String& name,
const String& description,
bool official =
true,
bool id_tag_support =
false,
bool require_args =
true,
const String& version =
"");
178 static void setMaxNumberOfThreads(
int num_threads);
238 void enableLogging_()
const;
252 virtual Param getSubsectionDefaults_(
const String& section)
const;
261 Param getSubsectionDefaults_()
const;
282 Param parseCommandLine_(
const int argc,
const char** argv,
const String& misc =
"misc",
const String& unknown =
"unknown");
300 Int getParamAsInt_(
const String& key,
Int default_value = 0)
const;
307 double getParamAsDouble_(
const String& key,
double default_value = 0)
const;
339 bool getParamAsBool_(
const String& key)
const;
362 Param getDefaultParameters_()
const;
387 return ini_location_;
391 const String& toolName_()
const;
413 virtual void registerOptionsAndFlags_() = 0;
419 std::vector<ParameterInformation> paramToParameterInformation_(
const Param& param)
const;
432 void registerParamSubsectionsAsTOPPSubsections_(
const Param& param);
435 void registerFullParam_(
const Param& param);
447 void registerStringOption_(
const String& name,
const String& argument,
const String& default_value,
const String& description,
bool required =
true,
bool advanced =
false);
455 void setValidStrings_(
const String& name,
const std::vector<String>& strings);
466 void setValidStrings_(
const String& name,
const std::string vstrings[],
int count);
498 void registerOutputFile_(
const String& name,
const String& argument,
const String& default_value,
const String& description,
bool required =
true,
bool advanced =
false);
510 void setValidFormats_(
const String& name,
const std::vector<String>& formats,
const bool force_OpenMS_format =
true);
523 void registerDoubleOption_(
const String& name,
const String& argument,
double default_value,
const String& description,
bool required =
true,
bool advanced =
false);
530 void setMinInt_(
const String& name,
Int min);
536 void setMaxInt_(
const String& name,
Int max);
542 void setMinFloat_(
const String& name,
double min);
548 void setMaxFloat_(
const String& name,
double max);
560 void registerIntOption_(
const String& name,
const String& argument,
561 Int default_value,
const String& description,
562 bool required =
true,
bool advanced =
false);
575 void registerIntList_(
const String& name,
const String& argument,
IntList default_value,
const String& description,
bool required =
true,
bool advanced =
false);
587 void registerDoubleList_(
const String& name,
const String& argument,
DoubleList default_value,
const String& description,
bool required =
true,
bool advanced =
false);
599 void registerStringList_(
const String& name,
const String& argument,
StringList default_value,
const String& description,
bool required =
true,
bool advanced =
false);
631 void registerOutputFileList_(
const String& name,
const String& argument,
StringList default_value,
const String& description,
bool required =
true,
bool advanced =
false);
634 void registerFlag_(
const String& name,
const String& description,
bool advanced =
false);
643 void registerSubsection_(
const String& name,
const String& description);
654 void registerTOPPSubsection_(
const String& name,
const String& description);
658 void addEmptyLine_();
679 double getDoubleOption_(
const String& name)
const;
689 Int getIntOption_(
const String& name)
const;
722 bool getFlag_(
const String& name)
const;
736 Param const& getParam_()
const;
751 void checkParam_(
const Param& param,
const String& filename,
const String& location)
const;
761 void checkIfIniParametersAreApplicable_(
const Param& ini_params);
768 virtual ExitCodes main_(
int argc,
const char** argv) = 0;
772 void writeLog_(
const String& text)
const;
776 void writeDebug_(
const String& text,
UInt min_level)
const;
779 void writeDebug_(
const String& text,
const Param& param,
UInt min_level)
const;
784 String makeTempDirectory_()
const;
792 void removeTempDirectory_(
const String& dirname,
Int keep_debug = 2)
const;
819 void inputFileReadable_(
const String& filename,
const String& param_name)
const;
831 void outputFileWritable_(
const String& filename,
const String& param_name)
const;
841 bool parseRange_(
const String& text,
double& low,
double& high)
const;
850 bool parseRange_(
const String& text,
Int& low,
Int& high)
const;
868 for (
Size i = 0; i < map.
size(); ++i)
870 map[i].getDataProcessing().push_back(dp_);
882 DataProcessing getProcessingInfo_(
const std::set<DataProcessing::ProcessingAction>& actions)
const;
920 void addText_(
const String& text);
935 #endif //OPENMS_APPLICATIONS_TOPPBASE_H String verboseVersion_
Version string including additional revision/date time information. Note: This differs from version_ ...
Definition: TOPPBase.h:373
Definition: TOPPBase.h:140
Description of the applied preprocessing steps.
Definition: DataProcessing.h:52
std::map< String, String > subsections_TOPP_
Storage location and description for allowed subsections from TOPP tool's command-line parameters...
Definition: TOPPBase.h:267
An unregistered parameter was accessed.
Definition: TOPPBase.h:69
Definition: TOPPBase.h:133
Definition: TOPPBase.h:136
A more convenient string class.
Definition: String.h:57
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:66
LogType
Possible log types.
Definition: ProgressLogger.h:71
UnregisteredParameter(const char *file, int line, const char *function, const String ¶meter)
Definition: TOPPBase.h:73
RequiredParameterNotGiven(const char *file, int line, const char *function, const String ¶meter)
Definition: TOPPBase.h:97
std::ofstream log_
Log file stream. Use the writeLog_() and writeDebug_() methods to access it.
Definition: TOPPBase.h:228
A container for features.
Definition: FeatureMap.h:94
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
bool official_
Flag indicating if this an official TOPP tool.
Definition: TOPPBase.h:376
Parameter entry used to store the actual information inside of a Param entry.
Definition: Param.h:80
A container for consensus elements.
Definition: ConsensusMap.h:72
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:59
void addDataProcessing_(PeakMap &map, const DataProcessing &dp) const
Data processing setter for peak maps.
Definition: TOPPBase.h:865
Definition: TOPPBase.h:141
Definition: TOPPBase.h:137
std::map< String, String > subsections_
Storage location and description for allowed subsections.
Definition: TOPPBase.h:264
Definition: TOPPBase.h:143
Size size() const
Definition: MSExperiment.h:132
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
bool test_mode_
Test mode.
Definition: TOPPBase.h:906
Definition: TOPPBase.h:142
Base class for TOPP applications.
Definition: TOPPBase.h:126
const String & getIniLocation_() const
Returns the location of the ini file where parameters are taken from. E.g. if the command line was TO...
Definition: TOPPBase.h:385
static GlobalExceptionHandler & getInstance()
The accessor for the singleton. It also serves as a replacement for the constructor.
Definition: GlobalExceptionHandler.h:89
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:57
const char * tool_name
Definition: TOPPAS.cpp:91
Definition: TOPPBase.h:139
A parameter was accessed with the wrong type.
Definition: TOPPBase.h:81
Definition: TOPPBase.h:138
Param param_cmdline_
Parameters from command line.
Definition: TOPPBase.h:216
Tags OpenMS file containers with a DocumentID.
Definition: DocumentIDTagger.h:55
Param param_common_tool_
Parameters from common section with tool name.
Definition: TOPPBase.h:222
Size getNrChromatograms() const
get the total number of chromatograms available
Definition: MSExperiment.h:893
ProcessingAction
Definition: DataProcessing.h:59
std::vector< DataProcessingPtr > & getDataProcessing()
returns a mutable reference to the description of the applied processing
bool id_tag_support_
Tool indicates it supports assignment of unique DocumentID from IDPool.
Definition: TOPPBase.h:189
Definition: TOPPBase.h:144
Definition: TOPPBase.h:145
bool require_args_
Require at least one command line argument, exit immediately otherwise. GUI tools should disable this...
Definition: TOPPBase.h:192
Exception base class.
Definition: Exception.h:90
Param param_common_
Parameters from common section without tool name.
Definition: TOPPBase.h:225
String version_
Version string (if empty, the OpenMS/TOPP version is printed)
Definition: TOPPBase.h:370
DocumentIDTagger id_tagger_
Instance of DocumentIDTagger, which can be accessed using getDocumentIDTagger_()
Definition: TOPPBase.h:195
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:74
Management and storage of parameters / INI files.
Definition: Param.h:75
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
WrongParameterType(const char *file, int line, const char *function, const String ¶meter)
Definition: TOPPBase.h:85
Definition: TOPPBase.h:135
static void setMessage(const std::string &message)
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
String const tool_name_
Tool name. This is assigned once and for all in the constructor.
Definition: TOPPBase.h:183
Param param_
All parameters relevant to this invocation of the program.
Definition: TOPPBase.h:210
Definition: TOPPBase.h:134
std::vector< ParameterInformation > parameters_
Storage location for parameter information.
Definition: TOPPBase.h:241
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:73
ExitCodes
Exit codes.
Definition: TOPPBase.h:131
String const ini_location_
Location in the ini file where to look for parameters.
Definition: TOPPBase.h:201
MSChromatogram & getChromatogram(Size id)
returns a single chromatogram
Definition: MSExperiment.h:875
String const tool_description_
Tool description. This is assigned once and for all in the constructor.
Definition: TOPPBase.h:186
Param param_inifile_
All parameters specified in the ini file.
Definition: TOPPBase.h:213
int Int
Signed integer type.
Definition: Types.h:103
Param param_instance_
Parameters from instance section.
Definition: TOPPBase.h:219
Int debug_level_
Debug level set by -debug.
Definition: TOPPBase.h:912
ProgressLogger::LogType log_type_
Type of progress logging.
Definition: TOPPBase.h:853
Int const instance_number_
Instance number.
Definition: TOPPBase.h:198
static String topp_ini_file_
.TOPP.ini file for storing system default parameters
Definition: TOPPBase.h:909
A required parameter was not given.
Definition: TOPPBase.h:93