OpenMS
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FFIDAlgoExternalIDHandler Class Reference

Class for handling external peptide identifications in feature finding. More...

#include <OpenMS/FEATUREFINDER/FFIDAlgoExternalIDHandler.h>

Collaboration diagram for FFIDAlgoExternalIDHandler:
[legend]

Public Types

typedef std::multimap< double, PeptideIdentification * > ExternalRTMap
 RTMap for external data structure storage. More...
 
typedef std::map< Int, ExternalRTMapExternalChargeMap
 Charge to External RTMap mapping. More...
 
typedef std::map< AASequence, ExternalChargeMapExternalPeptideMap
 Sequence to External Charge Map mapping. More...
 

Public Member Functions

 FFIDAlgoExternalIDHandler ()
 Default constructor. More...
 
void reset ()
 Reset the handler's state. More...
 
void addExternalPeptide (PeptideIdentification &peptide)
 Add an external peptide to the handler's map. More...
 
void processExternalPeptides (std::vector< PeptideIdentification > &peptides_ext)
 Process external peptide IDs. More...
 
double alignInternalAndExternalIDs (const std::vector< PeptideIdentification > &peptides_internal, const std::vector< PeptideIdentification > &peptides_external, double rt_quantile)
 Align internal and external IDs to estimate RT shifts and return RT uncertainty. More...
 
double transformRT (double rt) const
 Transform RT from internal to external scale. More...
 
bool hasRTTransformation () const
 Check if we have RT transformation data. More...
 
const TransformationDescriptiongetRTTransformation () const
 Get the RT transformation. More...
 
void classifyFeaturesWithSVM (FeatureMap &features, const Param &param)
 Classify features using SVM. More...
 
void filterClassifiedFeatures (FeatureMap &features, double quality_cutoff)
 Filter classified features. More...
 
void calculateFDR (FeatureMap &features)
 Calculate FDR for classified features. More...
 
const std::map< double, std::pair< Size, Size > > & getSVMProbsInternal () const
 Get SVM probabilities for internal features. More...
 

Private Member Functions

void addExternalPeptideToMap_ (PeptideIdentification &peptide, std::map< AASequence, std::map< Int, std::pair< std::multimap< double, PeptideIdentification * >, std::multimap< double, PeptideIdentification * >>>> &peptide_map)
 Add external peptide to charge map (merged version for compatibility) More...
 
bool fillExternalRTMap_ (const AASequence &sequence, Int charge, std::multimap< double, PeptideIdentification * > &rt_map)
 Fill an external RTMap from our data for a specific peptide and charge. More...
 
void annotateFeatureWithExternalIDs_ (Feature &feature)
 Check and set feature class based on external data. More...
 
void initSVMParameters_ (const Param &param)
 Initialize SVM parameters. More...
 
void finalizeAssayFeatures_ (Feature &best_feature, double best_quality, double quality_cutoff)
 Finalize assay features. More...
 
void getRandomSample_ (std::map< Size, double > &training_labels)
 Get random sample for SVM training. More...
 
void checkNumObservations_ (Size n_pos, Size n_neg, const String &note="") const
 Check observation counts for SVM. More...
 
void getUnbiasedSample_ (const std::multimap< double, std::pair< Size, bool > > &valid_obs, std::map< Size, double > &training_labels)
 Get unbiased sample for SVM training. More...
 
void addDummyPeptideID_ (Feature &feature, const PeptideIdentification *ext_id)
 Add dummy peptide identification from external data. More...
 
void handleExternalFeature_ (Feature &feature, double prob_positive, double quality_cutoff)
 Handle external feature probability. More...
 
void adjustFDRForExternalFeatures_ (std::vector< double > &fdr_probs, std::vector< double > &fdr_qvalues, Size n_internal_features)
 Adjust FDR calculation for external features. More...
 

Private Attributes

ExternalPeptideMap external_peptide_map_
 External peptide storage. More...
 
TransformationDescription rt_transformation_
 RT transformation description. More...
 
Size n_external_peptides_
 Number of external peptides. More...
 
Size n_external_features_
 Number of external features. More...
 
std::multiset< double > svm_probs_external_
 SVM probabilities for external features. More...
 
std::map< double, std::pair< Size, Size > > svm_probs_internal_
 SVM probabilities for internal features. More...
 
Size svm_n_parts_
 SVM number of parts for cross-validation. More...
 
Size svm_n_samples_
 SVM number of samples for training. More...
 
double svm_min_prob_
 SVM minimum probability threshold. More...
 
double svm_quality_cutoff
 SVM quality cutoff. More...
 
std::vector< Stringsvm_predictor_names_
 SVM predictor names. More...
 
String svm_xval_out_
 SVM cross-validation output file. More...
 
Int debug_level_
 Debug level. More...
 
Size n_internal_features_
 Number of internal features. More...
 

Detailed Description

Class for handling external peptide identifications in feature finding.

This class encapsulates all functionality related to external peptide IDs in the feature finding process, including storage, RT transformation, and feature annotation.

Member Typedef Documentation

◆ ExternalChargeMap

typedef std::map<Int, ExternalRTMap> ExternalChargeMap

Charge to External RTMap mapping.

◆ ExternalPeptideMap

Sequence to External Charge Map mapping.

◆ ExternalRTMap

typedef std::multimap<double, PeptideIdentification*> ExternalRTMap

RTMap for external data structure storage.

Constructor & Destructor Documentation

◆ FFIDAlgoExternalIDHandler()

Default constructor.

Member Function Documentation

◆ addDummyPeptideID_()

void addDummyPeptideID_ ( Feature feature,
const PeptideIdentification ext_id 
)
private

Add dummy peptide identification from external data.

◆ addExternalPeptide()

void addExternalPeptide ( PeptideIdentification peptide)

Add an external peptide to the handler's map.

◆ addExternalPeptideToMap_()

void addExternalPeptideToMap_ ( PeptideIdentification peptide,
std::map< AASequence, std::map< Int, std::pair< std::multimap< double, PeptideIdentification * >, std::multimap< double, PeptideIdentification * >>>> &  peptide_map 
)
private

Add external peptide to charge map (merged version for compatibility)

◆ adjustFDRForExternalFeatures_()

void adjustFDRForExternalFeatures_ ( std::vector< double > &  fdr_probs,
std::vector< double > &  fdr_qvalues,
Size  n_internal_features 
)
private

Adjust FDR calculation for external features.

◆ alignInternalAndExternalIDs()

double alignInternalAndExternalIDs ( const std::vector< PeptideIdentification > &  peptides_internal,
const std::vector< PeptideIdentification > &  peptides_external,
double  rt_quantile 
)

Align internal and external IDs to estimate RT shifts and return RT uncertainty.

◆ annotateFeatureWithExternalIDs_()

void annotateFeatureWithExternalIDs_ ( Feature feature)
private

Check and set feature class based on external data.

◆ calculateFDR()

void calculateFDR ( FeatureMap features)

Calculate FDR for classified features.

◆ checkNumObservations_()

void checkNumObservations_ ( Size  n_pos,
Size  n_neg,
const String note = "" 
) const
private

Check observation counts for SVM.

◆ classifyFeaturesWithSVM()

void classifyFeaturesWithSVM ( FeatureMap features,
const Param param 
)

Classify features using SVM.

◆ fillExternalRTMap_()

bool fillExternalRTMap_ ( const AASequence sequence,
Int  charge,
std::multimap< double, PeptideIdentification * > &  rt_map 
)
private

Fill an external RTMap from our data for a specific peptide and charge.

◆ filterClassifiedFeatures()

void filterClassifiedFeatures ( FeatureMap features,
double  quality_cutoff 
)

Filter classified features.

◆ finalizeAssayFeatures_()

void finalizeAssayFeatures_ ( Feature best_feature,
double  best_quality,
double  quality_cutoff 
)
private

Finalize assay features.

◆ getRandomSample_()

void getRandomSample_ ( std::map< Size, double > &  training_labels)
private

Get random sample for SVM training.

◆ getRTTransformation()

const TransformationDescription& getRTTransformation ( ) const

Get the RT transformation.

◆ getSVMProbsInternal()

const std::map<double, std::pair<Size, Size> >& getSVMProbsInternal ( ) const

Get SVM probabilities for internal features.

◆ getUnbiasedSample_()

void getUnbiasedSample_ ( const std::multimap< double, std::pair< Size, bool > > &  valid_obs,
std::map< Size, double > &  training_labels 
)
private

Get unbiased sample for SVM training.

◆ handleExternalFeature_()

void handleExternalFeature_ ( Feature feature,
double  prob_positive,
double  quality_cutoff 
)
private

Handle external feature probability.

◆ hasRTTransformation()

bool hasRTTransformation ( ) const

Check if we have RT transformation data.

◆ initSVMParameters_()

void initSVMParameters_ ( const Param param)
private

Initialize SVM parameters.

◆ processExternalPeptides()

void processExternalPeptides ( std::vector< PeptideIdentification > &  peptides_ext)

Process external peptide IDs.

◆ reset()

void reset ( )

Reset the handler's state.

◆ transformRT()

double transformRT ( double  rt) const

Transform RT from internal to external scale.

Member Data Documentation

◆ debug_level_

Int debug_level_
private

Debug level.

◆ external_peptide_map_

ExternalPeptideMap external_peptide_map_
private

External peptide storage.

◆ n_external_features_

Size n_external_features_
private

Number of external features.

◆ n_external_peptides_

Size n_external_peptides_
private

Number of external peptides.

◆ n_internal_features_

Size n_internal_features_
private

Number of internal features.

◆ rt_transformation_

TransformationDescription rt_transformation_
private

RT transformation description.

◆ svm_min_prob_

double svm_min_prob_
private

SVM minimum probability threshold.

◆ svm_n_parts_

Size svm_n_parts_
private

SVM number of parts for cross-validation.

◆ svm_n_samples_

Size svm_n_samples_
private

SVM number of samples for training.

◆ svm_predictor_names_

std::vector<String> svm_predictor_names_
private

SVM predictor names.

◆ svm_probs_external_

std::multiset<double> svm_probs_external_
private

SVM probabilities for external features.

◆ svm_probs_internal_

std::map<double, std::pair<Size, Size> > svm_probs_internal_
private

SVM probabilities for internal features.

◆ svm_quality_cutoff

double svm_quality_cutoff
private

SVM quality cutoff.

◆ svm_xval_out_

String svm_xval_out_
private

SVM cross-validation output file.