|
OpenMS
2.5.0
|
Go to the documentation of this file.
40 #include <boost/bimap.hpp>
41 #include <boost/bimap/multiset_of.hpp>
42 #include <boost/random/uniform_int.hpp>
43 #include <boost/random/mersenne_twister.hpp>
44 #include <boost/random/variate_generator.hpp>
65 generator_(), rand_gen_(generator_, boost::uniform_int<>())
67 if (!test_mode_) rand_gen_.engine().seed(time(
nullptr));
75 typedef boost::bimap<double, boost::bimaps::multiset_of<double> >
85 double operator()(
double diff_rt,
double dist_int)
87 double lm = intercept + rt_coef * diff_rt * diff_rt +
89 return 1.0 / (1.0 + exp(-lm));
99 double operator()(
double rt)
101 return (rt - min_rt) / (max_rt - min_rt) * 100;
121 boost::variate_generator<boost::mt19937&, boost::uniform_int<> >
rand_gen_;
124 void chooseDecoys_();
134 void extractIntensities_(
BimapType& intensity_map,
Size n_transitions,
141 double feature_rt,
DoubleList& feature_intensities,
142 const std::set<String>& transition_ids = std::set<String>());
145 void scoreFeature_(
Feature& feature);
152 n_decoys_ = n_decoys;
153 n_transitions_ = n_transitions;
154 rt_trafo_ = rt_trafo;
159 glm_.intercept = intercept;
160 glm_.rt_coef = rt_coef;
161 glm_.int_coef = int_coef;
183 "There need to be at least 2 assays in the library for ConfidenceScoring.");
186 if (n_assays - 1 < n_decoys_)
189 <<
") is higher than the number of unrelated assays in the "
190 <<
"library (" << n_assays - 1 <<
"). "
191 <<
"Using all unrelated assays as decoys." << std::endl;
193 if (n_assays - 1 <= n_decoys_) n_decoys_ = 0;
195 decoy_index_.resize(n_assays);
196 for (
Size i = 0; i < n_assays; ++i) decoy_index_[i] = boost::numeric_cast<Int>(i);
203 transition_map_[ref].push_back(boost::numeric_cast<Int>(i));
207 rt_norm_.min_rt = std::numeric_limits<double>::infinity();
208 rt_norm_.max_rt = -std::numeric_limits<double>::infinity();
209 for (std::vector<TargetedExperiment::Peptide>::const_iterator it =
213 double current_rt = getAssayRT_(*it);
214 if (current_rt == -1.0)
continue;
215 rt_norm_.min_rt = std::min(rt_norm_.min_rt, current_rt);
216 rt_norm_.max_rt = std::max(rt_norm_.max_rt, current_rt);
221 startProgress(0, features.size(),
"scoring features");
224 feat_it != features.end(); ++feat_it)
227 <<
" (ID '" << feat_it->
getUniqueId() <<
"')"<< std::endl;
228 scoreFeature_(*feat_it);
229 setProgress(feat_it - features.begin());
boost::bimap< double, boost::bimaps::multiset_of< double > > BimapType
Mapping: Q3 m/z <-> transition intensity (maybe not unique!)
Definition: ConfidenceScoring.h:76
const std::vector< Peptide > & getPeptides() const
A method or algorithm argument contains illegal values.
Definition: Exception.h:648
Size n_transitions_
number of transitions to consider
Definition: ConfidenceScoring.h:113
TransformationDescription rt_trafo_
RT transformation to map measured RTs to assay RTs.
Definition: ConfidenceScoring.h:116
boost::mt19937 generator_
random number generation engine
Definition: ConfidenceScoring.h:118
Base::iterator Iterator
Definition: FeatureMap.h:139
Represents a peptide (amino acid sequence)
Definition: TargetedExperimentHelper.h:370
boost::variate_generator< boost::mt19937 &, boost::uniform_int<> > rand_gen_
Random number generator (must be initialized in init. list of c'tor!)
Definition: ConfidenceScoring.h:121
A more convenient string class.
Definition: String.h:58
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:62
Map< String, IntList > transition_map_
assay (ID) -> transitions (indexes)
Definition: ConfidenceScoring.h:111
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:55
#define OPENMS_LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged.
Definition: LogStream.h:460
Size n_decoys_
number of decoys to use (per feature/true assay)
Definition: ConfidenceScoring.h:109
IntList decoy_index_
indexes of assays to use as decoys
Definition: ConfidenceScoring.h:107
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
void initialize(const TargetedExperiment &library, const Size n_decoys, const Size n_transitions, const TransformationDescription &rt_trafo)
Definition: ConfidenceScoring.h:149
#define OPENMS_LOG_DEBUG
Macro for general debugging information.
Definition: LogStream.h:470
virtual ~ConfidenceScoring()
Definition: ConfidenceScoring.h:70
TargetedExperiment library_
assay library
Definition: ConfidenceScoring.h:105
A container for features.
Definition: FeatureMap.h:95
void scoreMap(FeatureMap &features)
Score a feature map -> make sure the class is properly initialized.
Definition: ConfidenceScoring.h:176
An LC-MS feature.
Definition: Feature.h:70
void initializeGlm(double intercept, double rt_coef, double int_coef)
Definition: ConfidenceScoring.h:157
const std::vector< ReactionMonitoringTransition > & getTransitions() const
returns the transition list
Definition: ConfidenceScoring.h:58
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:50
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:64
UInt64 getUniqueId() const
Non-mutable access to unique id - returns the unique id.
Definition: UniqueIdInterface.h:105
ConfidenceScoring(bool test_mode_=false)
Constructor.
Definition: ConfidenceScoring.h:64