OpenMS  2.5.0
PercolatorFeatureSetHelper.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: Mathias Walzer $
32 // $Authors: Mathias Walzer, Matthew The $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <vector>
38 #include <iostream>
39 #include <cmath>
40 #include <string>
41 #include <map>
42 #include <algorithm>
43 #include <limits>
44 
45 #include <OpenMS/CONCEPT/Types.h>
52 
53 #include <boost/lexical_cast.hpp>
54 
55 namespace OpenMS
56 {
67  class OPENMS_DLLAPI PercolatorFeatureSetHelper
68  {
69 
70  public:
79  static void concatMULTISEPeptideIds(std::vector<PeptideIdentification>& all_peptide_ids, std::vector<PeptideIdentification>& new_peptide_ids, String search_engine);
80 
89  static void mergeMULTISEPeptideIds(std::vector<PeptideIdentification>& all_peptide_ids, std::vector<PeptideIdentification>& new_peptide_ids, String search_engine);
90 
98  static void mergeMULTISEProteinIds(std::vector<ProteinIdentification>& all_protein_ids, std::vector<ProteinIdentification>& new_protein_ids);
99 
100 
108  static void addMSGFFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& feature_set);
109 
117  static void addXTANDEMFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& feature_set);
118 
126  static void addCOMETFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& feature_set);
127 
135  static void addMASCOTFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& feature_set);
136 
147  static void addMULTISEFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& search_engines_used, StringList& feature_set, bool complete_only = true, bool limits_imputation = false);
148 
157  static void addCONCATSEFeatures(std::vector<PeptideIdentification>& peptide_id_list, StringList& search_engines_used, StringList& feature_set);
158 
166  static void checkExtraFeatures(const std::vector<PeptideHit> &psms, StringList& extra_features);
167 
168 
169  protected:
171  static double rescaleFragmentFeature_(double featureValue, int NumMatchedMainIons);
172 
174  static void assignDeltaScore_(std::vector<PeptideHit>& hits, String score_ref, String output_ref);
175 
177  static String getScanMergeKey_(std::vector<PeptideIdentification>::iterator it, std::vector<PeptideIdentification>::iterator start);
178 
181  {
182  inline bool operator() (const ProteinHit& h1, const ProteinHit& h2)
183  {
184  return (h1.getAccession() < h2.getAccession());
185  }
186  };
187 
190  {
191  inline bool operator() (const PeptideEvidence& h1, const PeptideEvidence& h2)
192  {
193  return (h1.getProteinAccession() < h2.getProteinAccession());
194  }
195  };
196 
197  };
198 
199 } //namespace OpenMS
200 
201 
LogStream.h
OpenMS::ProteinIdentification::SearchParameters::digestion_enzyme
Protease digestion_enzyme
The cleavage site information in details (from ProteaseDB)
Definition: ProteinIdentification.h:236
OpenMS::FileTypes::IDXML
OpenMS identification format (.idXML)
Definition: FileTypes.h:66
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:144
OpenMS::MzIdentMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &poid, const std::vector< PeptideIdentification > &peid) const
Stores the identifications in a MzIdentML file.
FileHandler.h
OpenMS::TextFile::addLine
void addLine(const StringType &line)
Definition: TextFile.h:112
FileTypes.h
OpenMS::ProteinIdentification::getIndistinguishableProteins
const std::vector< ProteinGroup > & getIndistinguishableProteins() const
Returns the indistinguishable proteins.
OpenMS::IdXMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &protein_ids, const std::vector< PeptideIdentification > &peptide_ids, const String &document_id="")
Stores the data in an idXML file.
OpenMS::PercolatorFeatureSetHelper::lq_PeptideEvidence
For accession dependent sorting of PeptideEvidences.
Definition: PercolatorFeatureSetHelper.h:189
Types.h
OpenMS::PercolatorFeatureSetHelper
Percolator feature set and integration helper.
Definition: PercolatorFeatureSetHelper.h:67
OpenMS::PercolatorFeatureSetHelper::mergeMULTISEProteinIds
static void mergeMULTISEProteinIds(std::vector< ProteinIdentification > &all_protein_ids, std::vector< ProteinIdentification > &new_protein_ids)
mergeMULTISEProteinIds
OpenMS::OSWFile
This class serves for reading in and writing OpenSWATH OSW files.
Definition: OSWFile.h:61
OpenMS::FileHandler::getTypeByFileName
static FileTypes::Type getTypeByFileName(const String &filename)
Determines the file type from a file name.
OpenMS::MetaInfoInterface::getMetaValue
const DataValue & getMetaValue(const String &name, const DataValue &default_value=DataValue::EMPTY) const
Returns the value corresponding to a string, or a default value (default: DataValue::EMPTY) if not fo...
OpenMS::OSWFile::write
void write(const std::string &in_osw, const std::string &osw_level, const std::map< std::string, std::vector< double > > &features)
Updates an OpenSWATH OSW SQLite files with the MS1-, MS2- or transition-level results of Percolator.
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::ProteinIdentification::ProteinGroup::accessions
std::vector< String > accessions
Accessions of (indistinguishable) proteins that belong to the same group.
Definition: ProteinIdentification.h:98
KDTree::operator!=
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
OpenMS::String::removeWhitespaces
String & removeWhitespaces()
removes whitespaces (space, tab, line feed, carriage return)
OSWFile.h
OpenMS::TextFile
This class provides some basic file handling methods for text files.
Definition: TextFile.h:46
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
IdXMLFile.h
OpenMS::ProteinHit
Representation of a protein hit.
Definition: ProteinHit.h:57
OpenMS::DataValue::toString
String toString(bool full_precision=true) const
Conversion to String full_precision Controls number of fractional digits for all double types or list...
OpenMS::Constants::c
const double c
OpenMS::Residue::Full
with N-terminus and C-terminus
Definition: Residue.h:152
OpenMS::IDFilter::updateProteinGroups
static bool updateProteinGroups(std::vector< ProteinIdentification::ProteinGroup > &groups, const std::vector< ProteinHit > &hits)
Update protein groups after protein hits were filtered.
OpenMS::String::prefix
String prefix(SizeType length) const
returns the prefix of length length
OpenMS::FileTypes::MZIDENTML
mzIdentML (HUPO PSI AnalysisXML followup format) (.mzid)
Definition: FileTypes.h:77
OpenMS::File::getUniqueName
static String getUniqueName(bool include_hostname=true)
Returns a string, consisting of date, time, hostname, process id, and a incrementing number....
OPENMS_PRECONDITION
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:136
OpenMS::FileTypes::UNKNOWN
Unknown file extension.
Definition: FileTypes.h:60
OPENMS_LOG_WARN
#define OPENMS_LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged.
Definition: LogStream.h:460
OpenMS::ProteinIdentification
Representation of a protein identification run.
Definition: ProteinIdentification.h:71
Constants.h
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::ListUtils::concatenate
static String concatenate(const std::vector< T > &container, const String &glue="")
Concatenates all elements of the container and puts the glue string between elements.
Definition: ListUtils.h:193
OpenMS::ProteinIdentification::SearchParameters::charges
String charges
The allowed charges for the search.
Definition: ProteinIdentification.h:227
OpenMS::MzIdentMLFile
File adapter for MzIdentML files.
Definition: MzIdentMLFile.h:67
OpenMS::ProteinHit::getAccession
const String & getAccession() const
returns the accession of the protein
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::ProteinIdentification::SearchParameters::variable_modifications
std::vector< String > variable_modifications
Allowed variable modifications.
Definition: ProteinIdentification.h:230
OpenMS::MetaInfoInterface::setMetaValue
void setMetaValue(const String &name, const DataValue &value)
Sets the DataValue corresponding to a name.
int
ProteinIdentification.h
OpenMS::FileTypes::Type
Type
Actual file types enum.
Definition: FileTypes.h:58
OpenMS::PeptideEvidence
Representation of a peptide evidence.
Definition: PeptideEvidence.h:50
OPENMS_LOG_DEBUG
#define OPENMS_LOG_DEBUG
Macro for general debugging information.
Definition: LogStream.h:470
OpenMS::FileHandler::getType
static FileTypes::Type getType(const String &filename)
Tries to determine the file type (by name or content)
OpenMS::String::toQString
QString toQString() const
Conversion to Qt QString.
CsvFile.h
OpenMS::ProteinIdentification::SearchParameters::fragment_mass_tolerance
double fragment_mass_tolerance
Mass tolerance of fragment ions (Dalton or ppm)
Definition: ProteinIdentification.h:232
OpenMS::OSWFile::read
void read(const std::string &in_osw, const std::string &osw_level, std::stringstream &pin_output, const double &ipf_max_peakgroup_pep, const double &ipf_max_transition_isotope_overlap, const double &ipf_min_transition_sn)
Reads an OSW SQLite file and returns the data on MS1-, MS2- or transition-level as stringstream TXT i...
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::ProteinIdentification::SearchParameters::fixed_modifications
std::vector< String > fixed_modifications
Used fixed modifications.
Definition: ProteinIdentification.h:229
OpenMS::FileTypes::OSW
OpenSWATH OpenSWATH report (OSW) SQLite DB.
Definition: FileTypes.h:106
OpenMS::MzIdentMLFile::load
void load(const String &filename, std::vector< ProteinIdentification > &poid, std::vector< PeptideIdentification > &peid)
Loads the identifications from a MzIdentML file.
OpenMS::CsvFile
This class handles csv files. Currently only loading is implemented.
Definition: CsvFile.h:49
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:73
OpenMS::ProteinIdentification::SearchParameters::precursor_mass_tolerance
double precursor_mass_tolerance
Mass tolerance of precursor ions (Dalton or ppm)
Definition: ProteinIdentification.h:234
KDTree::operator==
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
PercolatorFeatureSetHelper.h
OpenMS::MetaInfoInterface::metaValueExists
bool metaValueExists(const String &name) const
Returns whether an entry with the given name exists.
OpenMS::PercolatorFeatureSetHelper::lq_ProteinHit
For accession dependent sorting of ProteinHits.
Definition: PercolatorFeatureSetHelper.h:180
DataValue.h
OpenMS::TOPPBase::ExitCodes
ExitCodes
Exit codes.
Definition: TOPPBase.h:149
OpenMS::FileTypes::nameToType
static Type nameToType(const String &name)
Converts a file type name into a Type.
OpenMS::TextFile::store
void store(const String &filename)
Writes the data to a file.
IDFilter.h
OpenMS::PeptideEvidence::getProteinAccession
const String & getProteinAccession() const
get the protein accession the peptide matches to. If not available the empty string is returned.
OPENMS_LOG_INFO
#define OPENMS_LOG_INFO
Macro if a information, e.g. a status should be reported.
Definition: LogStream.h:465
OpenMS::Constants::C13C12_MASSDIFF_U
const double C13C12_MASSDIFF_U
OpenMS::ProteinIdentification::ProteinGroup::probability
double probability
Probability of this group.
Definition: ProteinIdentification.h:95
PeptideIdentification.h
OpenMS::ProteinIdentification::SearchParameters
Search parameters of the DB search.
Definition: ProteinIdentification.h:221
OpenMS::String::suffix
String suffix(SizeType length) const
returns the suffix of length length
StandardTypes.h
File.h
MzIdentMLFile.h
TOPPBase.h
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:63
OpenMS::ProteinIdentification::ProteinGroup
Bundles multiple (e.g. indistinguishable) proteins in a group.
Definition: ProteinIdentification.h:81
OpenMS::PeptideHit
Representation of a peptide hit.
Definition: PeptideHit.h:54