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
42 static void store(const std::string& pin_file,
43 const PeptideIdentificationList& peptide_ids,
44 const StringList& feature_set,
45 const std::string& enz,
46 int min_charge,
47 int max_charge);
48
49
77 static PeptideIdentificationList load(const std::string& pin_file,
78 bool higher_score_better,
79 const std::string& score_name,
80 const StringList& extra_scores,
81 StringList& filenames,
82 std::string decoy_prefix = "",
83 double threshold = 0.01,
84 bool SageAnnotation = false);
85
86 // uses spectrum_reference, if empty uses spectrum_id, if also empty fall back to using index
87 static std::string getScanIdentifier(const PeptideIdentification& pid, size_t index);
88
98 static std::string getFileIdentifier(const PeptideIdentification& pid);
99
111 static StringList getStandardFeatureSet(int min_charge, int max_charge);
112
144 static std::set<std::pair<size_t, size_t>> stampPinFeaturesOnHits(
145 PeptideIdentificationList& peptide_ids,
146 const std::string& enz,
147 int min_charge,
148 int max_charge);
149
165 static std::set<std::pair<size_t, size_t>> stampPinFeaturesOnHits(
166 PeptideIdentificationList& peptide_ids,
167 const std::string& enz,
168 int min_charge,
169 int max_charge,
170 PinFeatureMetaValueMap& added_meta_values);
171
189 static double getFeatureValue(const DataValue& value, const std::string& feature);
190
191 protected:
192
193 //id <tab> label <tab> scannr <tab> calcmass <tab> expmass <tab> feature1 <tab> ... <tab> featureN <tab> peptide <tab> proteinId1 <tab> .. <tab> proteinIdM
195 const PeptideIdentificationList& peptide_ids,
196 const StringList& feature_set,
197 const std::string& enz,
198 int min_charge,
199 int max_charge);
200
201 static bool isEnz_(const char& n, const char& c, const std::string& enz);
202
203 static Size countEnzymatic_(const std::string& peptide, const std::string& enz);
204
205 };
206} // 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)
Writes the PSMs of peptide_ids as a Percolator input file.
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 std::string getFileIdentifier(const PeptideIdentification &pid)
The spectrum file of a PSM: its 'file_origin' (empty if not set), followed by '|' and its 'id_merge_i...
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