OpenMS  2.5.0
PrecursorPurity.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Eugen Netz $
32 // $Authors: Eugen Netz $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
38 #include <OpenMS/CONCEPT/Types.h>
40 #include <vector>
41 
42 
43 namespace OpenMS
44 {
59  class OPENMS_DLLAPI PrecursorPurity
60  {
61 
62  public:
63 
64  struct PurityScores
65  {
66  double total_intensity = 0.0;
67  double target_intensity = 0.0;
68  double signal_proportion = 0.0;
69  Size target_peak_count = 0;
70  Size residual_peak_count = 0;
71  };
72 
80  static std::map<String, PurityScores> computePrecursorPurities(const PeakMap& spectra, double precursor_mass_tolerance, bool precursor_mass_tolerance_unit_ppm);
81 
91  static PurityScores computePrecursorPurity(const PeakSpectrum& ms1, const Precursor& pre, const double precursor_mass_tolerance, const bool precursor_mass_tolerance_unit_ppm);
92 
93 
94  private:
95  // simple helper to combine the metrics contained in two PurityScores
96  static PurityScores combinePrecursorPurities(const PrecursorPurity::PurityScores& score1, const PrecursorPurity::PurityScores& score2);
97 
98  };
99 }
OpenMS::ProgressLogger::setProgress
void setProgress(SignedSize value) const
Sets the current progress.
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:144
OpenMS::Param::removeAll
void removeAll(const String &prefix)
Remove all entries that start with prefix.
OpenMS::Param::copy
Param copy(const String &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
FileHandler.h
OpenMS::FeatureFinderAlgorithmIsotopeWavelet
Implements the isotope wavelet feature finder.
Definition: FeatureFinderAlgorithmIsotopeWavelet.h:59
OpenMS::PrecursorIonSelection::getNextPrecursors
void getNextPrecursors(FeatureMap &features, FeatureMap &next_features, UInt number)
Returns features with highest score for MS/MS.
Types.h
OpenMS::MSExperiment::sortSpectra
void sortSpectra(bool sort_mz=true)
Sorts the data points by retention time.
OpenMS::Peak1D::setMZ
void setMZ(CoordinateType mz)
Mutable access to m/z.
Definition: Peak1D.h:121
OpenMS::Param::setValue
void setValue(const String &key, const DataValue &value, const String &description="", const StringList &tags=StringList())
Sets a value.
OpenMS::MzMLFile
File adapter for MzML files.
Definition: MzMLFile.h:55
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::MSExperiment::begin
Iterator begin()
Definition: MSExperiment.h:157
OpenMS::PrecursorIonSelection
This class implements different precursor ion selection strategies.
Definition: PrecursorIonSelection.h:52
MzMLFile.h
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::PrecursorIonSelectionPreprocessing::loadPreprocessing
void loadPreprocessing()
Loads tryptic peptide masses of a given database.
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
IdXMLFile.h
FeatureXMLFile.h
OpenMS::ProgressLogger::startProgress
void startProgress(SignedSize begin, SignedSize end, const String &label) const
Initializes the progress display.
OpenMS::PrecursorIonSelection::rescore
void rescore(FeatureMap &features, std::vector< PeptideIdentification > &new_pep_ids, std::vector< ProteinIdentification > &prot_ids, PrecursorIonSelectionPreprocessing &preprocessed_db, bool check_meta_values=true)
Change scoring of features using peptide identifications only from spectra of the last iteration.
OpenMS::ProgressLogger::endProgress
void endProgress() const
Ends the progress display.
OpenMS::MSExperiment::size
Size size() const
Definition: MSExperiment.h:127
OpenMS::IdXMLFile::load
void load(const String &filename, std::vector< ProteinIdentification > &protein_ids, std::vector< PeptideIdentification > &peptide_ids)
Loads the identifications of an idXML file without identifier.
OpenMS::Precursor
Precursor meta information.
Definition: Precursor.h:57
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::MSExperiment::Iterator
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:111
OpenMS::PrecursorIonSelectionPreprocessing::setFixedModifications
void setFixedModifications(StringList &modifications)
OpenMS::MSExperiment::addSpectrum
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
OpenMS::MzMLFile::load
void load(const String &filename, PeakMap &map)
Loads a map from a MzML file. Spectra and chromatograms are sorted by default (this can be disabled u...
FeatureFinderAlgorithmIsotopeWavelet.h
OpenMS::FileHandler
Facilitates file handling by file type recognition.
Definition: FileHandler.h:62
OpenMS::FileHandler::loadExperiment
bool loadExperiment(const String &filename, MSExperiment &exp, FileTypes::Type force_type=FileTypes::UNKNOWN, ProgressLogger::LogType log=ProgressLogger::NONE, const bool rewrite_source_file=true, const bool compute_hash=true)
Loads a file into an MSExperiment.
OpenMS::FeatureXMLFile::load
void load(const String &filename, FeatureMap &feature_map)
loads the file with name filename into map and calls updateRanges().
OpenMS::FileTypes::Type
Type
Actual file types enum.
Definition: FileTypes.h:58
OpenMS::Peak1D::getMZ
CoordinateType getMZ() const
Non-mutable access to m/z.
Definition: Peak1D.h:115
OpenMS::LPWrapper::SOLVER_GLPK
Definition: LPWrapper.h:132
OpenMS::FeatureFinder
The main feature finder class.
Definition: FeatureFinder.h:56
OpenMS::FileHandler::getType
static FileTypes::Type getType(const String &filename)
Tries to determine the file type (by name or content)
PrecursorIonSelection.h
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::DefaultParamHandler::getDefaults
const Param & getDefaults() const
Non-mutable access to the default parameters.
OpenMS::PrecursorIonSelection::setLPSolver
void setLPSolver(LPWrapper::SOLVER solver)
Definition: PrecursorIonSelection.h:182
OpenMS::DefaultParamHandler::getParameters
const Param & getParameters() const
Non-mutable access to the parameters.
OpenMS::PrecursorIonSelection::simulateRun
void simulateRun(FeatureMap &features, std::vector< PeptideIdentification > &pep_ids, std::vector< ProteinIdentification > &prot_ids, PrecursorIonSelectionPreprocessing &preprocessed_db, String path, PeakMap &experiment, String precursor_path="")
Simulate the iterative precursor ion selection.
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::FeatureXMLFile::store
void store(const String &filename, const FeatureMap &feature_map)
stores the map feature_map in file with name filename.
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:73
MSExperiment.h
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:95
OpenMS::Param::remove
void remove(const String &key)
Remove the entry key or a section key (when suffix is ':')
OpenMS::PrecursorIonSelectionPreprocessing::dbPreprocessing
void dbPreprocessing(String db_path, bool save=true)
Calculates tryptic peptide masses of a given database and stores masses and peptide sequences.
OpenMS::PrecursorPurity::PurityScores
Definition: PrecursorPurity.h:64
OpenMS::MSExperiment::end
Iterator end()
Definition: MSExperiment.h:167
OpenMS::FeatureXMLFile
This class provides Input/Output functionality for feature maps.
Definition: FeatureXMLFile.h:68
OpenMS::MSExperiment::updateRanges
void updateRanges() override
Updates minimum and maximum position/intensity.
PrecursorIonSelectionPreprocessing.h
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:73
OpenMS::Precursor::getCharge
Int getCharge() const
Non-mutable access to the charge.
OpenMS::MSExperiment::clear
void clear(bool clear_meta_data)
Clears all data and meta data.
OpenMS::ProgressLogger::NONE
No progress logging.
Definition: ProgressLogger.h:74
OpenMS::FileHandler::storeExperiment
void storeExperiment(const String &filename, const MSExperiment &exp, ProgressLogger::LogType log=ProgressLogger::NONE)
Stores an MSExperiment to a file.
OpenMS::MSExperiment::ConstIterator
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:113
OpenMS::Precursor::setCharge
void setCharge(Int charge)
Mutable access to the charge.
OpenMS::FeatureFinder::run
void run(const String &algorithm_name, PeakMap &input_map, FeatureMap &features, const Param &param, const FeatureMap &seeds)
Executes the FeatureFinder using the given algorithm.
OpenMS::MSSpectrum::ConstIterator
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:104
OpenMS::MSSpectrum
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
StandardTypes.h
OpenMS::PrecursorIonSelectionPreprocessing
This class implements the database preprocessing needing for precursor ion selection.
Definition: PrecursorIonSelectionPreprocessing.h:55
OpenMS::ProgressLogger::setLogType
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
TOPPBase.h
OpenMS::PrecursorPurity
Precursor purity or noise estimation.
Definition: PrecursorPurity.h:59
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:63