OpenMS
|
A base class for all classes handling default parameters. More...
#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
Inherited by SignalToNoiseEstimator< MSSpectrum >, AScore, AbsoluteQuantitation, AccurateMassSearchEngine, BaseGroupFinder, BaseModel, BaseSuperimposer, BasicProteinInferenceAlgorithm, BayesianProteinInferenceAlgorithm, BinnedSpectrumCompareFunctor, ConsensusIDAlgorithm, ConsensusMapMergerAlgorithm, DBSuitability, DIAScoring, DiaPrescore, ElutionModelFitter, ElutionPeakDetection, EmgGradientDescent, FIAMSDataProcessor, FLASHDeconvAlgorithm, FLASHDeconvWizardBase, FalseDiscoveryRate, FeatureDeconvolution, FeatureDistance, FeatureFinderAlgorithm, FeatureFinderAlgorithmMetaboIdent, FeatureFinderAlgorithmPicked, FeatureFinderIdentificationAlgorithm, FeatureFinderMultiplexAlgorithm, FeatureFindingMetabo, FeatureGroupingAlgorithm, Fitter1D, GNPSMGFFile, GaussFilter, IDDecoyProbability, IDMapper, IDMergerAlgorithm, IDRipper, IDScoreSwitcherAlgorithm, IsobaricChannelExtractor, IsobaricQuantifier, IsobaricQuantitationMethod, IsotopeLabelingMDVs, KDTreeFeatureMaps, LinearResampler, LowessSmoothing, MRMDecoy, MRMFeatureFilter, MRMFeatureFinderScoring, MRMMapping, MRMTransitionGroupPicker, MSPFile, MSPGenericFile, MapAlignmentAlgorithmIdentification, MapAlignmentAlgorithmPoseClustering, MapAlignmentAlgorithmTreeGuided, MascotGenericFile, MascotRemoteQuery, MassDecompositionAlgorithm, MassFeatureTrace, MassTraceDetection, MasstraceCorrelator, PosteriorErrorProbabilityModel, MetaboliteFeatureDeconvolution, MetaboliteSpectralMatching, MorphologicalFilter, MultiplexDeltaMassesGenerator, NLargest, Normalizer, NucleicAcidSpectrumGenerator, OpenPepXLAlgorithm, OpenPepXLLFAlgorithm, PeakIntegrator, PeakPickerChromatogram, PeakPickerHiRes, PeakPickerIterative, PeakSpectrumCompareFunctor, PeptideAndProteinQuant, PeptideIndexing, PlotCanvas, RankScaler, SONARScoring, SavitzkyGolayFilter, SignalToNoiseEstimator< Container >, SimpleSVM, SimpleSearchEngineAlgorithm, SimpleTSGXLMS, SiriusExportAlgorithm, SpectraIDViewTab, SpectraMerger, SpectraMerger::SpectraDistance_, SpectrumAlignment, SpectrumAnnotator, SqrtScaler, SwathMapMassCorrection, SwathWizardBase, TOPPASBase, TOPPViewBase, TargetedSpectraExtractor, TheoreticalSpectrumGenerator, TheoreticalSpectrumGeneratorXLMS, ThresholdMower, TraceFitter, TransitionTSVFile, WindowMower, and XFDRAlgorithm.
Public Member Functions | |
DefaultParamHandler (const String &name) | |
Constructor with name that is displayed in error messages. More... | |
DefaultParamHandler (const DefaultParamHandler &rhs) | |
Copy constructor. More... | |
virtual | ~DefaultParamHandler () |
Destructor. More... | |
DefaultParamHandler & | operator= (const DefaultParamHandler &rhs) |
Assignment operator. More... | |
virtual bool | operator== (const DefaultParamHandler &rhs) const |
Equality operator. More... | |
void | setParameters (const Param ¶m) |
Sets the parameters. More... | |
const Param & | getParameters () const |
Non-mutable access to the parameters. More... | |
const Param & | getDefaults () const |
Non-mutable access to the default parameters. More... | |
const String & | getName () const |
Non-mutable access to the name. More... | |
void | setName (const String &name) |
Mutable access to the name. More... | |
const std::vector< String > & | getSubsections () const |
Non-mutable access to the registered subsections. More... | |
Static Public Member Functions | |
static void | writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &key_prefix="") |
Writes all parameters to meta values. More... | |
Protected Member Functions | |
virtual void | updateMembers_ () |
This method is used to update extra member variables at the end of the setParameters() method. More... | |
void | defaultsToParam_ () |
Updates the parameters after the defaults have been set in the constructor. More... | |
Protected Attributes | |
Param | param_ |
Container for current parameters. More... | |
Param | defaults_ |
Container for default parameters. This member should be filled in the constructor of derived classes! More... | |
std::vector< String > | subsections_ |
Container for registered subsections. This member should be filled in the constructor of derived classes! More... | |
String | error_name_ |
Name that is displayed in error messages during the parameter checking. More... | |
bool | check_defaults_ |
If this member is set to false no checking if parameters in done;. More... | |
bool | warn_empty_defaults_ |
If this member is set to false no warning is emitted when defaults are empty;. More... | |
Private Member Functions | |
DefaultParamHandler () | |
Hidden default C'tor (class name parameter is required!) More... | |
A base class for all classes handling default parameters.
This class facilitates the handling of parameters:
Extra member variables are needed if getting the value from param_ would be too slow e.g. when they are used in methods that are called very often.
No matter if you have extra variables or not, do the following:
If you have extra member variables you need to synchronize with param_, do the following:
Base classes:
If you create a class A that is derived from DefaultParamHandler and derive another class B for A, you should set use the setName(String) method to set the name used for error messages to B.
Parameter documentation:
Each default parameter has to be documented in a comprehensive way. This is done using the Param::setValue methods and the Param::setDescription method.
Flags:
Flags (boolean parameters) are not supported directly. It's best to implement them as a string parameter with valid strings 'true' and 'false'.
DefaultParamHandler | ( | const String & | name | ) |
Constructor with name that is displayed in error messages.
DefaultParamHandler | ( | const DefaultParamHandler & | rhs | ) |
Copy constructor.
|
virtual |
Destructor.
|
private |
Hidden default C'tor (class name parameter is required!)
|
protected |
Updates the parameters after the defaults have been set in the constructor.
Also calls updateMembers_().
Referenced by TOPPViewBase::initializeDefaultParameters_(), SignalToNoiseEstimatorMeanIterative< Container >::SignalToNoiseEstimatorMeanIterative(), SignalToNoiseEstimatorMedian< Container >::SignalToNoiseEstimatorMedian(), TOPPASBase::TOPPASBase(), and TOPPViewBase::TOPPViewBase().
const Param& getDefaults | ( | ) | const |
Non-mutable access to the default parameters.
Referenced by NucleicAcidSearchEngine::calculateAndFilterFDR_(), EmgScoring::getDefaults(), TOPPViewBase::initializeDefaultParameters_(), TOPPFLASHDeconv::main_(), TOPPOpenSwathBase::performCalibration(), PeakPickerIterative::pick(), and TOPPFLASHDeconv::registerOptionsAndFlags_().
const String& getName | ( | ) | const |
Non-mutable access to the name.
Referenced by TOPPViewBase::zoomOtherWindows().
const Param& getParameters | ( | ) | const |
Non-mutable access to the parameters.
Referenced by NucleicAcidSearchEngine::main_(), PeakPickerIterative::pick(), EmgScoring::prepareFit_(), NucleicAcidSearchEngine::preprocessSpectra_(), and SignalToNoiseOpenMS< ContainerT >::SignalToNoiseOpenMS().
const std::vector<String>& getSubsections | ( | ) | const |
Non-mutable access to the registered subsections.
DefaultParamHandler& operator= | ( | const DefaultParamHandler & | rhs | ) |
Assignment operator.
Referenced by BaseModel::operator=(), and SignalToNoiseEstimator< Container >::operator=().
|
virtual |
Equality operator.
void setName | ( | const String & | name | ) |
Mutable access to the name.
Referenced by SignalToNoiseEstimatorMeanIterative< Container >::SignalToNoiseEstimatorMeanIterative(), and SignalToNoiseEstimatorMedian< Container >::SignalToNoiseEstimatorMedian().
void setParameters | ( | const Param & | param | ) |
Sets the parameters.
Before setting the parameters, missing parameters are filled up with default values.
Then the parameters are checked for unknown parameters (warning) and violations of restrictions (exception) with the Param::checkDefaults() method.
Exception::InvalidParameter | is thrown if errors occur during the check. |
Referenced by NucleicAcidSearchEngine::calculateAndFilterFDR_(), EmgScoring::fitRT_(), TOPPASBase::loadPreferences(), TOPPViewBase::loadPreferences(), TOPPOpenSwathBase::loadTransitionList(), TOPPFLASHDeconv::main_(), TOPPGNPSExport::main_(), NucleicAcidSearchEngine::main_(), SpectraMerger::mergeSpectra_(), SpectraMerger::mergeSpectraPrecursors(), PeakPickerIterative::pick(), EmgScoring::prepareFit_(), NucleicAcidSearchEngine::preprocessSpectra_(), and SignalToNoiseOpenMS< ContainerT >::SignalToNoiseOpenMS().
|
protectedvirtual |
This method is used to update extra member variables at the end of the setParameters() method.
Also call it at the end of the derived classes' copy constructor and assignment operator.
The default implementation is empty.
Reimplemented in SpectraMerger::SpectraDistance_, SavitzkyGolayFilter, LowessSmoothing, GaussFilter, Normalizer, LinearResamplerAlign, LinearResampler, SignalToNoiseEstimatorMedian< Container >, SignalToNoiseEstimatorMedian< OpenMS::MSChromatogram >, SignalToNoiseEstimatorMedian< ContainerT >, SignalToNoiseEstimatorMeanIterative< Container >, NLargest, PeakPickerIterative, PeakPickerHiRes, EmgGradientDescent, MSPGenericFile, MascotRemoteQuery, MascotGenericFile, TraceFitter, MaxLikeliFitter1D, MassTraceDetection, LevMarqFitter1D, IsotopeModel, IsotopeFitter1D, InterpolationModel, GaussTraceFitter, GaussModel, GaussFitter1D, Fitter1D, FeatureFindingMetabo, FeatureFinderIdentificationAlgorithm, FeatureFinderAlgorithmPicked, FeatureFinderAlgorithmMetaboIdent, ExtendedIsotopeModel, ExtendedIsotopeFitter1D, EmgModel, EmgFitter1D, ElutionPeakDetection, EGHTraceFitter, BiGaussModel, BiGaussFitter1D, BaseModel, BinnedSumAgreeingIntensities, BinnedSpectralContrastAngle, BinnedSharedPeakCount, TheoreticalSpectrumGeneratorXLMS, TheoreticalSpectrumGenerator, SpectrumAnnotator, SimpleTSGXLMS, NucleicAcidSpectrumGenerator, MassDecompositionAlgorithm, XFDRAlgorithm, OpenPepXLLFAlgorithm, OpenPepXLAlgorithm, MassFeatureTrace, FLASHDeconvAlgorithm, MRMMapping, TMTTenPlexQuantitationMethod, TMTSixteenPlexQuantitationMethod, TMTSixPlexQuantitationMethod, TMTElevenPlexQuantitationMethod, TMTEighteenPlexQuantitationMethod, PeptideAndProteinQuant, KDTreeFeatureMaps, ItraqFourPlexQuantitationMethod, ItraqEightPlexQuantitationMethod, IsotopeLabelingMDVs, IsobaricQuantifier, IsobaricChannelExtractor, AbsoluteQuantitation, TransitionTSVFile, TargetedSpectraExtractor, SwathMapMassCorrection, SONARScoring, PeakPickerChromatogram, PeakIntegrator, MRMTransitionGroupPicker, MRMFeatureFinderScoring, MRMFeatureFilter, MRMDecoy, DIAScoring, DiaPrescore, StablePairFinder, MapAlignmentAlgorithmTreeGuided, MapAlignmentAlgorithmPoseClustering, FeatureDistance, SimpleSearchEngineAlgorithm, PeptideIndexing, MetaboliteSpectralMatching, IDScoreSwitcherAlgorithm, IDMapper, FIAMSDataProcessor, ConsensusIDAlgorithmPEPMatrix, ConsensusIDAlgorithmPEPIons, ConsensusIDAlgorithm, BayesianProteinInferenceAlgorithm, AScore, AccurateMassSearchEngine, MetaboliteFeatureDeconvolution, and FeatureDeconvolution.
|
static |
Writes all parameters to meta values.
Parameters are written with 'name' as key and 'value' as value
write_this | Params to be written |
write_here | a MetaInfoInterface object into which the meta values will be written |
key_prefix | Will be added in front of the parameter name for the meta value key. If the prefix isn't empty and doesn't end with a colon one will be added. |
|
protected |
If this member is set to false no checking if parameters in done;.
The only reason to set this member to false is that the derived class has no parameters! However, if a grand-child has defaults and you are using a base class cast, checking will not be done when casting back to grand-child. To just omit the warning, use 'warn_empty_defaults_'
|
protected |
Container for default parameters. This member should be filled in the constructor of derived classes!
Referenced by BaseModel::BaseModel(), FeatureFinderAlgorithm::getDefaultParameters(), TOPPViewBase::initializeDefaultParameters_(), SignalToNoiseEstimatorMeanIterative< Container >::SignalToNoiseEstimatorMeanIterative(), SignalToNoiseEstimatorMedian< Container >::SignalToNoiseEstimatorMedian(), and TOPPASBase::TOPPASBase().
|
protected |
Name that is displayed in error messages during the parameter checking.
|
protected |
Container for current parameters.
Referenced by TOPPViewBase::addData(), TOPPViewBase::addDataFile(), TOPPViewBase::fileChanged_(), TOPPViewBase::finishTOPPToolExecution(), TOPPViewBase::getCanvasParameters(), TOPPASBase::loadPreferences(), TOPPViewBase::loadPreferences(), TOPPViewBase::preferencesDialog(), TOPPASBase::savePreferences(), TOPPViewBase::savePreferences(), BaseModel::setCutOff(), TOPPViewBase::showTOPPDialog_(), TOPPASBase::TOPPASBase(), TOPPViewBase::TOPPViewBase(), TOPPASBase::updateCurrentPath(), TOPPViewBase::updateCurrentPath(), BaseModel::updateMembers_(), SignalToNoiseEstimatorMeanIterative< Container >::updateMembers_(), and SignalToNoiseEstimatorMedian< Container >::updateMembers_().
|
protected |
Container for registered subsections. This member should be filled in the constructor of derived classes!
Referenced by TOPPViewBase::initializeDefaultParameters_(), and TOPPASBase::TOPPASBase().
|
protected |
If this member is set to false no warning is emitted when defaults are empty;.
The only reason to set this member to false is that the derived class has no parameters!