OpenMS  2.7.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-2021.
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 
174  static void addMSFRAGGERFeatures(StringList& extra_features);
175 
176 
177  protected:
179  static double rescaleFragmentFeature_(double featureValue, int NumMatchedMainIons);
180 
182  static void assignDeltaScore_(std::vector<PeptideHit>& hits, String score_ref, String output_ref);
183 
185  static String getScanMergeKey_(std::vector<PeptideIdentification>::iterator it, std::vector<PeptideIdentification>::iterator start);
186 
189  {
190  inline bool operator() (const ProteinHit& h1, const ProteinHit& h2)
191  {
192  return (h1.getAccession() < h2.getAccession());
193  }
194  };
195 
198  {
199  inline bool operator() (const PeptideEvidence& h1, const PeptideEvidence& h2)
200  {
201  return (h1.getProteinAccession() < h2.getProteinAccession());
202  }
203  };
204 
205  };
206 
207 } //namespace OpenMS
208 
209 
Representation of a peptide evidence.
Definition: PeptideEvidence.h:51
const String & getProteinAccession() const
get the protein accession the peptide matches to. If not available the empty string is returned.
Percolator feature set and integration helper.
Definition: PercolatorFeatureSetHelper.h:68
static void addMSFRAGGERFeatures(StringList &extra_features)
addMSFraggerFeatures
static void addMSGFFeatures(std::vector< PeptideIdentification > &peptide_ids, StringList &feature_set)
addMSGFFeatures
static void addCONCATSEFeatures(std::vector< PeptideIdentification > &peptide_id_list, StringList &search_engines_used, StringList &feature_set)
addCONCATSEFeatures
static void addCOMETFeatures(std::vector< PeptideIdentification > &peptide_ids, StringList &feature_set)
addCOMETFeatures
static void assignDeltaScore_(std::vector< PeptideHit > &hits, String score_ref, String output_ref)
helper function for assigning the frequently occurring feature delta score
static void addXTANDEMFeatures(std::vector< PeptideIdentification > &peptide_ids, StringList &feature_set)
addXTANDEMFeatures
static void mergeMULTISEPeptideIds(std::vector< PeptideIdentification > &all_peptide_ids, std::vector< PeptideIdentification > &new_peptide_ids, String search_engine)
mergeMULTISEPeptideIds
static String getScanMergeKey_(std::vector< PeptideIdentification >::iterator it, std::vector< PeptideIdentification >::iterator start)
gets the scan identifier to merge by
static void concatMULTISEPeptideIds(std::vector< PeptideIdentification > &all_peptide_ids, std::vector< PeptideIdentification > &new_peptide_ids, String search_engine)
concatMULTISEPeptideIds
static void addMULTISEFeatures(std::vector< PeptideIdentification > &peptide_ids, StringList &search_engines_used, StringList &feature_set, bool complete_only=true, bool limits_imputation=false)
addMULTISEFeatures
static void checkExtraFeatures(const std::vector< PeptideHit > &psms, StringList &extra_features)
checkExtraFeatures
static void mergeMULTISEProteinIds(std::vector< ProteinIdentification > &all_protein_ids, std::vector< ProteinIdentification > &new_protein_ids)
mergeMULTISEProteinIds
static void addMASCOTFeatures(std::vector< PeptideIdentification > &peptide_ids, StringList &feature_set)
addMASCOTFeatures
static double rescaleFragmentFeature_(double featureValue, int NumMatchedMainIons)
Rescales the fragment features to penalize features calculated by few ions, adapted from MSGFtoPercol...
Representation of a protein hit.
Definition: ProteinHit.h:60
const String & getAccession() const
returns the accession of the protein
A more convenient string class.
Definition: String.h:61
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
For accession dependent sorting of PeptideEvidences.
Definition: PercolatorFeatureSetHelper.h:198
For accession dependent sorting of ProteinHits.
Definition: PercolatorFeatureSetHelper.h:189