Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
InternalCalibration Class Reference

A simple calibration method using linear interpolation of given reference masses. More...

#include <OpenMS/FILTERING/CALIBRATION/InternalCalibration.h>

Inheritance diagram for InternalCalibration:
DefaultParamHandler ProgressLogger

Public Member Functions

 InternalCalibration ()
 Default constructor. More...
 
 ~InternalCalibration ()
 Destructor. More...
 
template<typename InputPeakType >
void calibrateMapSpectrumwise (const MSExperiment< InputPeakType > &exp, MSExperiment< InputPeakType > &calibrated_exp, std::vector< double > &ref_masses)
 Calibrate a peak map using given reference masses with a separate calibration function for each spectrum. More...
 
template<typename InputPeakType >
void calibrateMapGlobally (const MSExperiment< InputPeakType > &exp, MSExperiment< InputPeakType > &calibrated_exp, std::vector< double > &ref_masses, String trafo_file_name="")
 Calibrate a peak map using given reference masses with one calibration function for the whole map. More...
 
template<typename InputPeakType >
void calibrateMapGlobally (const MSExperiment< InputPeakType > &exp, MSExperiment< InputPeakType > &calibrated_exp, std::vector< PeptideIdentification > &ref_ids, String trafo_file_name="")
 Calibrate a peak map using given reference ids with one calibration function for the whole map. More...
 
void calibrateMapGlobally (const FeatureMap &feature_map, FeatureMap &calibrated_feature_map, String trafo_file_name="")
 Calibrate an annotated feature map with one calibration function for the whole map. More...
 
void calibrateMapGlobally (const FeatureMap &feature_map, FeatureMap &calibrated_feature_map, std::vector< PeptideIdentification > &ref_ids, String trafo_file_name="")
 Calibrate a feature map using given reference ids with one calibration function for the whole map. More...
 
template<typename InputPeakType >
void calibrateMapList (std::vector< MSExperiment< InputPeakType > > &exp_list, std::vector< MSExperiment< InputPeakType > > &calibrated_exp_list, std::vector< double > &ref_masses, std::vector< double > &detected_background_masses)
 
- Public Member Functions inherited from DefaultParamHandler
 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 DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () 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...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
 ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 

Protected Member Functions

void makeLinearRegression_ (std::vector< double > &observed_masses, std::vector< double > &theoretical_masses)
 the actual calibration function More...
 
void checkReferenceIds_ (std::vector< PeptideIdentification > &pep_ids)
 check if reference ids contain RT and MZ information as meta values More...
 
void checkReferenceIds_ (const FeatureMap &feature_map)
 check if reference ids contain RT and MZ information as meta values More...
 
void applyTransformation_ (const FeatureMap &feature_map, FeatureMap &calibrated_feature_map)
 apply transformation to all features (including subordinates and convex hulls) More...
 
- Protected Member Functions inherited from DefaultParamHandler
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

TransformationDescription trafo_
 here the transformation is stored More...
 
- Protected Attributes inherited from DefaultParamHandler
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< Stringsubsections_
 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...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 
- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

A simple calibration method using linear interpolation of given reference masses.

This class implements a simple calibration method: given a list of reference masses, the relative errors of the peaks in the data are approximated by linear interpolation and subtracted from the data.

Parameters of this class are:

NameTypeDefaultRestrictionsDescription
mz_tolerance float1 min: 0Allowed tolerance between peak and reference m/z.
mz_tolerance_unit stringDa Da, ppmUnit for mz_tolerance.
rt_tolerance int10  Allowed tolerance between peak and reference rt.

Note:

Constructor & Destructor Documentation

Default constructor.

~InternalCalibration ( )
inline

Destructor.

Member Function Documentation

void applyTransformation_ ( const FeatureMap feature_map,
FeatureMap calibrated_feature_map 
)
protected

apply transformation to all features (including subordinates and convex hulls)

void calibrateMapGlobally ( const MSExperiment< InputPeakType > &  exp,
MSExperiment< InputPeakType > &  calibrated_exp,
std::vector< double > &  ref_masses,
String  trafo_file_name = "" 
)

Calibrate a peak map using given reference masses with one calibration function for the whole map.

The calibration function is calculated for the whole map. For the matching of the reference masses and the peaks the parameter mz_tolerance is used to calculate a window around the reference masses. If more than one peak is found within this window the closest peak is taken.

Parameters
expthe uncalibrated peak map
calibrated_expthe calibrated peak map
ref_massesthe reference m/z values
trafo_file_namefile where the transformation function of the calibration is stored

References TransformationDescription::apply(), MSExperiment< PeakT, ChromatogramPeakT >::empty(), ProgressLogger::endProgress(), Param::getValue(), InternalCalibration::makeLinearRegression_(), DefaultParamHandler::param_, SpectrumSettings::PEAKS, MSExperiment< PeakT, ChromatogramPeakT >::resize(), ProgressLogger::setProgress(), MSExperiment< PeakT, ChromatogramPeakT >::size(), ProgressLogger::startProgress(), TransformationXMLFile::store(), and InternalCalibration::trafo_.

void calibrateMapGlobally ( const MSExperiment< InputPeakType > &  exp,
MSExperiment< InputPeakType > &  calibrated_exp,
std::vector< PeptideIdentification > &  ref_ids,
String  trafo_file_name = "" 
)

Calibrate a peak map using given reference ids with one calibration function for the whole map.

Calibrate a map using given peptide identifications. The calibration function is calculated for the whole map. The m/z-values of the reference identifications are calculated through the given sequence and charge of the peptide. For the matching of the reference masses and the peaks the parameter mz_tolerance is used to calculate a window around the reference masses. If more than one peak is found within this window the closest peak is taken.

Parameters
expthe uncalibrated peak map
calibrated_expthe calibrated peak map
ref_idsthe reference peptide identifications
trafo_file_namefile where the transformation function of the calibration is stored

References TransformationDescription::apply(), MSExperiment< PeakT, ChromatogramPeakT >::begin(), InternalCalibration::checkReferenceIds_(), MSExperiment< PeakT, ChromatogramPeakT >::empty(), MSExperiment< PeakT, ChromatogramPeakT >::end(), Residue::Full, Param::getValue(), InternalCalibration::makeLinearRegression_(), DefaultParamHandler::param_, SpectrumSettings::PEAKS, MSExperiment< PeakT, ChromatogramPeakT >::resize(), MSExperiment< PeakT, ChromatogramPeakT >::RTBegin(), MSExperiment< PeakT, ChromatogramPeakT >::size(), TransformationXMLFile::store(), and InternalCalibration::trafo_.

void calibrateMapGlobally ( const FeatureMap feature_map,
FeatureMap calibrated_feature_map,
String  trafo_file_name = "" 
)

Calibrate an annotated feature map with one calibration function for the whole map.

Calibrate an annotated (!) feature map using the features' identifications. The calibration function is calculated for the whole map. The m/z-values of the reference identifications are calculated through the given sequence and charge of the peptide.

Parameters
feature_mapthe uncalibrated feature map (annotated with peptide ids)
calibrated_feature_mapthe calibrated feature map
trafo_file_namefile where the transformation function of the calibration is stored
void calibrateMapGlobally ( const FeatureMap feature_map,
FeatureMap calibrated_feature_map,
std::vector< PeptideIdentification > &  ref_ids,
String  trafo_file_name = "" 
)

Calibrate a feature map using given reference ids with one calibration function for the whole map.

Calibrate a feature map using given peptide identifications. The calibration function is calculated for the whole map. Even if the features are already annotated with peptide ids these annotations are ignored for the calibration, only the reference ids are used. The m/z-values of the reference identifications are calculated through the given sequence and charge of the peptide. The reference ids are mapped onto the FeatureMap using IDMapper with the mz_tolerance and rt_tolerance parameters.

Parameters
feature_mapthe uncalibrated feature map
calibrated_feature_mapthe calibrated feature map
ref_idsthe reference peptide identifications
trafo_file_namefile where the transformation function of the calibration is stored
void calibrateMapList ( std::vector< MSExperiment< InputPeakType > > &  exp_list,
std::vector< MSExperiment< InputPeakType > > &  calibrated_exp_list,
std::vector< double > &  ref_masses,
std::vector< double > &  detected_background_masses 
)
void calibrateMapSpectrumwise ( const MSExperiment< InputPeakType > &  exp,
MSExperiment< InputPeakType > &  calibrated_exp,
std::vector< double > &  ref_masses 
)

Calibrate a peak map using given reference masses with a separate calibration function for each spectrum.

The calibration function is calculated for each spectrum separately. If not enough reference masses are found for a spectrum it is left uncalibrated. For the matching of the reference masses and the peaks, the parameter mz_tolerance is used to calculate a window around the reference masses. If more than one peak is found within this window the closest peak is taken.

Parameters
expthe uncalibrated peak map
calibrated_expthe calibrated peak map
ref_massesthe reference m/z values

References TransformationDescription::apply(), MSExperiment< PeakT, ChromatogramPeakT >::empty(), ProgressLogger::endProgress(), Param::getValue(), InternalCalibration::makeLinearRegression_(), DefaultParamHandler::param_, SpectrumSettings::PEAKS, ProgressLogger::setProgress(), MSExperiment< PeakT, ChromatogramPeakT >::size(), ProgressLogger::startProgress(), InternalCalibration::trafo_, and OpenMS::writtenDigits< double >().

void checkReferenceIds_ ( std::vector< PeptideIdentification > &  pep_ids)
protected

check if reference ids contain RT and MZ information as meta values

Referenced by InternalCalibration::calibrateMapGlobally().

void checkReferenceIds_ ( const FeatureMap feature_map)
protected

check if reference ids contain RT and MZ information as meta values

void makeLinearRegression_ ( std::vector< double > &  observed_masses,
std::vector< double > &  theoretical_masses 
)
protected

Member Data Documentation

TransformationDescription trafo_
protected

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:46 using doxygen 1.8.5