OpenMS
2.8.0
|
A base class for all classes handling default parameters. More...
#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
Inherited by BaseModel< 1 >, BaseModel< 2 >, SignalToNoiseEstimator< MSSpectrum >, AScore, AbsoluteQuantitation, AccurateMassSearchEngine, BaseGroupFinder, BaseLabeler, BaseModel< D >, BaseSuperimposer, BasicProteinInferenceAlgorithm, BayesianProteinInferenceAlgorithm, BernNorm, BinnedSpectrumCompareFunctor, CompNovoIdentificationBase, CompNovoIonScoringBase, ConsensusIDAlgorithm, ConsensusMapMergerAlgorithm, DBSuitability, DIAScoring, DeNovoAlgorithm, DeNovoIdentification, DeNovoIonScoring, DeNovoPostScoring, DetectabilitySimulation, DiaPrescore, DigestSimulation, ElutionModelFitter, ElutionPeakDetection, EmgGradientDescent, FIAMSDataProcessor, FalseDiscoveryRate, FeatureDeconvolution, FeatureDistance, FeatureFinderAlgorithm, FeatureFinderAlgorithmMetaboIdent, FeatureFinderIdentificationAlgorithm, FeatureFinderMultiplexAlgorithm, FeatureFindingMetabo, FeatureGroupingAlgorithm, FilterFunctor, Fitter1D, GNPSMGFFile, GaussFilter, IDDecoyProbability, IDMapper, IDMergerAlgorithm, IDRipper, IDScoreSwitcherAlgorithm, InclusionExclusionList, IonizationSimulation, IsobaricChannelExtractor, IsobaricQuantifier, IsobaricQuantitationMethod, IsotopeLabelingMDVs, KDTreeFeatureMaps, LinearResampler, LowessSmoothing, MRMDecoy, MRMFeatureFilter, MRMFeatureFinderScoring, MRMFragmentSelection, MRMMapping, MRMTransitionGroupPicker, MSPFile, MSPGenericFile, MSSim, MapAlignmentAlgorithmIdentification, MapAlignmentAlgorithmPoseClustering, MapAlignmentAlgorithmSpectrumAlignment, MapAlignmentAlgorithmTreeGuided, MarkerMower, MascotGenericFile, MascotRemoteQuery, MassDecompositionAlgorithm, MassTraceDetection, MasstraceCorrelator, PosteriorErrorProbabilityModel, MetaboliteFeatureDeconvolution, MetaboliteSpectralMatching, MorphologicalFilter, MultiplexDeltaMassesGenerator, NLargest, Normalizer, NucleicAcidSpectrumGenerator, OfflinePrecursorIonSelection, OpenPepXLAlgorithm, OpenPepXLLFAlgorithm, OptimizePeakDeconvolution, PSLPFormulation, ParentPeakMower, PeakIntegrator, PeakMarker, PeakPickerCWT, PeakPickerHiRes, PeakPickerIterative, PeakPickerMRM, PeakPickerSH, PeakSpectrumCompareFunctor, PeptideAndProteinQuant, PeptideIndexing, PlotCanvas, PrecursorIonSelection, PrecursorIonSelectionPreprocessing, ProteinResolver, ProtonDistributionModel, QuantitativeExperimentalDesign, RTSimulation, RawMSSignalSimulation, RawTandemMSSignalSimulation, SONARScoring, SavitzkyGolayFilter, Scaler, SignalToNoiseEstimator< Container >, SimpleSVM, SimpleSearchEngineAlgorithm, SimpleTSGXLMS, SiriusAdapterAlgorithm, SpectraIDViewTab, SpectraMerger, SpectraMerger::SpectraDistance_, SpectrumAlignment, SpectrumAnnotator, SqrtMower, SvmTheoreticalSpectrumGenerator, SvmTheoreticalSpectrumGeneratorTrainer, SwathMapMassCorrection, SwathWizardBase, TOFCalibration, TOPPASBase, TOPPViewBase, TargetedSpectraExtractor, TheoreticalSpectrumGenerator, TheoreticalSpectrumGeneratorXLMS, ThresholdMower, TraceFitter, TransitionTSVFile, TwoDOptimization, 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... | |
virtual 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:
range restrictions of numeric parameters
subsections that are passed to other classes can be excluded from the check (subsections_)
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(), and TOPPASBase::TOPPASBase().
const Param& getDefaults | ( | ) | const |
Non-mutable access to the default parameters.
Referenced by NucleicAcidSearchEngine::calculateAndFilterFDR_(), EmgScoring::getDefaults(), TOPPViewBase::initializeDefaultParameters_(), TOPPOpenSwathBase::performCalibration(), and PeakPickerIterative::pick().
const String& getName | ( | ) | const |
Non-mutable access to the name.
Referenced by TOPPViewBase::layerZoomChanged().
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.
|
virtual |
Assignment operator.
Referenced by BaseModel< D >::operator=(), OptimizePeakDeconvolution::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_(), ModelDescription< D >::createModel(), EmgScoring::fitRT_(), TOPPASBase::loadPreferences(), TOPPViewBase::loadPreferences(), TOPPOpenSwathBase::loadTransitionList(), TOPPGNPSExport::main_(), NucleicAcidSearchEngine::main_(), SpectraMerger::mergeSpectra_(), SpectraMerger::mergeSpectraPrecursors(), PeakPickerIterative::pick(), EmgScoring::prepareFit_(), NucleicAcidSearchEngine::preprocessSpectra_(), TOPPViewBase::showSpectrumGenerationDialog(), 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 TwoDOptimization, PeakPickerIterative, PeakPickerHiRes, PeakPickerCWT, OptimizePeakDeconvolution, TraceFitter, ProductModel< 2 >, MaxLikeliFitter1D, LevMarqFitter1D, IsotopeModel, IsotopeFitter1D, InterpolationModel, GaussTraceFitter, GaussModel, GaussFitter1D, Fitter1D, FeatureFinderIdentificationAlgorithm, FeatureFinderAlgorithmPicked, FeatureFinderAlgorithmMRM, FeatureFinderAlgorithmMetaboIdent, FeatureFinderAlgorithmIsotopeWavelet, ExtendedIsotopeModel, ExtendedIsotopeFitter1D, EmgModel, EmgFitter1D, EGHTraceFitter, BiGaussModel, BiGaussFitter1D, BaseModel< D >, BaseModel< 1 >, BaseModel< 2 >, RTSimulation, RawMSSignalSimulation, MSSim, SILACLabeler, ITRAQLabeler, ICPLLabeler, IonizationSimulation, EGHModel, EGHFitter1D, DetectabilitySimulation, EmgGradientDescent, MSPGenericFile, MascotRemoteQuery, MascotGenericFile, SpectraMerger::SpectraDistance_, Normalizer, NLargest, LinearResamplerAlign, LinearResampler, SavitzkyGolayFilter, LowessSmoothing, GaussFilter, SignalToNoiseEstimatorMedian< Container >, SignalToNoiseEstimatorMedian< OpenMS::MSChromatogram >, SignalToNoiseEstimatorMedian< ContainerT >, SignalToNoiseEstimatorMeanIterative< Container >, MassTraceDetection, FeatureFindingMetabo, ElutionPeakDetection, BinnedSumAgreeingIntensities, BinnedSpectralContrastAngle, BinnedSharedPeakCount, TheoreticalSpectrumGeneratorXLMS, TheoreticalSpectrumGenerator, SvmTheoreticalSpectrumGenerator, SpectrumAnnotator, SimpleTSGXLMS, NucleicAcidSpectrumGenerator, MassDecompositionAlgorithm, XFDRAlgorithm, OpenPepXLLFAlgorithm, OpenPepXLAlgorithm, PrecursorIonSelectionPreprocessing, PrecursorIonSelection, MRMMapping, TMTTenPlexQuantitationMethod, TMTSixteenPlexQuantitationMethod, TMTSixPlexQuantitationMethod, TMTElevenPlexQuantitationMethod, PeptideAndProteinQuant, KDTreeFeatureMaps, ItraqFourPlexQuantitationMethod, ItraqEightPlexQuantitationMethod, IsotopeLabelingMDVs, IsobaricQuantifier, IsobaricChannelExtractor, AbsoluteQuantitation, TransitionTSVFile, TargetedSpectraExtractor, SwathMapMassCorrection, SONARScoring, PeakPickerMRM, PeakIntegrator, MRMTransitionGroupPicker, MRMFeatureFinderScoring, MRMFeatureFilter, MRMDecoy, DIAScoring, DiaPrescore, StablePairFinder, SimplePairFinder, MapAlignmentAlgorithmTreeGuided, MapAlignmentAlgorithmSpectrumAlignment, MapAlignmentAlgorithmPoseClustering, FeatureDistance, SimpleSearchEngineAlgorithm, PeptideIndexing, MetaboliteSpectralMatching, IDScoreSwitcherAlgorithm, IDMapper, FIAMSDataProcessor, ConsensusIDAlgorithmPEPMatrix, ConsensusIDAlgorithmPEPIons, ConsensusIDAlgorithm, BayesianProteinInferenceAlgorithm, AScore, AccurateMassSearchEngine, CompNovoIonScoringBase, CompNovoIdentificationCID, CompNovoIdentificationBase, 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< D >::BaseModel(), FeatureFinderAlgorithm::getDefaultParameters(), TOPPViewBase::initializeDefaultParameters_(), SignalToNoiseEstimatorMeanIterative< Container >::SignalToNoiseEstimatorMeanIterative(), SignalToNoiseEstimatorMedian< Container >::SignalToNoiseEstimatorMedian(), TOPPASBase::TOPPASBase(), SiriusAdapterAlgorithm::ParameterModifier::withMinInt(), and SiriusAdapterAlgorithm::ParameterModifier::withValidStrings().
|
protected |
Name that is displayed in error messages during the parameter checking.
|
protected |
Container for current parameters.
Referenced by TOPPViewBase::addData(), TOPPViewBase::addDataFile(), TOPPViewBase::addToolParamsToIni_(), TOPPViewBase::fileChanged_(), TOPPViewBase::finishTOPPToolExecution(), TOPPViewBase::getCanvasParameters(), SiriusAdapterAlgorithm::ParameterSection::getCommandLine(), SiriusAdapterAlgorithm::ParameterSection::getValue(), TOPPASBase::loadPreferences(), TOPPViewBase::loadPreferences(), TOPPViewBase::preferencesDialog(), TOPPASBase::savePreferences(), TOPPViewBase::savePreferences(), BaseModel< D >::setCutOff(), TOPPViewBase::showTOPPDialog_(), TOPPASBase::TOPPASBase(), TOPPViewBase::TOPPViewBase(), TOPPASBase::updateCurrentPath(), TOPPViewBase::updateCurrentPath(), SignalToNoiseEstimatorMeanIterative< Container >::updateMembers_(), SignalToNoiseEstimatorMedian< Container >::updateMembers_(), and BaseModel< D >::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!