OpenMS
Loading...
Searching...
No Matches
PercolatorInfile.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: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
14
15#include <map>
16#include <set>
17#include <utility>
18#include <vector>
19
20namespace OpenMS
21{
22
27 class OPENMS_DLLAPI PercolatorInfile
28 {
29 public:
31 using PinFeatureMetaValueMap = std::map<std::pair<size_t, size_t>, std::set<std::string>>;
32
33 static void store(const std::string& pin_file,
34 const PeptideIdentificationList& peptide_ids,
35 const StringList& feature_set,
36 const std::string& enz,
37 int min_charge,
38 int max_charge);
39
40
68 static PeptideIdentificationList load(const std::string& pin_file,
69 bool higher_score_better,
70 const std::string& score_name,
71 const StringList& extra_scores,
72 StringList& filenames,
73 std::string decoy_prefix = "",
74 double threshold = 0.01,
75 bool SageAnnotation = false);
76
77 // uses spectrum_reference, if empty uses spectrum_id, if also empty fall back to using index
78 static std::string getScanIdentifier(const PeptideIdentification& pid, size_t index);
79
91 static StringList getStandardFeatureSet(int min_charge, int max_charge);
92
118 static std::set<std::pair<size_t, size_t>> stampPinFeaturesOnHits(
119 PeptideIdentificationList& peptide_ids,
120 const std::string& enz,
121 int min_charge,
122 int max_charge);
123
139 static std::set<std::pair<size_t, size_t>> stampPinFeaturesOnHits(
140 PeptideIdentificationList& peptide_ids,
141 const std::string& enz,
142 int min_charge,
143 int max_charge,
144 PinFeatureMetaValueMap& added_meta_values);
145
163 static double getFeatureValue(const DataValue& value, const std::string& feature);
164
165 protected:
166
167 //id <tab> label <tab> scannr <tab> calcmass <tab> expmass <tab> feature1 <tab> ... <tab> featureN <tab> peptide <tab> proteinId1 <tab> .. <tab> proteinIdM
169 const PeptideIdentificationList& peptide_ids,
170 const StringList& feature_set,
171 const std::string& enz,
172 int min_charge,
173 int max_charge);
174
175 static bool isEnz_(const char& n, const char& c, const std::string& enz);
176
177 static Size countEnzymatic_(const std::string& peptide, const std::string& enz);
178
179 };
180} // namespace OpenMS
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition DataValue.h:33
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition PeptideIdentification.h:66
Class for storing Percolator tab-delimited input files.
Definition PercolatorInfile.h:28
static double getFeatureValue(const DataValue &value, const std::string &feature)
Numeric value of a PIN feature, as the percolator executable reads it.
static Size countEnzymatic_(const std::string &peptide, const std::string &enz)
static void store(const std::string &pin_file, const PeptideIdentificationList &peptide_ids, const StringList &feature_set, const std::string &enz, int min_charge, int max_charge)
std::map< std::pair< size_t, size_t >, std::set< std::string > > PinFeatureMetaValueMap
PIN meta values added to each hit, keyed by (peptide ID index, hit index).
Definition PercolatorInfile.h:31
static std::string getScanIdentifier(const PeptideIdentification &pid, size_t index)
static TextFile preparePin_(const PeptideIdentificationList &peptide_ids, const StringList &feature_set, const std::string &enz, int min_charge, int max_charge)
static bool isEnz_(const char &n, const char &c, const std::string &enz)
static std::set< std::pair< size_t, size_t > > stampPinFeaturesOnHits(PeptideIdentificationList &peptide_ids, const std::string &enz, int min_charge, int max_charge)
Compute and stamp PIN-equivalent meta values on every PeptideHit.
static StringList getStandardFeatureSet(int min_charge, int max_charge)
Returns the standard Percolator feature columns every .pin file should declare.
static PeptideIdentificationList load(const std::string &pin_file, bool higher_score_better, const std::string &score_name, const StringList &extra_scores, StringList &filenames, std::string decoy_prefix="", double threshold=0.01, bool SageAnnotation=false)
Loads peptide identifications from a Percolator input file.
static std::set< std::pair< size_t, size_t > > stampPinFeaturesOnHits(PeptideIdentificationList &peptide_ids, const std::string &enz, int min_charge, int max_charge, PinFeatureMetaValueMap &added_meta_values)
Compute and stamp PIN-equivalent meta values, recording newly added keys.
Definition TextFile.h:21
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition TypeAliases.h:39
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19