OpenMS
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-2023.
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 <cmath>
39 #include <string>
40 #include <map>
41 // #include <algorithm>
42 #include <limits>
43 
44 #include <OpenMS/CONCEPT/Types.h>
50 
51 namespace OpenMS
52 {
63  class OPENMS_DLLAPI PercolatorFeatureSetHelper
64  {
65 
66  public:
75  static void concatMULTISEPeptideIds(std::vector<PeptideIdentification>& all_peptide_ids, std::vector<PeptideIdentification>& new_peptide_ids, const String& search_engine);
76 
85  static void mergeMULTISEPeptideIds(std::vector<PeptideIdentification>& all_peptide_ids, std::vector<PeptideIdentification>& new_peptide_ids, const String& search_engine);
86 
94  static void mergeMULTISEProteinIds(std::vector<ProteinIdentification>& all_protein_ids, std::vector<ProteinIdentification>& new_protein_ids);
95 
96 
104  static void addMSGFFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& feature_set);
105 
113  static void addXTANDEMFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& feature_set);
114 
122  static void addCOMETFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& feature_set);
123 
131  static void addMASCOTFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& feature_set);
132 
143  static void addMULTISEFeatures(std::vector<PeptideIdentification>& peptide_ids, StringList& search_engines_used, StringList& feature_set, bool complete_only = true, bool limits_imputation = false);
144 
153  static void addCONCATSEFeatures(std::vector<PeptideIdentification>& peptide_id_list, StringList& search_engines_used, StringList& feature_set);
154 
162  static void checkExtraFeatures(const std::vector<PeptideHit> &psms, StringList& extra_features);
163 
170  static void addMSFRAGGERFeatures(StringList& extra_features);
171 
172 
173  protected:
175  static double rescaleFragmentFeature_(double featureValue, int NumMatchedMainIons);
176 
178  static void assignDeltaScore_(std::vector<PeptideHit>& hits, const String& score_ref, const String& output_ref);
179 
181  static String getScanMergeKey_(std::vector<PeptideIdentification>::iterator it, std::vector<PeptideIdentification>::iterator start);
182 
185  {
186  inline bool operator() (const ProteinHit& h1, const ProteinHit& h2)
187  {
188  return (h1.getAccession() < h2.getAccession());
189  }
190  };
191 
194  {
195  inline bool operator() (const PeptideEvidence& h1, const PeptideEvidence& h2)
196  {
197  return (h1.getProteinAccession() < h2.getProteinAccession());
198  }
199  };
200 
201  };
202 
203 } //namespace OpenMS
204 
205 
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:64
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 addXTANDEMFeatures(std::vector< PeptideIdentification > &peptide_ids, StringList &feature_set)
addXTANDEMFeatures
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, const 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 void mergeMULTISEPeptideIds(std::vector< PeptideIdentification > &all_peptide_ids, std::vector< PeptideIdentification > &new_peptide_ids, const String &search_engine)
mergeMULTISEPeptideIds
static double rescaleFragmentFeature_(double featureValue, int NumMatchedMainIons)
Rescales the fragment features to penalize features calculated by few ions, adapted from MSGFtoPercol...
static void assignDeltaScore_(std::vector< PeptideHit > &hits, const String &score_ref, const String &output_ref)
helper function for assigning the frequently occurring feature delta score
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:60
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
For accession dependent sorting of PeptideEvidences.
Definition: PercolatorFeatureSetHelper.h:194
For accession dependent sorting of ProteinHits.
Definition: PercolatorFeatureSetHelper.h:185