00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_ANALYSIS_OPENSWATH_MRMFEATUREFINDERSCORING_H
00036 #define OPENMS_ANALYSIS_OPENSWATH_MRMFEATUREFINDERSCORING_H
00037
00038 #define run_identifier "unique_run_identifier"
00039 #define USE_SP_INTERFACE
00040
00041
00042 #include <OpenMS/FORMAT/MzMLFile.h>
00043 #include <OpenMS/FORMAT/FeatureXMLFile.h>
00044 #include <OpenMS/FORMAT/TransformationXMLFile.h>
00045 #include <OpenMS/FORMAT/TraMLFile.h>
00046
00047 #include <OpenMS/KERNEL/MRMTransitionGroup.h>
00048 #include <OpenMS/KERNEL/MRMFeature.h>
00049 #include <OpenMS/KERNEL/MSSpectrum.h>
00050 #include <OpenMS/KERNEL/MSChromatogram.h>
00051
00052
00053 #include <OpenMS/FILTERING/NOISEESTIMATION/SignalToNoiseEstimatorMedian.h>
00054 #include <OpenMS/ANALYSIS/OPENSWATH/MRMTransitionGroupPicker.h>
00055
00056
00057 #include <OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/DATAACCESS/DataStructures.h>
00058 #include <OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h>
00059 #include <OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/DATAACCESS/TransitionExperiment.h>
00060 #include <OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/MRMFeatureAccessOpenMS.h>
00061
00062
00063 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/EmgScoring.h>
00064 #include <OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/ALGO/Scoring.h>
00065 #include <OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/ALGO/MRMScoring.h>
00066 #include <OpenMS/ANALYSIS/OPENSWATH/DIAScoring.h>
00067
00068
00069 #include <OpenMS/ANALYSIS/OPENSWATH/SpectrumAddition.h>
00070
00071 #ifdef _OPENMP
00072 #include <omp.h>
00073 #endif
00074
00075 bool SortDoubleDoublePairFirst(const std::pair<double, double>& left, const std::pair<double, double>& right);
00076
00077 namespace OpenMS
00078 {
00079
00084 struct OpenSwath_Scores
00085 {
00086 double elution_model_fit_score;
00087 double library_corr;
00088 double library_rmsd;
00089 double norm_rt_score;
00090 double isotope_correlation;
00091 double isotope_overlap;
00092 double massdev_score;
00093 double xcorr_coelution_score;
00094 double xcorr_shape_score;
00095 double yseries_score;
00096 double log_sn_score;
00097
00098 double get_quick_lda_score(double library_corr, double library_rmsd, double norm_rt_score, double xcorr_coelution_score,
00099 double xcorr_shape_score, double log_sn_score)
00100 {
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 double lda_quick_score =
00112 library_corr * -0.5319046 +
00113 library_rmsd * 2.1643962 +
00114 norm_rt_score * 8.0353047 +
00115 xcorr_coelution_score * 0.1458914 +
00116 xcorr_shape_score * -1.6901925 +
00117 log_sn_score * -0.8002824;
00118 return lda_quick_score;
00119 }
00120
00121 double calculate_lda_prescore(OpenSwath_Scores scores)
00122 {
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 return scores.library_corr * -0.34664267 +
00139 scores.library_rmsd * 2.98700722 +
00140 scores.norm_rt_score * 7.05496384 +
00141 scores.xcorr_coelution_score * 0.09445371 +
00142 scores.xcorr_shape_score * -5.71823862 +
00143 scores.log_sn_score * -0.72989582 +
00144 scores.elution_model_fit_score * 1.88443209;
00145 }
00146
00147 double calculate_swath_lda_prescore(OpenSwath_Scores scores)
00148 {
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 return scores.library_corr * -0.19011762 +
00173 scores.library_rmsd * 2.47298914 +
00174 scores.norm_rt_score * 5.63906731 +
00175 scores.isotope_correlation * -0.62640133 +
00176 scores.isotope_overlap * 0.36006925 +
00177 scores.massdev_score * 0.08814003 +
00178 scores.xcorr_coelution_score * 0.13978311 +
00179 scores.xcorr_shape_score * -1.16475032 +
00180 scores.yseries_score * -0.19267813 +
00181 scores.log_sn_score * -0.61712054;
00182 }
00183
00184 };
00185
00199 class OPENMS_DLLAPI MRMFeatureFinderScoring :
00200 public DefaultParamHandler,
00201 public ProgressLogger
00202 {
00203
00204 public:
00205
00207
00208
00209
00210
00211 typedef MSSpectrum<ChromatogramPeak> RichPeakChromatogram;
00212 typedef OpenSwath::LightTransition TransitionType;
00213 typedef OpenSwath::LightTargetedExperiment TargetedExpType;
00214 typedef OpenSwath::LightPeptide PeptideType;
00215 typedef OpenSwath::LightProtein ProteinType;
00216 typedef OpenSwath::LightModification ModificationType;
00217 typedef MRMTransitionGroup<MSSpectrum <ChromatogramPeak>, TransitionType> MRMTransitionGroupType;
00218 typedef std::map<String, MRMTransitionGroupType> TransitionGroupMapType;
00220
00222 MRMFeatureFinderScoring();
00223
00225 ~MRMFeatureFinderScoring();
00226
00227
00228 void pickExperiment(OpenSwath::SpectrumAccessPtr input, FeatureMap<Feature>& output, OpenSwath::LightTargetedExperiment& transition_exp,
00229 TransformationDescription trafo, OpenSwath::SpectrumAccessPtr swath_map, TransitionGroupMapType& transition_group_map)
00230 {
00231 updateMembers_();
00232
00233
00234
00235
00236
00237 PeptideRTMap_.clear();
00238 for (Size i = 0; i < transition_exp.getPeptides().size(); i++)
00239 {
00240 PeptideType pep = transition_exp.getPeptides()[i];
00241 PeptideRTMap_[pep.id] = pep.rt;
00242 PeptideRefMap_[pep.id] = &transition_exp.getPeptides()[i];
00243 }
00244
00245
00246 std::vector<ProteinHit> protein_hits;
00247 for (Size i = 0; i < transition_exp.getProteins().size(); i++)
00248 {
00249 const ProteinType& prot = transition_exp.getProteins()[i];
00250 ProteinRefMap_[transition_exp.getProteins()[i].id] = &transition_exp.getProteins()[i];
00251 ProteinHit prot_hit = ProteinHit();
00252 prot_hit.setSequence(prot.sequence);
00253 prot_hit.setAccession(prot.id);
00254 protein_hits.push_back(prot_hit);
00255 }
00256
00257 ProteinIdentification prot_id = ProteinIdentification();
00258 prot_id.setHits(protein_hits);
00259 prot_id.setIdentifier(run_identifier);
00260 output.getProteinIdentifications().push_back(prot_id);
00261
00262
00263
00264
00265
00266 mapExperimentToTransitionList(input, transition_exp, transition_group_map, trafo, rt_extraction_window_);
00267 int counter = 0;
00268 for (TransitionGroupMapType::iterator trgroup_it = transition_group_map.begin(); trgroup_it != transition_group_map.end(); trgroup_it++)
00269 {
00270 if (trgroup_it->second.getChromatograms().size() > 0) {counter++; }
00271 }
00272 std::cout << "Will analyse " << counter << " peptides with a total of " << transition_exp.getTransitions().size() << " transitions " << std::endl;
00273
00274
00275
00276
00277
00278 Size progress = 0;
00279 startProgress(0, transition_group_map.size(), "picking peaks");
00280 for (TransitionGroupMapType::iterator trgroup_it = transition_group_map.begin(); trgroup_it != transition_group_map.end(); trgroup_it++)
00281 {
00282
00283 setProgress(++progress);
00284 MRMTransitionGroupType& transition_group = trgroup_it->second;
00285 if (transition_group.getChromatograms().size() == 0 || transition_group.getTransitions().size() == 0)
00286 {
00287 continue;
00288 }
00289
00290 MRMTransitionGroupPicker trgroup_picker;
00291 trgroup_picker.setParameters(param_.copy("TransitionGroupPicker:", true));
00292 trgroup_picker.pickTransitionGroup(transition_group);
00293 scorePeakgroups_(trgroup_it->second, trafo, swath_map, output);
00294
00295 }
00296 endProgress();
00297
00298
00299 return;
00300 }
00301
00302
00303
00304
00305 void mapExperimentToTransitionList(OpenSwath::SpectrumAccessPtr input, OpenSwath::LightTargetedExperiment& transition_exp,
00306 TransitionGroupMapType& transition_group_map, TransformationDescription trafo, double rt_extraction_window);
00307
00308 void setStrictFlag(bool f)
00309 {
00310 strict_ = f;
00311 }
00312
00313 private:
00314
00316 template <typename SpectrumT, typename TransitionT>
00317 void scorePeakgroups_(MRMTransitionGroup<SpectrumT, TransitionT> & transition_group, TransformationDescription & trafo,
00318 OpenSwath::SpectrumAccessPtr swath_map, FeatureMap<Feature>& output)
00319 {
00320
00321 typedef typename MRMTransitionGroup<SpectrumT, TransitionT>::PeakType PeakT;
00322 std::vector<OpenSwath::ISignalToNoisePtr> signal_noise_estimators;
00323 std::vector<MRMFeature> feature_list;
00324
00325
00326 DoubleReal sn_win_len_ = (DoubleReal)param_.getValue("TransitionGroupPicker:sn_win_len");
00327 DoubleReal sn_bin_count_ = (DoubleReal)param_.getValue("TransitionGroupPicker:sn_bin_count");
00328 for (Size k = 0; k < transition_group.getChromatograms().size(); k++)
00329 {
00330 OpenSwath::ISignalToNoisePtr snptr(new OpenMS::SignalToNoiseOpenMS< PeakT >(transition_group.getChromatograms()[k], sn_win_len_, sn_bin_count_));
00331 signal_noise_estimators.push_back(snptr);
00332 }
00333
00334
00335 double expected_rt = PeptideRTMap_[transition_group.getTransitionGroupID()];
00336 TransformationDescription newtr = trafo;
00337 newtr.invert();
00338 expected_rt = newtr.apply(expected_rt);
00339
00340
00341 for (std::vector<MRMFeature>::iterator mrmfeature = transition_group.getFeaturesMuteable().begin();
00342 mrmfeature != transition_group.getFeaturesMuteable().end(); mrmfeature++)
00343 {
00344
00345 OpenSwath::IMRMFeature* imrmfeature;
00346 imrmfeature = new MRMFeatureOpenMS(*mrmfeature);
00347
00348 OpenSwath::ITransitionGroup* itransition_group;
00349 itransition_group = new TransitionGroupOpenMS<SpectrumT, TransitionT>(transition_group);
00350
00351 #ifdef DEBUG_MRMPEAKPICKER
00352 std::cout << "000000000000000000000000000000000000000000000000000000000000000000000000000 " << std::endl;
00353 std::cout << "scoring feature " << (*mrmfeature) << " == " << mrmfeature->getMetaValue("PeptideRef") <<
00354 "[ expected RT " << PeptideRTMap_[mrmfeature->getMetaValue("PeptideRef")] << " / " << expected_rt << " ]" <<
00355 " with " << transition_group.size() << " nr transitions and nr chromats " << transition_group.getChromatograms().size() << std::endl;
00356 #endif
00357
00358 int group_size = boost::numeric_cast<int>(transition_group.size());
00359 if (group_size == 0)
00360 {
00361 throw Exception::IllegalArgument(__FILE__, __LINE__, __PRETTY_FUNCTION__,
00362 "Error: Transition group " + transition_group.getTransitionGroupID() + " has no chromatograms.");
00363 }
00364 if (group_size < 2)
00365 {
00366 std::cerr << "Error: transition group " << transition_group.getTransitionGroupID() << " has less than 2 chromatograms. It has " << group_size << std::endl;
00367 continue;
00368
00369 }
00370
00371
00372 std::vector<double> normalized_library_intensity;
00373 transition_group.getLibraryIntensity(normalized_library_intensity);
00374 OpenSwath::Scoring::normalize_sum(&normalized_library_intensity[0], boost::numeric_cast<int>(normalized_library_intensity.size()));
00375
00376
00377
00378 bool normalize = true;
00379 mrmscore_.initializeXCorrMatrix(imrmfeature, itransition_group, normalize);
00380
00381
00382 double xcorr_coelution_score = 0;
00383 if (use_coelution_score_)
00384 {
00385 xcorr_coelution_score = mrmscore_.calcXcorrCoelutionScore();
00386 mrmfeature->addScore("var_xcorr_coelution", xcorr_coelution_score);
00387 }
00388
00389 double weighted_coelution_score = 0;
00390 if (use_coelution_score_)
00391 {
00392 weighted_coelution_score = mrmscore_.calcXcorrCoelutionScore_weighted(normalized_library_intensity);
00393 mrmfeature->addScore("var_xcorr_coelution_weighted ", weighted_coelution_score);
00394 }
00395
00396
00397
00398
00399
00400 double xcorr_shape_score = 0;
00401 if (use_shape_score_)
00402 {
00403 xcorr_shape_score = mrmscore_.calcXcorrShape_score();
00404 mrmfeature->addScore("var_xcorr_shape", xcorr_shape_score);
00405 }
00406
00407 double weighted_xcorr_shape = 0;
00408 if (use_shape_score_)
00409 {
00410 weighted_xcorr_shape = mrmscore_.calcXcorrShape_score_weighted(normalized_library_intensity);
00411 mrmfeature->addScore("var_xcorr_shape_weighted", weighted_xcorr_shape);
00412 }
00413
00414
00415
00416 double library_corr = 0, library_rmsd = 0;
00417 double library_manhattan, library_dotprod;
00418 if (use_library_score_)
00419 {
00420 mrmscore_.calcLibraryScore(imrmfeature, transition_group.getTransitions(), library_corr, library_rmsd, library_manhattan, library_dotprod);
00421 mrmfeature->addScore("var_library_corr", library_corr);
00422 mrmfeature->addScore("var_library_rmsd", library_rmsd);
00423 mrmfeature->addScore("var_library_manhattan", library_manhattan);
00424 mrmfeature->addScore("var_library_dotprod", library_dotprod);
00425 }
00426
00427
00428 double rt_score = 0, norm_rt_score = 0;
00429 if (use_rt_score_)
00430 {
00431
00432 String native_id = transition_group.getChromatograms()[0].getNativeID();
00433 TransitionType tr = transition_group.getTransition(native_id);
00434 const PeptideType* pep = PeptideRefMap_[tr.getPeptideRef()];
00435 double experimental_rt = mrmfeature->getFeature(native_id).getRT();
00436 double normalized_experimental_rt = trafo.apply(experimental_rt);
00437
00438 rt_score = mrmscore_.calcRTScore(*pep, normalized_experimental_rt);
00439 norm_rt_score = rt_score / rt_normalization_factor_;
00440 mrmfeature->addScore("delta_rt", mrmfeature->getRT() - expected_rt);
00441 mrmfeature->addScore("assay_rt", expected_rt);
00442 mrmfeature->addScore("norm_RT", normalized_experimental_rt);
00443 mrmfeature->addScore("rt_score", rt_score);
00444 mrmfeature->addScore("var_norm_rt_score", norm_rt_score);
00445 }
00446
00447
00448 double intensity_score = 0;
00449 if (use_intensity_score_)
00450 {
00451 intensity_score = mrmfeature->getIntensity() / (double)mrmfeature->getMetaValue("total_xic");
00452 mrmfeature->addScore("var_intensity_score", intensity_score);
00453 }
00454
00455 double total_xic_score = 0;
00456 if (use_total_xic_score_)
00457 {
00458 total_xic_score = (double)mrmfeature->getMetaValue("total_xic");
00459 mrmfeature->addScore("total_xic", total_xic_score);
00460 }
00461
00462 double nr_peaks_score = 0;
00463 if (use_nr_peaks_score_)
00464 {
00465 nr_peaks_score = group_size;
00466 mrmfeature->addScore("nr_peaks", nr_peaks_score);
00467 }
00468
00469 double sn_score = 0, log_sn_score = 0;
00470 if (use_sn_score_)
00471 {
00472 sn_score = mrmscore_.calcSNScore(imrmfeature, signal_noise_estimators);
00473 if (sn_score < 1)
00474 {
00475 log_sn_score = 0;
00476 }
00477 else
00478 {
00479 log_sn_score = std::log(sn_score);
00480 }
00481 mrmfeature->addScore("sn_ratio", sn_score);
00482 mrmfeature->addScore("var_log_sn_score", log_sn_score);
00483 }
00484
00485 OpenSwath_Scores scores;
00486 double quick_lda_dismiss = 0;
00487 double lda_quick_score = -scores.get_quick_lda_score(library_corr, library_rmsd, norm_rt_score, xcorr_coelution_score, xcorr_shape_score, log_sn_score);
00488
00489 if (lda_quick_score < quick_lda_dismiss)
00490 {
00491
00492 }
00493
00494 double elution_model_fit_score = 0;
00495 if (use_elution_model_score_)
00496 {
00497 elution_model_fit_score = emgscoring_.calcElutionFitScore((*mrmfeature), transition_group);
00498 mrmfeature->addScore("var_elution_model_fit_score", elution_model_fit_score);
00499 }
00500
00501 double xx_lda_prescore;
00502 scores.library_corr = library_corr;
00503 scores.library_rmsd = library_rmsd;
00504 scores.norm_rt_score = norm_rt_score;
00505 scores.elution_model_fit_score = elution_model_fit_score;
00506 scores.log_sn_score = log_sn_score;
00507 scores.xcorr_coelution_score = xcorr_coelution_score;
00508 scores.xcorr_shape_score = xcorr_shape_score;
00509 xx_lda_prescore = -scores.calculate_lda_prescore(scores);
00510
00511 bool swath_present = (swath_map->getNrSpectra() > 0);
00512 if (!swath_present)
00513 {
00514 mrmfeature->addScore("main_var_xx_lda_prelim_score", xx_lda_prescore);
00515 mrmfeature->setOverallQuality(xx_lda_prescore);
00516 }
00517 else
00518 {
00519 mrmfeature->addScore("xx_lda_prelim_score", xx_lda_prescore);
00520 }
00521
00522 if (swath_present)
00523 {
00524 calculateSwathScores_(transition_group, *mrmfeature, swath_map, normalized_library_intensity, scores);
00525 }
00526
00527 #if 0
00528 if (do_local_fdr_)
00529 {
00530 calculate_local_fdr_scores(transition_group, *mrmfeature, trafo);
00531 }
00532 #endif
00533
00535
00537
00538 const PeptideType* pep = PeptideRefMap_[transition_group.getTransitions()[0].getPeptideRef()];
00539 const ProteinType* prot = ProteinRefMap_[pep->protein_ref];
00540
00541 PeptideIdentification pep_id_ = PeptideIdentification();
00542 PeptideHit pep_hit_ = PeptideHit();
00543
00544 if (pep->getChargeState() != -1)
00545 {
00546 pep_hit_.setCharge(pep->getChargeState());
00547 }
00548 pep_hit_.setScore(xx_lda_prescore);
00549 if (swath_present)
00550 {
00551 pep_hit_.setScore(mrmfeature->getScore("xx_swath_prelim_score"));
00552 }
00553 pep_hit_.setSequence((String)pep->sequence);
00554 pep_hit_.addProteinAccession(prot->id);
00555 pep_id_.insertHit(pep_hit_);
00556 pep_id_.setIdentifier(run_identifier);
00557
00558 mrmfeature->getPeptideIdentifications().push_back(pep_id_);
00559 mrmfeature->ensureUniqueId();
00560 mrmfeature->setMetaValue("PrecursorMZ", transition_group.getTransitions()[0].getPrecursorMZ());
00561 mrmfeature->setSubordinates(mrmfeature->getFeatures());
00562 double total_intensity = 0, total_peak_apices = 0;
00563 for (std::vector<Feature>::iterator sub_it = mrmfeature->getSubordinates().begin(); sub_it != mrmfeature->getSubordinates().end(); sub_it++)
00564 {
00565 if (!write_convex_hull_) {sub_it->getConvexHulls().clear(); }
00566 sub_it->ensureUniqueId();
00567 if (sub_it->getMZ() > quantification_cutoff_)
00568 {
00569 total_intensity += sub_it->getIntensity();
00570 total_peak_apices += (DoubleReal)sub_it->getMetaValue("peak_apex_int");
00571 }
00572 }
00573
00574 mrmfeature->setIntensity(total_intensity);
00575 mrmfeature->setMetaValue("peak_apices_sum", total_peak_apices);
00576 feature_list.push_back((*mrmfeature));
00577
00578 delete imrmfeature;
00579 delete itransition_group;
00580 }
00581
00582
00583 std::sort(feature_list.begin(), feature_list.end(), OpenMS::Feature::OverallQualityLess());
00584 std::reverse(feature_list.begin(), feature_list.end());
00585
00586 for (Size i = 0; i < feature_list.size(); i++)
00587 {
00588 if (stop_report_after_feature_ >= 0 && i >= (Size)stop_report_after_feature_) {break; }
00589 output.push_back(feature_list[i]);
00590 }
00591 }
00592
00594 OpenSwath::SpectrumPtr getAddedSpectra_(OpenSwath::SpectrumAccessPtr swath_map, double RT, int nr_spectra_to_add)
00595 {
00596 std::vector<std::size_t> indices = swath_map->getSpectraByRT(RT, 0.0);
00597 int closest_idx = boost::numeric_cast<int>(indices[0]);
00598 if (indices[0] != 0 &&
00599 std::fabs(swath_map->getSpectrumMetaById(boost::numeric_cast<int>(indices[0]) - 1).RT - RT) <
00600 std::fabs(swath_map->getSpectrumMetaById(boost::numeric_cast<int>(indices[0])).RT - RT))
00601 {
00602 closest_idx--;
00603 }
00604
00605 if (nr_spectra_to_add == 1)
00606 {
00607 OpenSwath::SpectrumPtr spectrum_ = swath_map->getSpectrumById(closest_idx);
00608 return spectrum_;
00609 }
00610 else
00611 {
00612 std::vector<OpenSwath::SpectrumPtr> all_spectra;
00613
00614 all_spectra.push_back(swath_map->getSpectrumById(closest_idx));
00615 for (int i = 1; i <= nr_spectra_to_add / 2; i++)
00616 {
00617 all_spectra.push_back(swath_map->getSpectrumById(closest_idx - i));
00618 all_spectra.push_back(swath_map->getSpectrumById(closest_idx + i));
00619 }
00620 OpenSwath::SpectrumPtr spectrum_ = SpectrumAddition::addUpSpectra(all_spectra, spacing_for_spectra_resampling_, true);
00621 return spectrum_;
00622 }
00623 }
00624
00625 template <typename SpectrumT, typename TransitionT>
00626 void calculateSwathScores_(MRMTransitionGroup<SpectrumT, TransitionT> & transition_group, MRMFeature & mrmfeature_,
00627 OpenSwath::SpectrumAccessPtr swath_map, std::vector<double>& normalized_library_intensity, OpenSwath_Scores scores)
00628 {
00629 MRMFeature* mrmfeature = &mrmfeature_;
00630
00631
00632 int by_charge_state = 1;
00633
00634
00635 OpenSwath::SpectrumPtr spectrum_ = getAddedSpectra_(swath_map, mrmfeature->getRT(), add_up_spectra_);
00636 OpenSwath::SpectrumPtr* spectrum = &spectrum_;
00637
00638
00639
00640
00641 OpenSwath::IMRMFeature* imrmfeature = new MRMFeatureOpenMS(*mrmfeature);
00642 double isotope_corr = 0, isotope_overlap = 0;
00643 diascoring_.dia_isotope_scores(transition_group.getTransitions(),
00644 (*spectrum), imrmfeature, isotope_corr, isotope_overlap);
00645
00646 double ppm_score = 0, ppm_score_weighted = 0;
00647 diascoring_.dia_massdiff_score(transition_group.getTransitions(),
00648 (*spectrum), normalized_library_intensity, ppm_score, ppm_score_weighted);
00649
00650
00651 double bseries_score = 0, yseries_score = 0;
00652 OpenMS::AASequence aas;
00653 OpenSwathDataAccessHelper::convertPeptideToAASequence(*PeptideRefMap_[transition_group.getTransitions()[0].getPeptideRef()], aas);
00654 diascoring_.dia_by_ion_score((*spectrum), aas, by_charge_state, bseries_score, yseries_score);
00655 mrmfeature->addScore("var_isotope_correlation_score", isotope_corr);
00656 mrmfeature->addScore("var_isotope_overlap_score", isotope_overlap);
00657 #ifdef DEBUG_MRMPEAKPICKER
00658 cout << "added corr isotope_score " << isotope_corr << endl;
00659 cout << "added overlap isotope_score " << isotope_overlap << endl;
00660 #endif
00661
00662
00663 double massdev_score = ppm_score / transition_group.size();
00664 double massdev_score_weighted = ppm_score_weighted;
00665 mrmfeature->addScore("var_massdev_score", massdev_score);
00666 mrmfeature->addScore("var_massdev_score_weighted", massdev_score_weighted);
00667 #ifdef DEBUG_MRMPEAKPICKER
00668 cout << "added score massdev_score " << massdev_score << endl;
00669 cout << "added score weighted massdev_score " << massdev_score_weighted << endl;
00670 #endif
00671
00672 mrmfeature->addScore("var_bseries_score", bseries_score);
00673 mrmfeature->addScore("var_yseries_score", yseries_score);
00674 #ifdef DEBUG_MRMPEAKPICKER
00675 cout << "added score bseries_score " << bseries_score << endl;
00676 cout << "added score yseries_score " << yseries_score << endl;
00677 #endif
00678
00679 double dotprod_score_dia;
00680 double manhatt_score_dia;
00681
00682 diascoring_.score_with_isotopes((*spectrum), transition_group.getTransitions(), dotprod_score_dia, manhatt_score_dia);
00683
00684 mrmfeature->addScore("var_dotprod_score", dotprod_score_dia);
00685 mrmfeature->addScore("var_manhatt_score", manhatt_score_dia);
00686
00687 scores.yseries_score = yseries_score;
00688 scores.isotope_correlation = isotope_corr;
00689 scores.isotope_overlap = isotope_overlap;
00690 scores.massdev_score = massdev_score;
00691 double xx_swath_prescore = -scores.calculate_swath_lda_prescore(scores);
00692 mrmfeature->addScore("main_var_xx_swath_prelim_score", xx_swath_prescore);
00693 mrmfeature->setOverallQuality(xx_swath_prescore);
00694 #ifdef DEBUG_MRMPEAKPICKER
00695 cout << "added xx_swath_prescore (everything above 2 is good) " << xx_swath_prescore << endl;
00696 #endif
00697 delete imrmfeature;
00698 }
00699
00700
00701
00703 void updateMembers_();
00704
00705
00706 DoubleReal rt_extraction_window_;
00707 DoubleReal quantification_cutoff_;
00708
00709
00710 bool use_coelution_score_;
00711 bool use_shape_score_;
00712 bool use_rt_score_;
00713 bool use_library_score_;
00714 bool use_elution_model_score_;
00715 bool use_intensity_score_;
00716 bool use_total_xic_score_;
00717 bool use_nr_peaks_score_;
00718 bool use_sn_score_;
00719
00720 int stop_report_after_feature_;
00721 int add_up_spectra_;
00722 DoubleReal spacing_for_spectra_resampling_;
00723
00724
00725 bool write_convex_hull_;
00726 bool strict_;
00727
00728 DoubleReal rt_normalization_factor_;
00729
00730 std::map<OpenMS::String, double> PeptideRTMap_;
00731 std::map<OpenMS::String, const PeptideType*> PeptideRefMap_;
00732 std::map<OpenMS::String, const ProteinType*> ProteinRefMap_;
00733
00734 OpenSwath::MRMScoring mrmscore_;
00735 OpenMS::DIAScoring diascoring_;
00736 OpenMS::EmgScoring emgscoring_;
00737 };
00738 }
00739
00740 #undef run_identifier
00741 #endif