51 class PeptideIdentification;
52 class ProteinIdentification;
96 static std::map<String, std::vector<std::vector<double>>> extractAndTransformScores(
97 const std::vector<ProteinIdentification> & protein_ids,
98 const std::vector<PeptideIdentification> & peptide_ids,
99 const bool split_charge,
100 const bool top_hits_only,
101 const bool target_decoy_available,
102 const double fdr_for_targets_smaller);
117 static void updateScores(
119 const String & search_engine,
121 const bool prob_correct,
122 const bool split_charge,
123 std::vector<ProteinIdentification> & protein_ids,
124 std::vector<PeptideIdentification> & peptide_ids,
125 bool & unable_to_fit_data,
126 bool & data_might_not_be_well_fit);
136 bool fit(std::vector<double> & search_engine_scores,
const String& outlier_handling);
146 bool fitGumbelGauss(std::vector<double>& search_engine_scores,
const String& outlier_handling);
155 bool fit(std::vector<double> & search_engine_scores, std::vector<double> & probabilities,
const String& outlier_handling);
158 void fillDensities(
const std::vector<double> & x_scores, std::vector<double> & incorrect_density, std::vector<double> & correct_density);
160 void fillLogDensities(
const std::vector<double> & x_scores, std::vector<double> & incorrect_density, std::vector<double> & correct_density);
162 void fillLogDensitiesGumbel(
const std::vector<double> & x_scores, std::vector<double> & incorrect_density, std::vector<double> & correct_density);
164 double computeLogLikelihood(
const std::vector<double> & incorrect_density,
const std::vector<double> & correct_density)
const;
170 double computeLLAndIncorrectPosteriorsFromLogDensities(
171 const std::vector<double>& incorrect_log_density,
172 const std::vector<double>& correct_log_density,
173 std::vector<double>& incorrect_posterior)
const;
181 std::pair<double, double> pos_neg_mean_weighted_posteriors(
const std::vector<double> &x_scores,
182 const std::vector<double> &incorrect_posteriors);
190 std::pair<double, double> pos_neg_sigma_weighted_posteriors(
const std::vector<double> &x_scores,
191 const std::vector<double> &incorrect_posteriors,
192 const std::pair<double, double>& means);
197 return correctly_assigned_fit_param_;
203 return incorrectly_assigned_fit_param_;
209 return incorrectly_assigned_fit_gumbel_param_;
215 return negative_prior_;
221 double z = exp((params.
x0 - x) / params.
sigma);
222 return (z * exp(-1 * z)) / params.
sigma;
229 double computeProbability(
double score)
const;
232 TextFile initPlots(std::vector<double> & x_scores);
244 void plotTargetDecoyEstimation(std::vector<double> & target, std::vector<double> & decoy);
249 return smallest_score_;
253 void tryGnuplot(
const String& gp_file);
257 void processOutliers_(std::vector<double>& x_scores,
const String& outlier_handling)
const;
263 static double transformScore_(
const String& engine,
const PeptideHit& hit,
const String& current_score_type);
269 static double getScore_(
const std::vector<String>& requested_score_types,
const PeptideHit & hit,
const String& actual_score_type);