35 #ifndef OPENMS_ANALYSIS_OPENSWATH_CONFIDENCESCORING_H 36 #define OPENMS_ANALYSIS_OPENSWATH_CONFIDENCESCORING_H 41 #include <boost/bimap.hpp> 42 #include <boost/bimap/multiset_of.hpp> 43 #include <boost/random/uniform_int.hpp> 44 #include <boost/random/mersenne_twister.hpp> 45 #include <boost/random/variate_generator.hpp> 66 generator_(), rand_gen_(generator_,
boost::uniform_int<>())
68 if (!test_mode_) rand_gen_.engine().seed(time(0));
76 typedef boost::bimap<double, boost::bimaps::multiset_of<double> >
86 double operator()(
double diff_rt,
double dist_int)
88 double lm = intercept + rt_coef * diff_rt * diff_rt +
90 return 1.0 / (1.0 + exp(-lm));
100 double operator()(
double rt)
102 return (rt - min_rt) / (max_rt - min_rt) * 100;
122 boost::variate_generator<boost::mt19937&, boost::uniform_int<> >
rand_gen_;
125 void chooseDecoys_();
132 const String& cv_accession =
"MS:1000896");
136 void extractIntensities_(
BimapType& intensity_map,
Size n_transitions,
143 double feature_rt,
DoubleList& feature_intensities,
144 const std::set<String>& transition_ids = std::set<String>());
147 void scoreFeature_(
Feature& feature);
154 n_decoys_ = n_decoys;
155 n_transitions_ = n_transitions;
156 rt_trafo_ = rt_trafo;
161 glm_.intercept = intercept;
162 glm_.rt_coef = rt_coef;
163 glm_.int_coef = int_coef;
185 "There need to be at least 2 assays in the library for ConfidenceScoring.");
188 if (n_assays - 1 < n_decoys_)
190 LOG_WARN <<
"Warning: Parameter 'decoys' (" << n_decoys_
191 <<
") is higher than the number of unrelated assays in the " 192 <<
"library (" << n_assays - 1 <<
"). " 193 <<
"Using all unrelated assays as decoys." << std::endl;
195 if (n_assays - 1 <= n_decoys_) n_decoys_ = 0;
197 decoy_index_.resize(n_assays);
198 for (
Size i = 0; i < n_assays; ++i) decoy_index_[i] = boost::numeric_cast<Int>(i);
201 LOG_DEBUG <<
"Building transition map..." << std::endl;
205 transition_map_[ref].push_back(boost::numeric_cast<Int>(i));
208 LOG_DEBUG <<
"Determining retention time range..." << std::endl;
209 rt_norm_.min_rt = std::numeric_limits<double>::infinity();
210 rt_norm_.max_rt = -std::numeric_limits<double>::infinity();
211 for (std::vector<TargetedExperiment::Peptide>::const_iterator it =
215 double current_rt = getAssayRT_(*it);
216 if (current_rt == -1.0)
continue;
217 rt_norm_.min_rt = std::min(rt_norm_.min_rt, current_rt);
218 rt_norm_.max_rt = std::max(rt_norm_.max_rt, current_rt);
222 LOG_DEBUG <<
"Scoring features..." << std::endl;
223 startProgress(0, features.size(),
"scoring features");
226 feat_it != features.end(); ++feat_it)
228 LOG_DEBUG <<
"Feature " << feat_it - features.begin() + 1
229 <<
" (ID '" << feat_it->
getUniqueId() <<
"')"<< std::endl;
230 scoreFeature_(*feat_it);
231 setProgress(feat_it - features.begin());
241 #endif // OPENMS_ANALYSIS_OPENSWATH_CONFIDENCESCORING double min_rt
Definition: ConfidenceScoring.h:97
A more convenient string class.
Definition: String.h:57
void initializeGlm(double intercept, double rt_coef, double int_coef)
Definition: ConfidenceScoring.h:159
virtual ~ConfidenceScoring()
Definition: ConfidenceScoring.h:71
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:66
A container for features.
Definition: FeatureMap.h:94
void scoreMap(FeatureMap &features)
Score a feature map -> make sure the class is properly initialized.
Definition: ConfidenceScoring.h:178
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:59
Map< String, IntList > transition_map_
Definition: ConfidenceScoring.h:112
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
#define LOG_DEBUG
Macro for general debugging information.
Definition: LogStream.h:459
#define LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged...
Definition: LogStream.h:451
TargetedExperiment library_
Definition: ConfidenceScoring.h:106
TransformationDescription rt_trafo_
RT transformation to map measured RTs to assay RTs.
Definition: ConfidenceScoring.h:117
boost::mt19937 generator_
Definition: ConfidenceScoring.h:119
double int_coef
Definition: ConfidenceScoring.h:84
A method or algorithm argument contains illegal values.
Definition: Exception.h:649
boost::bimap< double, boost::bimaps::multiset_of< double > > BimapType
Mapping: Q3 m/z <-> transition intensity (maybe not unique!)
Definition: ConfidenceScoring.h:77
ConfidenceScoring(bool test_mode_=false)
Constructor.
Definition: ConfidenceScoring.h:65
const std::vector< ReactionMonitoringTransition > & getTransitions() const
returns the transition list
Base::iterator Iterator
Definition: FeatureMap.h:138
double max_rt
Definition: ConfidenceScoring.h:98
IntList decoy_index_
Definition: ConfidenceScoring.h:108
An LC-MS feature.
Definition: Feature.h:70
void initialize(TargetedExperiment library, Size n_decoys, Size n_transitions, TransformationDescription rt_trafo)
Definition: ConfidenceScoring.h:151
Definition: ConfidenceScoring.h:59
double intercept
Definition: ConfidenceScoring.h:82
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
double rt_coef
Definition: ConfidenceScoring.h:83
Size n_decoys_
Definition: ConfidenceScoring.h:110
Size n_transitions_
Definition: ConfidenceScoring.h:114
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:62
const std::vector< Peptide > & getPeptides() const
UInt64 getUniqueId() const
Non-mutable access to unique id - returns the unique id.
Definition: UniqueIdInterface.h:110
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:122
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:51
Definition: TargetedExperimentHelper.h:266