OpenMS
PSLPFormulation Class Reference

Implements ILP formulation of precursor selection problems. More...

#include <OpenMS/ANALYSIS/TARGETED/PSLPFormulation.h>

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

Classes

struct  IndexLess
 
struct  IndexTriple
 Struct that holds the indices of the precursors in the feature map and the ilp formulation. More...
 
struct  ScanLess
 
struct  VariableIndexLess
 

Public Member Functions

 PSLPFormulation ()
 
 ~PSLPFormulation () override
 
void createAndSolveILPForKnownLCMSMapFeatureBased (const FeatureMap &features, const PeakMap &experiment, std::vector< IndexTriple > &variable_indices, std::vector< std::vector< std::pair< Size, Size > > > &mass_ranges, std::set< Int > &charges_set, UInt ms2_spectra_per_rt_bin, std::vector< int > &solution_indices)
 Encode ILP formulation for a given LC-MS map, but unknown protein sample. More...
 
void createAndSolveILPForInclusionListCreation (PrecursorIonSelectionPreprocessing &preprocessing, UInt ms2_spectra_per_rt_bin, UInt max_list_size, FeatureMap &precursors, bool solve_ILP=true)
 Find a set of precursors, so that the protein coverage is maximal and that the number of precursors per bin is not exceeded. More...
 
void createAndSolveCombinedLPForKnownLCMSMapFeatureBased (const FeatureMap &features, const PeakMap &experiment, std::vector< IndexTriple > &variable_indices, std::vector< int > &solution_indices, std::vector< std::vector< std::pair< Size, Size > > > &mass_ranges, std::set< Int > &charges_set, UInt ms2_spectra_per_rt_bin, Size step_size=0, bool sequential_order=false)
 
void updateStepSizeConstraint (Size iteration, UInt step_size)
 
void updateFeatureILPVariables (FeatureMap &new_features, std::vector< IndexTriple > &variable_indices, std::map< Size, std::vector< String > > &feature_constraints_map)
 
void updateRTConstraintsForSequentialILP (Size &rt_index, UInt ms2_spectra_per_rt_bin, Size max_rt_index)
 
void updateCombinedILP (FeatureMap &features, PrecursorIonSelectionPreprocessing &preprocessed_db, std::vector< IndexTriple > &variable_indices, std::vector< String > &new_protein_accs, std::vector< String > &protein_accs, PSProteinInference &prot_inference, Size &variable_counter, std::map< String, std::vector< Size > > &protein_feature_map, Feature &new_feature, std::map< String, Size > &protein_variable_index_map, std::map< String, std::set< String > > &prot_id_counter)
 
void solveILP (std::vector< int > &solution_indices)
 Solve the ILP. More...
 
void setLPSolver (LPWrapper::SOLVER solver)
 
LPWrapper::SOLVER getLPSolver ()
 
- 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...
 

Protected Member Functions

void getXIC_ (const std::vector< std::pair< Size, Size > > &end_points, std::vector< double > &weights, const PeakMap &experiment, const bool normalize)
 
void calculateXICs_ (std::vector< std::vector< double > > &xics, const FeatureMap &features, const PeakMap &experiment, const std::vector< std::vector< std::pair< Size, Size > > > &mass_ranges, const bool normalize)
 Calculates the XICs for all features. More...
 
void createAndSolveILP_ (const FeatureMap &features, std::vector< std::vector< double > > &intensity_weights, std::set< Int > &charges_set, std::vector< std::vector< std::pair< Size, Size > > > &mass_ranges, std::vector< IndexTriple > &variable_indices, std::vector< int > &solution_indices, UInt ms2_spectra_per_rt_bin, Size number_of_scans)
 Creates and solves the ILP. More...
 
void createAndSolveCombinedLPFeatureBased_ (const FeatureMap &features, std::vector< std::vector< double > > &intensity_weights, std::set< Int > &charges_set, std::vector< std::vector< std::pair< Size, Size > > > &mass_ranges, std::vector< IndexTriple > &variable_indices, std::vector< Int > &solution_indices, UInt ms2_spectra_per_rt_bin, Size number_of_scans, Size step_size=0, bool sequential_order=false)
 
void addProteinToILP_ (PrecursorIonSelectionPreprocessing &preprocessing, std::map< String, std::vector< double > >::const_iterator map_iter, Size &counter, Size &pep_counter, Size &feature_counter, std::vector< IndexTriple > &variable_indices, std::map< String, Size > &protein_penalty_index_map, FeatureMap &precursors)
 
void addPrecursorAcquisitionNumberConstraint_ (std::vector< IndexTriple > &variable_indices, Size number_of_features, UInt number_of_msms_per_precursor)
 
void addMaxInclusionListSizeConstraints_ (std::vector< IndexTriple > &variable_indices, UInt max_list_size)
 
void addRTBinCapacityConstraint_ (std::vector< IndexTriple > &variable_indices, Size max_rt_index, UInt ms2_spectra_per_rt_bin, bool sequential_order=false)
 
void addProteinCoverageConstraint_ (std::vector< IndexTriple > &variable_indices, PrecursorIonSelectionPreprocessing &preprocessing, std::map< String, Size > protein_variable_index_map)
 
void addStepSizeConstraint_ (std::vector< IndexTriple > &variable_indices, UInt step_size)
 
void assembleInclusionListForProteinBasedLP_ (std::vector< IndexTriple > &variable_indices, FeatureMap &precursors, std::vector< int > &solution_indices, PrecursorIonSelectionPreprocessing &preprocessing)
 
void updateObjFunction_ (const String &acc, FeatureMap &features, PrecursorIonSelectionPreprocessing &preprocessed_db, std::vector< IndexTriple > &variable_indices)
 
Int getNumberOfPrecsInSpectrum_ (Int constr_idx)
 
- 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

LPWrappermodel_
 
LPWrapper::SOLVER solver_
 
- 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...
 

Additional Inherited Members

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

Detailed Description

Implements ILP formulation of precursor selection problems.

Parameters of this class are:

NameTypeDefaultRestrictionsDescription
mz_tolerance float25.0 min: 0.0Allowed precursor mass error tolerance in ppm.
rt:min_rt float960.0 min: 0.0Minimal rt in seconds.
rt:max_rt float3840.0 min: 0.0Maximal rt in seconds.
rt:rt_step_size float30.0 min: 1.0rt step size in seconds.
rt:rt_window_size int100 min: 1rt window size in seconds.
thresholds:min_protein_probability float0.2 min: 0.0 max: 1.0Minimal protein probability for a protein to be considered in the ILP
thresholds:min_protein_id_probability float0.95 min: 0.0 max: 1.0Minimal protein probability for a protein to be considered identified.
thresholds:min_pt_weight float0.5 min: 0.0 max: 1.0Minimal pt weight of a precursor
thresholds:min_mz float500.0 min: 0.0Minimal mz to be considered in protein based LP formulation.
thresholds:max_mz float5000.0 min: 0.0Minimal mz to be considered in protein based LP formulation.
thresholds:min_pred_pep_prob float0.5 min: 0.0 max: 1.0Minimal predicted peptide probability of a precursor
thresholds:min_rt_weight float0.5 min: 0.0 max: 1.0Minimal rt weight of a precursor
thresholds:use_peptide_rule stringfalse true, falseUse peptide rule instead of minimal protein id probability
thresholds:min_peptide_ids int2 min: 1If use_peptide_rule is true, this parameter sets the minimal number of peptide ids for a protein id
thresholds:min_peptide_probability float0.95 min: 0.0 max: 1.0If use_peptide_rule is true, this parameter sets the minimal probability for a peptide to be safely identified
combined_ilp:k1 float0.2 min: 0.0combined ilp: weight for z_i
combined_ilp:k2 float0.2 min: 0.0combined ilp: weight for x_j,s*int_j,s
combined_ilp:k3 float0.4 min: 0.0combined ilp: weight for -x_j,s*w_j,s
combined_ilp:scale_matching_probs stringtrue true, falseflag if detectability * rt_weight shall be scaled to cover all [0,1]
feature_based:no_intensity_normalization stringfalse true, falseFlag indicating if intensities shall be scaled to be in [0,1]. This is done for each feature separately, so that the feature's maximal intensity in a spectrum is set to 1.
feature_based:max_number_precursors_per_feature int1 min: 1The maximal number of precursors per feature.

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

Class Documentation

◆ OpenMS::PSLPFormulation::IndexTriple

struct OpenMS::PSLPFormulation::IndexTriple

Struct that holds the indices of the precursors in the feature map and the ilp formulation.

Collaboration diagram for PSLPFormulation::IndexTriple:
[legend]
Class Members
Size feature
String prot_acc
double rt_probability
Int scan
double signal_weight
Size variable

Constructor & Destructor Documentation

◆ PSLPFormulation()

◆ ~PSLPFormulation()

~PSLPFormulation ( )
override

Member Function Documentation

◆ addMaxInclusionListSizeConstraints_()

void addMaxInclusionListSizeConstraints_ ( std::vector< IndexTriple > &  variable_indices,
UInt  max_list_size 
)
protected

◆ addPrecursorAcquisitionNumberConstraint_()

void addPrecursorAcquisitionNumberConstraint_ ( std::vector< IndexTriple > &  variable_indices,
Size  number_of_features,
UInt  number_of_msms_per_precursor 
)
protected

◆ addProteinCoverageConstraint_()

void addProteinCoverageConstraint_ ( std::vector< IndexTriple > &  variable_indices,
PrecursorIonSelectionPreprocessing preprocessing,
std::map< String, Size protein_variable_index_map 
)
protected

◆ addProteinToILP_()

void addProteinToILP_ ( PrecursorIonSelectionPreprocessing preprocessing,
std::map< String, std::vector< double > >::const_iterator  map_iter,
Size counter,
Size pep_counter,
Size feature_counter,
std::vector< IndexTriple > &  variable_indices,
std::map< String, Size > &  protein_penalty_index_map,
FeatureMap precursors 
)
protected

◆ addRTBinCapacityConstraint_()

void addRTBinCapacityConstraint_ ( std::vector< IndexTriple > &  variable_indices,
Size  max_rt_index,
UInt  ms2_spectra_per_rt_bin,
bool  sequential_order = false 
)
protected

◆ addStepSizeConstraint_()

void addStepSizeConstraint_ ( std::vector< IndexTriple > &  variable_indices,
UInt  step_size 
)
protected

◆ assembleInclusionListForProteinBasedLP_()

void assembleInclusionListForProteinBasedLP_ ( std::vector< IndexTriple > &  variable_indices,
FeatureMap precursors,
std::vector< int > &  solution_indices,
PrecursorIonSelectionPreprocessing preprocessing 
)
protected

◆ calculateXICs_()

void calculateXICs_ ( std::vector< std::vector< double > > &  xics,
const FeatureMap features,
const PeakMap experiment,
const std::vector< std::vector< std::pair< Size, Size > > > &  mass_ranges,
const bool  normalize 
)
protected

Calculates the XICs for all features.

◆ createAndSolveCombinedLPFeatureBased_()

void createAndSolveCombinedLPFeatureBased_ ( const FeatureMap features,
std::vector< std::vector< double > > &  intensity_weights,
std::set< Int > &  charges_set,
std::vector< std::vector< std::pair< Size, Size > > > &  mass_ranges,
std::vector< IndexTriple > &  variable_indices,
std::vector< Int > &  solution_indices,
UInt  ms2_spectra_per_rt_bin,
Size  number_of_scans,
Size  step_size = 0,
bool  sequential_order = false 
)
protected

◆ createAndSolveCombinedLPForKnownLCMSMapFeatureBased()

void createAndSolveCombinedLPForKnownLCMSMapFeatureBased ( const FeatureMap features,
const PeakMap experiment,
std::vector< IndexTriple > &  variable_indices,
std::vector< int > &  solution_indices,
std::vector< std::vector< std::pair< Size, Size > > > &  mass_ranges,
std::set< Int > &  charges_set,
UInt  ms2_spectra_per_rt_bin,
Size  step_size = 0,
bool  sequential_order = false 
)

◆ createAndSolveILP_()

void createAndSolveILP_ ( const FeatureMap features,
std::vector< std::vector< double > > &  intensity_weights,
std::set< Int > &  charges_set,
std::vector< std::vector< std::pair< Size, Size > > > &  mass_ranges,
std::vector< IndexTriple > &  variable_indices,
std::vector< int > &  solution_indices,
UInt  ms2_spectra_per_rt_bin,
Size  number_of_scans 
)
protected

Creates and solves the ILP.

◆ createAndSolveILPForInclusionListCreation()

void createAndSolveILPForInclusionListCreation ( PrecursorIonSelectionPreprocessing preprocessing,
UInt  ms2_spectra_per_rt_bin,
UInt  max_list_size,
FeatureMap precursors,
bool  solve_ILP = true 
)

Find a set of precursors, so that the protein coverage is maximal and that the number of precursors per bin is not exceeded.

◆ createAndSolveILPForKnownLCMSMapFeatureBased()

void createAndSolveILPForKnownLCMSMapFeatureBased ( const FeatureMap features,
const PeakMap experiment,
std::vector< IndexTriple > &  variable_indices,
std::vector< std::vector< std::pair< Size, Size > > > &  mass_ranges,
std::set< Int > &  charges_set,
UInt  ms2_spectra_per_rt_bin,
std::vector< int > &  solution_indices 
)

Encode ILP formulation for a given LC-MS map, but unknown protein sample.

Parameters
featuresFeatureMap with all possible precursors
experimentInput raw data
variable_indicesAssignment of feature indices and ILP variables
mass_rangesFeature borders as indices in the raw data
charges_setAllowed charge states
ms2_spectra_per_rt_binAllowed number of precursors per rt bin
solution_indicesIndices of ILP variables that are in the optimal solution

◆ getLPSolver()

LPWrapper::SOLVER getLPSolver ( )
inline

◆ getNumberOfPrecsInSpectrum_()

Int getNumberOfPrecsInSpectrum_ ( Int  constr_idx)
protected

◆ getXIC_()

void getXIC_ ( const std::vector< std::pair< Size, Size > > &  end_points,
std::vector< double > &  weights,
const PeakMap experiment,
const bool  normalize 
)
protected

◆ setLPSolver()

void setLPSolver ( LPWrapper::SOLVER  solver)
inline

◆ solveILP()

void solveILP ( std::vector< int > &  solution_indices)

Solve the ILP.

◆ updateCombinedILP()

void updateCombinedILP ( FeatureMap features,
PrecursorIonSelectionPreprocessing preprocessed_db,
std::vector< IndexTriple > &  variable_indices,
std::vector< String > &  new_protein_accs,
std::vector< String > &  protein_accs,
PSProteinInference prot_inference,
Size variable_counter,
std::map< String, std::vector< Size > > &  protein_feature_map,
Feature new_feature,
std::map< String, Size > &  protein_variable_index_map,
std::map< String, std::set< String > > &  prot_id_counter 
)

◆ updateFeatureILPVariables()

void updateFeatureILPVariables ( FeatureMap new_features,
std::vector< IndexTriple > &  variable_indices,
std::map< Size, std::vector< String > > &  feature_constraints_map 
)

◆ updateObjFunction_()

void updateObjFunction_ ( const String acc,
FeatureMap features,
PrecursorIonSelectionPreprocessing preprocessed_db,
std::vector< IndexTriple > &  variable_indices 
)
protected

◆ updateRTConstraintsForSequentialILP()

void updateRTConstraintsForSequentialILP ( Size rt_index,
UInt  ms2_spectra_per_rt_bin,
Size  max_rt_index 
)

◆ updateStepSizeConstraint()

void updateStepSizeConstraint ( Size  iteration,
UInt  step_size 
)

Member Data Documentation

◆ model_

LPWrapper* model_
protected

◆ solver_

LPWrapper::SOLVER solver_
protected