OpenMS
MapAlignmentAlgorithmTreeGuided Class Reference

A map alignment algorithm based on peptide identifications from MS2 spectra. More...

#include <OpenMS/ANALYSIS/MAPMATCHING/MapAlignmentAlgorithmTreeGuided.h>

Inheritance diagram for MapAlignmentAlgorithmTreeGuided:
[legend]
Collaboration diagram for MapAlignmentAlgorithmTreeGuided:
[legend]

Public Member Functions

 MapAlignmentAlgorithmTreeGuided ()
 Default constructor. More...
 
 ~MapAlignmentAlgorithmTreeGuided () override
 Destructor. More...
 
void treeGuidedAlignment (const std::vector< BinaryTreeNode > &tree, std::vector< FeatureMap > &feature_maps_transformed, std::vector< std::vector< double >> &maps_ranges, FeatureMap &map_transformed, std::vector< Size > &trafo_order)
 Align feature maps tree guided using align() of OpenMS::MapAlignmentAlgorithmIdentification and use TreeNode with larger 10/90 percentile range as reference. More...
 
void align (std::vector< FeatureMap > &data, std::vector< TransformationDescription > &transformations)
 Align feature maps tree guided using align() of OpenMS::MapAlignmentAlgorithmIdentification and use TreeNode with larger 10/90 percentile range as reference. More...
 
void computeTrafosByOriginalRT (std::vector< FeatureMap > &feature_maps, FeatureMap &map_transformed, std::vector< TransformationDescription > &transformations, const std::vector< Size > &trafo_order)
 Extract original RT ("original_RT" MetaInfo) and transformed RT for each feature to compute RT transformations. More...
 
- 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...
 
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...
 
virtual ~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 (UInt64 bytes_processed=0) const
 
void nextProgress () const
 increment progress by 1 (according to range begin-end) More...
 

Static Public Member Functions

static void buildTree (std::vector< FeatureMap > &feature_maps, std::vector< BinaryTreeNode > &tree, std::vector< std::vector< double >> &maps_ranges)
 Extract RTs given for individual features of each map, calculate distances for each pair of maps and cluster hierarchical using average linkage. More...
 
static void computeTransformedFeatureMaps (std::vector< FeatureMap > &feature_maps, const std::vector< TransformationDescription > &transformations)
 Apply transformations on input maps. More...
 
- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &key_prefix="")
 Writes all parameters to meta values. More...
 

Protected Types

typedef std::map< String, DoubleListSeqAndRTList
 Type to store feature retention times given for individual peptide sequence. More...
 

Protected Member Functions

void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Static Protected Member Functions

static void addPeptideSequences_ (const std::vector< PeptideIdentification > &peptides, SeqAndRTList &peptide_rts, std::vector< double > &map_range, double feature_rt)
 For given peptide identifications extract sequences and store with associated feature RT. More...
 
static void extractSeqAndRt_ (const std::vector< FeatureMap > &feature_maps, std::vector< SeqAndRTList > &maps_seq_and_rt, std::vector< std::vector< double >> &maps_ranges)
 For each input map, extract peptide identifications (sequences) of existing features with associated feature RT. 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...
 

Protected Attributes

String model_type_
 Type of transformation model. More...
 
Param model_param_
 Default params of transformation models linear, b_spline, lowess and interpolated. More...
 
MapAlignmentAlgorithmIdentification align_algorithm_
 Instantiation of alignment algorithm. 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_
 

Private Member Functions

 MapAlignmentAlgorithmTreeGuided (const MapAlignmentAlgorithmTreeGuided &)
 Copy constructor intentionally not implemented -> private. More...
 
MapAlignmentAlgorithmTreeGuidedoperator= (const MapAlignmentAlgorithmTreeGuided &)
 Assignment operator intentionally not implemented -> private. More...
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

A map alignment algorithm based on peptide identifications from MS2 spectra.

ID groups with the same sequence in different maps represent points of correspondence in RT between the maps. They are used to evaluate the distances between the maps for hierarchical clustering and form the basis for the alignment. Only the best PSM per spectrum is considered as the correct identification.

For each pair of maps, the similarity is determined based on the intersection of the contained identifications using Pearson correlation. For small intersections, the Pearson value is reduced by multiplying the ratio of the intersection size to the union size: \(\texttt{PearsonValue(map1}\cap \texttt{map2)}*\Bigl(\frac{\texttt{N(map1 }\cap\texttt{ map2})}{\texttt{N(map1 }\cup\texttt{ map2})}\Bigr)\) Using hierarchical clustering together with average linkage a binary tree is produced. Following the tree, the maps are aligned, resulting in a transformed feature map that contains both the original and the transformed retention times. As long as there are at least two clusters, the alignment is done as follows: Of every pair of clusters, the one with the larger 10/90 percentile retention time range is selected as reference for the align() method of OpenMS::MapAlignmentAlgorithmIdentification. align() aligns the median retention time of each ID group in the second cluster to the reference retention time of this group. Cubic spline smoothing is used to convert this mapping to a smooth function. Retention times in the second cluster are transformed to the reference scale by applying this function. Additionally, the original retention times are stored in the meta information of each feature. The reference is combined with the transformed cluster.

The resulting map is used to extract transformation descriptions for each input map. For each map cubic spline smoothing is used to convert the mapping to a smooth function. Retention times of each map are transformed by applying the smoothed function.

Member Typedef Documentation

◆ SeqAndRTList

typedef std::map<String, DoubleList> SeqAndRTList
protected

Type to store feature retention times given for individual peptide sequence.

Constructor & Destructor Documentation

◆ MapAlignmentAlgorithmTreeGuided() [1/2]

Default constructor.

◆ ~MapAlignmentAlgorithmTreeGuided()

Destructor.

◆ MapAlignmentAlgorithmTreeGuided() [2/2]

Copy constructor intentionally not implemented -> private.

Member Function Documentation

◆ addPeptideSequences_()

static void addPeptideSequences_ ( const std::vector< PeptideIdentification > &  peptides,
SeqAndRTList peptide_rts,
std::vector< double > &  map_range,
double  feature_rt 
)
staticprotected

For given peptide identifications extract sequences and store with associated feature RT.

Parameters
peptidesVector of peptide identifications to extract sequences.
peptide_rtsMap to store a list of feature RTs for each peptide sequence as key.
map_rangeVector in which all feature RTs are stored for given peptide identifications.
feature_rtRT value of the feature to which the peptide identifications to be analysed belong.

◆ align()

void align ( std::vector< FeatureMap > &  data,
std::vector< TransformationDescription > &  transformations 
)

Align feature maps tree guided using align() of OpenMS::MapAlignmentAlgorithmIdentification and use TreeNode with larger 10/90 percentile range as reference.

◆ buildTree()

static void buildTree ( std::vector< FeatureMap > &  feature_maps,
std::vector< BinaryTreeNode > &  tree,
std::vector< std::vector< double >> &  maps_ranges 
)
static

Extract RTs given for individual features of each map, calculate distances for each pair of maps and cluster hierarchical using average linkage.

Parameters
feature_mapsVector of input maps (FeatureMap) whose distance is to be calculated.
treeVector of BinaryTreeNodes that will be computed
maps_rangesVector to store all sorted RTs of extracted identifications for each map in feature_maps; needed to determine the 10/90 percentiles

◆ computeTrafosByOriginalRT()

void computeTrafosByOriginalRT ( std::vector< FeatureMap > &  feature_maps,
FeatureMap map_transformed,
std::vector< TransformationDescription > &  transformations,
const std::vector< Size > &  trafo_order 
)

Extract original RT ("original_RT" MetaInfo) and transformed RT for each feature to compute RT transformations.

Parameters
feature_mapsVector of input maps for size information.
map_transformedFeatureMap that contains all features of combined maps with original and transformed RTs in order of alignment.
transformationsVector to store transformation descriptions for each map. (output)
trafo_orderVector that contains the indices of aligned maps in order of alignment.

◆ computeTransformedFeatureMaps()

static void computeTransformedFeatureMaps ( std::vector< FeatureMap > &  feature_maps,
const std::vector< TransformationDescription > &  transformations 
)
static

Apply transformations on input maps.

Parameters
feature_mapsVector of maps to be transformed (output)
transformationsVector that contains TransformationDescriptions that are applied to input maps

◆ extractSeqAndRt_()

static void extractSeqAndRt_ ( const std::vector< FeatureMap > &  feature_maps,
std::vector< SeqAndRTList > &  maps_seq_and_rt,
std::vector< std::vector< double >> &  maps_ranges 
)
staticprotected

For each input map, extract peptide identifications (sequences) of existing features with associated feature RT.

Parameters
feature_mapsVector of original maps containing peptide identifications.
maps_seq_and_rtVector of maps to store feature RTs given for individual peptide sequences for each feature map.
maps_rangesVector to store all feature RTs of extracted identifications for each map; needed to determine the 10/90 percentiles.

◆ operator=()

Assignment operator intentionally not implemented -> private.

◆ treeGuidedAlignment()

void treeGuidedAlignment ( const std::vector< BinaryTreeNode > &  tree,
std::vector< FeatureMap > &  feature_maps_transformed,
std::vector< std::vector< double >> &  maps_ranges,
FeatureMap map_transformed,
std::vector< Size > &  trafo_order 
)

Align feature maps tree guided using align() of OpenMS::MapAlignmentAlgorithmIdentification and use TreeNode with larger 10/90 percentile range as reference.

Parameters
treeVector of BinaryTreeNodes that contains order for alignment.
feature_maps_transformedVector with input maps for transformation process. Because the transformed maps are stored within this vector it's not const.
maps_rangesVector that contains all sorted RTs of extracted identifications for each map; needed to determine the 10/90 percentiles.
map_transformedFeatureMap to store all features of combined maps with original and transformed RTs in order of alignment.
trafo_orderVector to store indices of maps in order of alignment.

◆ updateMembers_()

void updateMembers_ ( )
overrideprotectedvirtual

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 from DefaultParamHandler.

Member Data Documentation

◆ align_algorithm_

MapAlignmentAlgorithmIdentification align_algorithm_
protected

Instantiation of alignment algorithm.

◆ model_param_

Param model_param_
protected

Default params of transformation models linear, b_spline, lowess and interpolated.

◆ model_type_

String model_type_
protected

Type of transformation model.