OpenMS
Loading...
Searching...
No Matches
FLASHDeconvAlgorithm.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Kyowon Jeong, Jihyung Kim $
6// $Authors: Kyowon Jeong, Jihyung Kim $
7// --------------------------------------------------------------------------
8
9#pragma once
10
19#include <iostream>
20
21namespace OpenMS
22{
33 class OPENMS_DLLAPI FLASHDeconvAlgorithm : public DefaultParamHandler, public ProgressLogger
34 {
35 public:
38
41
43 FLASHDeconvAlgorithm(FLASHDeconvAlgorithm&& other) noexcept = default;
44
47
50
52 ~FLASHDeconvAlgorithm() override = default;
53
54 std::vector<double> getTolerances() const;
55
62 void run(MSExperiment& map, std::vector<DeconvolvedSpectrum>& deconvolved_spectra, std::vector<FLASHHelperClasses::MassFeature>& deconvolved_feature);
63
66
69
71 double getNoiseDecoyWeight() const
72 {
73 return noise_decoy_weight_;
74 }
76 static int getScanNumber(const MSExperiment& map, Size index);
77
78 protected:
79 void updateMembers_() override;
80
81 private:
83 SpectralDeconvolution sd_, sd_noise_decoy_, sd_signal_decoy_;
84
86 int merge_spec_ = 0;
87
89 int forced_ms_level_ = 0;
90
92 UInt max_ms_level_ = 4;
93
95 UInt current_max_ms_level_ = 0;
96
98 UInt current_min_ms_level_ = 0;
99
101 int precursor_MS1_window_ = 0;
102
104 std::string ida_log_file_;
105
108
110 bool use_RNA_averagine_ = false;
111
113 bool report_decoy_ = false;
114
116 double isolation_window_size_{3.0};
117
119 double noise_decoy_weight_ = 1;
121 std::map<int, std::vector<std::vector<float>>> precursor_map_for_ida_;
123 std::map<std::string, PeakGroup> native_id_precursor_peak_group_map_;
124
127
129 void mergeSpectra_(MSExperiment& map, uint ms_level);
130
132 void runSpectralDeconvolution_(MSExperiment& map, std::vector<DeconvolvedSpectrum>& deconvolved_spectra);
133
135 int findPrecursorScanNumber_(const MSExperiment& map, Size index, uint ms_level) const;
136
138 void appendDecoyPeakGroups_(DeconvolvedSpectrum& deconvolved_spectrum, const MSSpectrum& spec, int scan_number, const PeakGroup& precursor_pg);
139
141 void runFeatureFinding_(std::vector<DeconvolvedSpectrum>& deconvolved_spectra, std::vector<FLASHHelperClasses::MassFeature>& deconvolved_features);
142
144 static void updatePrecursorQScores_(std::vector<DeconvolvedSpectrum>& deconvolved_spectra, int ms_level);
145
147 void findPrecursorPeakGroupsFormIdaLog_(const MSExperiment& map, Size index, double start_mz, double end_mz);
148
150 void findPrecursorPeakGroupsForMSnSpectra_(const MSExperiment& map, const std::vector<DeconvolvedSpectrum>& deconvolved_spectra, uint ms_level);
151
153 std::pair<int, int> findScanNumberBounds_(const MSExperiment& map, Size index, uint ms_level) const;
154
156 std::vector<DeconvolvedSpectrum> collectSurveyScans_(const std::vector<DeconvolvedSpectrum>& deconvolved_spectra, int b_scan_number, int a_scan_number, uint ms_level) const;
157
159 std::pair<double, double> getIsolationWindowMzRange_(const MSSpectrum& spec) const;
160
162 PeakGroup findBestPrecursorPeakGroup_(const std::vector<DeconvolvedSpectrum>& survey_scans, double start_mz, double end_mz) const;
163
165 void determineTolerance_(const MSExperiment& map, const Param& sd_param, const FLASHHelperClasses::PrecalculatedAveragine& avg, uint ms_level);
166
168 static std::vector<int> getHistogram_(const std::vector<double>& data, double min_range, double max_range, double bin_size);
169
171 static void filterLowPeaks_(MSExperiment& map);
172 };
173} // namespace OpenMS
A class representing a deconvolved spectrum. DeconvolvedSpectrum consists of PeakGroup instances repr...
Definition DeconvolvedSpectrum.h:30
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
FLASHDeconv algorithm: ultrafast mass deconvolution algorithm for top down mass spectrometry dataset ...
Definition FLASHDeconvAlgorithm.h:34
FLASHDeconvAlgorithm & operator=(FLASHDeconvAlgorithm &&fd)=default
move assignment operator
FLASHDeconvAlgorithm()
default constructor
double getNoiseDecoyWeight() const
get noise decoy weight
Definition FLASHDeconvAlgorithm.h:71
int findPrecursorScanNumber_(const MSExperiment &map, Size index, uint ms_level) const
find precursor scan number when peak group is not found
void updateMSLevels_(MSExperiment &map)
read dataset to update ms level information
std::vector< DeconvolvedSpectrum > collectSurveyScans_(const std::vector< DeconvolvedSpectrum > &deconvolved_spectra, int b_scan_number, int a_scan_number, uint ms_level) const
collect survey scans within the given scan number bounds
DoubleList min_cos_
Definition FLASHDeconvAlgorithm.h:107
PeakGroup findBestPrecursorPeakGroup_(const std::vector< DeconvolvedSpectrum > &survey_scans, double start_mz, double end_mz) const
find the best precursor peak group from survey scans within the isolation window
static void filterLowPeaks_(MSExperiment &map)
filter low intensity peaks
void findPrecursorPeakGroupsFormIdaLog_(const MSExperiment &map, Size index, double start_mz, double end_mz)
find precursor peak groups from FLASHIda log file
static std::vector< int > getHistogram_(const std::vector< double > &data, double min_range, double max_range, double bin_size)
get histogram
void determineTolerance_(const MSExperiment &map, const Param &sd_param, const FLASHHelperClasses::PrecalculatedAveragine &avg, uint ms_level)
determine tolerance
void mergeSpectra_(MSExperiment &map, uint ms_level)
merge spectra
void runFeatureFinding_(std::vector< DeconvolvedSpectrum > &deconvolved_spectra, std::vector< FLASHHelperClasses::MassFeature > &deconvolved_features)
run feature finding to get deconvolved features
void runSpectralDeconvolution_(MSExperiment &map, std::vector< DeconvolvedSpectrum > &deconvolved_spectra)
run spectral deconvolution
static void updatePrecursorQScores_(std::vector< DeconvolvedSpectrum > &deconvolved_spectra, int ms_level)
with found deconvolved features, update QScores for masses that are contained in features.
const FLASHHelperClasses::PrecalculatedAveragine & getDecoyAveragine()
get calculated decoy averagine. Call after calculateAveragine is called.
FLASHDeconvAlgorithm(const FLASHDeconvAlgorithm &)=default
copy constructor
std::map< std::string, PeakGroup > native_id_precursor_peak_group_map_
a map from native ID to precursor peak group
Definition FLASHDeconvAlgorithm.h:123
const FLASHHelperClasses::PrecalculatedAveragine & getAveragine()
get calculated averagine. Call after calculateAveragine is called.
std::pair< int, int > findScanNumberBounds_(const MSExperiment &map, Size index, uint ms_level) const
find scan number bounds for precursor search
std::vector< double > getTolerances() const
SpectralDeconvolution sd_
SpectralDeconvolution instances for spectral deconvolution for target and decoys.
Definition FLASHDeconvAlgorithm.h:83
static int getScanNumber(const MSExperiment &map, Size index)
get scan number of the spectrum in index -th in map
std::string ida_log_file_
FLASHIda log file name.
Definition FLASHDeconvAlgorithm.h:104
void findPrecursorPeakGroupsForMSnSpectra_(const MSExperiment &map, const std::vector< DeconvolvedSpectrum > &deconvolved_spectra, uint ms_level)
register the precursor peak group (or mass) if possible for MSn (n>1) spectrum.
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
~FLASHDeconvAlgorithm() override=default
destructor
FLASHDeconvAlgorithm & operator=(const FLASHDeconvAlgorithm &fd)=default
assignment operator
void run(MSExperiment &map, std::vector< DeconvolvedSpectrum > &deconvolved_spectra, std::vector< FLASHHelperClasses::MassFeature > &deconvolved_feature)
Run FLASHDeconv algorithm for map and store deconvolved_spectra and deconvolved_feature.
std::pair< double, double > getIsolationWindowMzRange_(const MSSpectrum &spec) const
get isolation window m/z range from precursors
std::map< int, std::vector< std::vector< float > > > precursor_map_for_ida_
FLASHIda parsing information is stored here: MS1 scan - information.
Definition FLASHDeconvAlgorithm.h:121
FLASHDeconvAlgorithm(FLASHDeconvAlgorithm &&other) noexcept=default
move constructor
void appendDecoyPeakGroups_(DeconvolvedSpectrum &deconvolved_spectrum, const MSSpectrum &spec, int scan_number, const PeakGroup &precursor_pg)
append decoy peak groups to deconvolved spectrum
Pre-binned averagine isotope-distribution cache used by FLASHDeconv for fast cosine-similarity scorin...
Definition FLASHHelperClasses.h:53
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
Management and storage of parameters / INI files.
Definition Param.h:46
Class describing a deconvolved mass. A mass contains multiple (LogMz) peaks of different charges and ...
Definition PeakGroup.h:29
Base class for all classes that want to report their progress.
Definition ProgressLogger.h:27
FLASHDeconv algorithm: ultrafast mass deconvolution algorithm for top down mass spectrometry dataset ...
Definition SpectralDeconvolution.h:36
unsigned int UInt
Unsigned integer type.
Definition Types.h:64
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< double > DoubleList
Vector of double precision real types.
Definition TypeAliases.h:31
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19