OpenMS
Loading...
Searching...
No Matches
FeatureGroupingAlgorithmWNet Class Reference

A feature grouping algorithm using Wasserstein optimal transport. More...

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

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

Public Member Functions

 FeatureGroupingAlgorithmWNet ()
 Default constructor.
 
 ~FeatureGroupingAlgorithmWNet () override
 Destructor.
 
void group (const std::vector< FeatureMap > &maps, ConsensusMap &out) override
 Applies the algorithm to feature maps.
 
void group (const std::vector< ConsensusMap > &maps, ConsensusMap &out) override
 Applies the algorithm to consensus maps.
 
- Public Member Functions inherited from FeatureGroupingAlgorithm
 FeatureGroupingAlgorithm ()
 Default constructor.
 
 ~FeatureGroupingAlgorithm () override
 Destructor.
 
void transferSubelements (const std::vector< ConsensusMap > &maps, ConsensusMap &out) const
 Transfers subelements (grouped features) from input consensus maps to the result consensus map.
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const std::string &name)
 Constructor with name that is displayed in error messages.
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor.
 
virtual ~DefaultParamHandler ()
 Destructor.
 
DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator.
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator.
 
void setParameters (const Param &param)
 Sets the parameters.
 
const ParamgetParameters () const
 Non-mutable access to the parameters.
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters.
 
const std::string & getName () const
 Non-mutable access to the name.
 
void setName (const std::string &name)
 Mutable access to the name.
 
const std::vector< std::string > & getSubsections () const
 Non-mutable access to the registered subsections.
 

Private Member Functions

 FeatureGroupingAlgorithmWNet (const FeatureGroupingAlgorithmWNet &)=delete
 
FeatureGroupingAlgorithmWNetoperator= (const FeatureGroupingAlgorithmWNet &)=delete
 
 FeatureGroupingAlgorithmWNet (FeatureGroupingAlgorithmWNet &&)=delete
 
FeatureGroupingAlgorithmWNetoperator= (FeatureGroupingAlgorithmWNet &&)=delete
 
template<typename MapType >
void group_ (const std::vector< MapType > &maps, ConsensusMap &out)
 

Additional Inherited Members

- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const std::string &key_prefix="")
 Writes all parameters to meta values.
 
- Protected Member Functions inherited from FeatureGroupingAlgorithm
template<class MapType >
void postprocess_ (const std::vector< MapType > &maps, ConsensusMap &out)
 
- 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.
 
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor.
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters.
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes!
 
std::vector< std::string > subsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes!
 
std::string error_name_
 Name that is displayed in error messages during the parameter checking.
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;.
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;.
 

Detailed Description

A feature grouping algorithm using Wasserstein optimal transport.

Groups corresponding features across multiple maps by solving a minimum-cost network flow problem. Each pair of maps is aligned independently using WNetAligner<2> (2D: m/z and RT), and pairwise matchings are merged into consensus groups via union-find.

Features are matched by minimizing the total transport cost between their (m/z, RT) positions, with unmatched features assigned to a "trash" node at a configurable cost. This produces a 1-to-1 consensus matching per pair.

Parameters of this class are:

NameTypeDefaultRestrictionsDescription
distance_metric stringLINF L1, L2, LINFDistance metric for comparing feature positions
max_rt_shift float100.0 min: 0.0Maximum allowed RT difference (in seconds) for matching features.
mz_unit stringppm Da, ppmUnit for the m/z tolerance. 'Da' uses max_mz_shift_da; 'ppm' uses max_mz_shift_ppm and log-transforms the m/z axis.
max_mz_shift_da float0.3 min: 0.0Maximum allowed m/z difference in Daltons. Used when mz_unit is 'Da'.
max_mz_shift_ppm float10.0 min: 0.0Maximum allowed m/z difference in ppm. Used when mz_unit is 'ppm'.
trash_cost float0.0 min: 0.0Cost of leaving a feature unmatched (in seconds). Set to 0 to auto-derive from max_rt_shift (a match at the boundary costs the same as no match). Increase to prefer matching over leaving features unmatched.
normalize_intensities stringtrue true, falseNormalize feature intensities per map before alignment so that total intensity is equal across maps.
decharge_mz stringfalse true, falseConvert observed m/z values to their singly-charged (z=1) equivalent before alignment. Features with charge z>1 are projected to [M+H]+ m/z, making features of the same compound but different charge states directly comparable. If a feature carries a 'dc_charge_adduct_mass' MetaValue (set by MetaboliteFeatureDeconvolution), the stored adduct mass is used; otherwise pure H+ adducts are assumed. Features with unknown charge (z=0) are left unchanged.

Note:
  • If a section name is documented, the documentation is displayed as tooltip.
  • Advanced parameter names are italic.

Constructor & Destructor Documentation

◆ FeatureGroupingAlgorithmWNet() [1/3]

Default constructor.

◆ ~FeatureGroupingAlgorithmWNet()

Destructor.

◆ FeatureGroupingAlgorithmWNet() [2/3]

◆ FeatureGroupingAlgorithmWNet() [3/3]

Member Function Documentation

◆ group() [1/2]

void group ( const std::vector< ConsensusMap > &  maps,
ConsensusMap out 
)
overridevirtual

Applies the algorithm to consensus maps.

Precondition
The data ranges of the input maps have to be up-to-date (use ConsensusMap::updateRanges).
Parameters
[in]mapsInput consensus maps (at least two required).
[out]outResulting consensus map with grouped features.
Exceptions
IllegalArgumentis thrown if less than two input maps are given.

Reimplemented from FeatureGroupingAlgorithm.

◆ group() [2/2]

void group ( const std::vector< FeatureMap > &  maps,
ConsensusMap out 
)
overridevirtual

Applies the algorithm to feature maps.

Precondition
The data ranges of the input maps have to be up-to-date (use FeatureMap::updateRanges).
Parameters
[in]mapsInput feature maps (at least two required).
[out]outResulting consensus map with grouped features.
Exceptions
IllegalArgumentis thrown if less than two input maps are given.

Implements FeatureGroupingAlgorithm.

◆ group_()

template<typename MapType >
void group_ ( const std::vector< MapType > &  maps,
ConsensusMap out 
)
private

◆ operator=() [1/2]

FeatureGroupingAlgorithmWNet & operator= ( const FeatureGroupingAlgorithmWNet )
privatedelete

◆ operator=() [2/2]

FeatureGroupingAlgorithmWNet & operator= ( FeatureGroupingAlgorithmWNet &&  )
privatedelete