![]() |
OpenMS
|
Confidence scoring for SRM/MRM/PRM features against a targeted assay library. More...
#include <OpenMS/ANALYSIS/OPENSWATH/ConfidenceScoring.h>
Classes | |
| struct | GLM_ |
| Binomial GLM used to map (squared-normalised-RT-diff, intensity-distance) -> [0, 1] confidence. More... | |
| struct | RTNorm_ |
| Map RT values into the [0, 100] interval using min/max RT of the assay library. More... | |
Public Member Functions | |
| ConfidenceScoring (bool test_mode_=false) | |
| Construct an empty scorer. | |
| ~ConfidenceScoring () override | |
| Destructor. | |
| void | initialize (const TargetedExperiment &library, const Size n_decoys, const Size n_transitions, const TransformationDescription &rt_trafo) |
| Install the configuration needed before scoreMap() can run. | |
| void | initializeGlm (double intercept, double rt_coef, double int_coef) |
| Install the GLM coefficients fitted externally on a training set. | |
| void | scoreMap (FeatureMap &features) |
Score every feature in features in place, writing per-feature scores and an updated overall-quality value. | |
Public Member Functions inherited from ProgressLogger | |
| ProgressLogger () | |
| Constructor. | |
| virtual | ~ProgressLogger () |
| Destructor. | |
| ProgressLogger (const ProgressLogger &other) | |
| Copy constructor. | |
| ProgressLogger & | operator= (const ProgressLogger &other) |
| Assignment Operator. | |
| void | setLogType (LogType type) const |
| Sets the progress log that should be used. The default type is NONE! | |
| LogType | getLogType () const |
| Returns the type of progress log being used. | |
| void | setLogger (ProgressLoggerImpl *logger) |
| Sets the logger to be used for progress logging. | |
| void | startProgress (SignedSize begin, SignedSize end, const std::string &label) const |
| Initializes the progress display. | |
| void | setProgress (SignedSize value) const |
| Sets the current progress. | |
| void | endProgress (UInt64 bytes_processed=0) const |
| void | nextProgress () const |
| increment progress by 1 (according to range begin-end) | |
Protected Member Functions | |
| void | chooseDecoys_ () |
Permute decoy_index_ in place to pick a fresh random decoy sample for the next feature. | |
| double | manhattanDist_ (DoubleList x, DoubleList y) |
| Manhattan (L1) distance between two equal-length vectors. | |
| double | getAssayRT_ (const TargetedExperiment::Peptide &assay) |
| Read the (single) retention time from an assay's TargetedExperiment::Peptide; the assay is required to have an RT set (checked in debug builds) | |
| double | scoreAssay_ (const TargetedExperiment::Peptide &assay, double feature_rt, DoubleList &feature_intensities, const std::set< std::string > &transition_ids=std::set< std::string >()) |
| Score one feature against one candidate assay. | |
| void | scoreFeature_ (Feature &feature) |
Score one feature against its matching assay plus a random decoy sample; writes the per-assay scores into feature's MetaValues. | |
Protected Attributes | |
| struct OpenMS::ConfidenceScoring::GLM_ | glm_ |
| struct OpenMS::ConfidenceScoring::RTNorm_ | rt_norm_ |
| TargetedExperiment | library_ |
| Targeted-assay library: one peptide per assay, each with its transitions. | |
| IntList | decoy_index_ |
Indexes into library_.getPeptides() used as decoys for the current feature. | |
| Size | n_decoys_ |
| Number of decoy assays to sample per feature (0 = use all unrelated assays as decoys) | |
| std::map< std::string, IntList > | transition_map_ |
Lookup assay-id -> indexes into library_.getTransitions() | |
| Size | n_transitions_ |
| Number of top-intensity transitions to keep when computing the intensity-distance term (0 = keep all) | |
| TransformationDescription | rt_trafo_ |
| Optional RT transformation applied to measured feature RTs before comparison with library RTs. | |
| Math::RandomShuffler | shuffler_ |
| Random shuffler used to draw decoy samples (seed depends on test mode — see ctor) | |
Protected Attributes inherited from ProgressLogger | |
| LogType | type_ |
| time_t | last_invoke_ |
| ProgressLoggerImpl * | current_logger_ |
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_ |
Confidence scoring for SRM/MRM/PRM features against a targeted assay library.
For each detected feature the algorithm scores the feature against
PeptideRef MetaValue), andThe per-assay score is the output of a binomial GLM (see GLM_) on two features derived from the feature/assay pair:
RTNorm_); the GLM itself applies the square (its rt_coef multiplies diff_rt*diff_rt).Initialisation flow:
Feature → assay matching is by MetaValue: each feature must carry a "PeptideRef" string (the assay id), and each subordinate (one per transition) must carry a "native_id" string matching a transition id from the library.
|
explicit |
Construct an empty scorer.
| [in] | test_mode_ | If true, seed the internal random shuffler with time(NULL) so that decoy selection is deterministic only within a single process run. If false (default), seed with 0 for fully reproducible decoy draws across runs and platforms. |
|
inlineoverride |
Destructor.
|
protected |
Permute decoy_index_ in place to pick a fresh random decoy sample for the next feature.
|
protected |
Read the (single) retention time from an assay's TargetedExperiment::Peptide; the assay is required to have an RT set (checked in debug builds)
|
inline |
Install the configuration needed before scoreMap() can run.
| [in] | library | Targeted-assay library; must have at least 2 peptides for scoring to be defined. |
| [in] | n_decoys | Number of decoy assays to sample per feature (clamped to all-available if larger, with warning). |
| [in] | n_transitions | Number of top-intensity transitions to keep when computing the intensity-distance term; 0 keeps all. |
| [in] | rt_trafo | RT transformation applied to feature RTs before comparison against library RTs. |
|
inline |
Install the GLM coefficients fitted externally on a training set.
Coefficients correspond to the GLM_ formula \(\mathrm{sigmoid}(\mathrm{intercept} + \mathrm{rt\_coef} \cdot \Delta\mathrm{RT}^2 + \mathrm{int\_coef} \cdot d_\mathrm{int})\).
| [in] | intercept | GLM intercept term. |
| [in] | rt_coef | Coefficient on \(\Delta\mathrm{RT}^2\) (using normalised RT in [0, 100]). |
| [in] | int_coef | Coefficient on the Manhattan intensity distance. |
|
protected |
Manhattan (L1) distance between two equal-length vectors.
|
protected |
Score one feature against one candidate assay.
Reduces the assay's transitions to those listed in transition_ids (or all if the set is empty), matches them up with the feature's transition intensities by Q3 m/z, computes the Manhattan distance on the resulting paired intensity vectors, evaluates the GLM on (RT² diff, intensity distance) and returns the GLM output in [0, 1].
| [in] | assay | Candidate assay (true or decoy). |
| [in] | feature_rt | Feature retention time after rt_trafo_ and rt_norm_. |
| [in,out] | feature_intensities | Feature's transition intensities; reordered to match the assay's transition list. |
| [in] | transition_ids | Optional subset of transition ids to consider; empty means "use all transitions of the assay". |
|
protected |
Score one feature against its matching assay plus a random decoy sample; writes the per-assay scores into feature's MetaValues.
|
inline |
Score every feature in features in place, writing per-feature scores and an updated overall-quality value.
Prerequisite: both initialize and initializeGlm must have been called first.
The input contract is:
features each carry the assay id in MetaValue "PeptideRef"."native_id".Per-feature side effects:
"GLM_score" is set to the GLM score against the true assay."local_FDR" is set to the rank-based local FDR estimated against the per-feature decoy scores.1.0 - local_FDR.Other side effects:
rt_norm_.n_decoys_ exceeds the number of unrelated assays in the library, it is clamped to 0 (= use all available assays as decoys) and a warning is logged.| [in,out] | features | Feature map to score; per-feature MetaValues and overall quality are written in place. |
| Exception::IllegalArgument | If library_ has fewer than 2 peptides. |
References ExposedVector< VectorElement >::begin(), ExposedVector< VectorElement >::end(), TargetedExperiment::getPeptides(), TargetedExperiment::getTransitions(), OPENMS_LOG_DEBUG, OPENMS_LOG_WARN, and ExposedVector< VectorElement >::size().
|
protected |
Indexes into library_.getPeptides() used as decoys for the current feature.
|
protected |
|
protected |
Targeted-assay library: one peptide per assay, each with its transitions.
|
protected |
Number of decoy assays to sample per feature (0 = use all unrelated assays as decoys)
|
protected |
Number of top-intensity transitions to keep when computing the intensity-distance term (0 = keep all)
|
protected |
|
protected |
Optional RT transformation applied to measured feature RTs before comparison with library RTs.
|
protected |
Random shuffler used to draw decoy samples (seed depends on test mode — see ctor)
|
protected |
Lookup assay-id -> indexes into library_.getTransitions()