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

ILP-based decharging: pick the maximum-log-score subset of charge-pair edges that yields a consistent per-feature charge assignment. More...

#include <OpenMS/ANALYSIS/DECHARGING/ILPDCWrapper.h>

Public Types

typedef std::vector< ChargePairPairsType
 Container of putative charge-pair edges between features.
 
typedef PairsType::size_type PairsIndex
 Index type into PairsType, used for slicing.
 

Public Member Functions

 ILPDCWrapper ()
 Default constructor; the class is stateless and only exposes compute()
 
virtual ~ILPDCWrapper ()
 Destructor.
 
double compute (const FeatureMap &fm, PairsType &pairs, Size verbose_level) const
 Solve the ILP on pairs to find the max-log-score subset of consistent charge-pair edges.
 

Private Types

typedef std::map< std::string, std::set< Size > > FeatureType_
 Internal lookup: feature id (as std::string) -> set of compatible charge-annotation variant indices encountered for that feature so far.
 

Private Member Functions

double computeSlice_ (const FeatureMap &fm, PairsType &pairs, const PairsIndex margin_left, const PairsIndex margin_right, const Size verbose_level) const
 Solve one slice of the edge graph (the new clique-based solver) — see compute() for the externally visible contract.
 
double computeSliceOld_ (const FeatureMap &fm, PairsType &pairs, const PairsIndex margin_left, const PairsIndex margin_right, const Size verbose_level) const
 Legacy slice solver kept for comparison / regression testing — kept in lock-step with computeSlice_.
 
double getLogScore_ (const PairsType::value_type &pair, const FeatureMap &fm) const
 Log-score of one putative charge-pair edge given the underlying feature intensities and the recorded mass-shift probability.
 
void updateFeatureVariant_ (FeatureType_ &f_set, const std::string &rota_l, const Size &v) const
 Record one more charge-annotation variant v for the feature whose rotated id is rota_l in f_set.
 

Detailed Description

ILP-based decharging: pick the maximum-log-score subset of charge-pair edges that yields a consistent per-feature charge assignment.

Wraps the integer-linear-programming step shared by FeatureDeconvolution (peptides) and MetaboliteFeatureDeconvolution (metabolites). Given a FeatureMap and a pre-computed list of putative ChargePair edges between its features (each edge captures one consistent charge-state hypothesis for a pair of features that are also adduct/mass-shift compatible), the solver returns the maximum-log-score subset of edges that respects per-feature consistency constraints (at most one realised charge-assignment per feature). The realised edges are marked active in pairs.

The implementation first partitions the input edge set into connected components and solves one ILP per component (so a single big input doesn't translate into a single intractable LP) — this slicing is handled internally and is transparent to callers.

LP-solver choice (GLPK, COIN-OR, or HiGHS — selected at build time via the LP_SOLVER CMake variable) is hidden behind LPWrapper.

Member Typedef Documentation

◆ FeatureType_

typedef std::map<std::string, std::set<Size> > FeatureType_
private

Internal lookup: feature id (as std::string) -> set of compatible charge-annotation variant indices encountered for that feature so far.

◆ PairsIndex

typedef PairsType::size_type PairsIndex

Index type into PairsType, used for slicing.

◆ PairsType

typedef std::vector<ChargePair> PairsType

Container of putative charge-pair edges between features.

Constructor & Destructor Documentation

◆ ILPDCWrapper()

Default constructor; the class is stateless and only exposes compute()

◆ ~ILPDCWrapper()

virtual ~ILPDCWrapper ( )
virtual

Destructor.

Member Function Documentation

◆ compute()

double compute ( const FeatureMap fm,
PairsType pairs,
Size  verbose_level 
) const

Solve the ILP on pairs to find the max-log-score subset of consistent charge-pair edges.

Partitions the input edge graph into connected components, solves one ILP per component (per LPWrapper), accumulates the objective values, and marks every realised edge active in pairs. The FeatureMap is read-only here — features themselves are not modified; the caller is expected to apply the chosen charge assignments to fm separately.

Parameters
[in]fmFeature map providing per-feature mass / intensity for log-score evaluation.
[in,out]pairsPutative charge-pair edges to filter; realised edges are flagged active in place.
[in]verbose_levelVerbosity for the LP solver (0 = silent; higher = more solver chatter).
Returns
Sum of per-component objective values, or -1 if fm is empty (a warning is logged in that case).

◆ computeSlice_()

double computeSlice_ ( const FeatureMap fm,
PairsType pairs,
const PairsIndex  margin_left,
const PairsIndex  margin_right,
const Size  verbose_level 
) const
private

Solve one slice of the edge graph (the new clique-based solver) — see compute() for the externally visible contract.

◆ computeSliceOld_()

double computeSliceOld_ ( const FeatureMap fm,
PairsType pairs,
const PairsIndex  margin_left,
const PairsIndex  margin_right,
const Size  verbose_level 
) const
private

Legacy slice solver kept for comparison / regression testing — kept in lock-step with computeSlice_.

◆ getLogScore_()

double getLogScore_ ( const PairsType::value_type &  pair,
const FeatureMap fm 
) const
private

Log-score of one putative charge-pair edge given the underlying feature intensities and the recorded mass-shift probability.

◆ updateFeatureVariant_()

void updateFeatureVariant_ ( FeatureType_ f_set,
const std::string &  rota_l,
const Size v 
) const
private

Record one more charge-annotation variant v for the feature whose rotated id is rota_l in f_set.