OpenMS
ProteinResolver.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: David Wojnar $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
17 
18 namespace OpenMS
19 {
28  class OPENMS_DLLAPI ProteinResolver :
29  public DefaultParamHandler
30  {
31 
32 public:
33 
34  //default constructor
36 
37  //copy constructor
39 
40  //assignment operator
42 
43  //destructor
44  ~ProteinResolver() override;
45 
46 
47  struct ProteinEntry;
48  struct PeptideEntry;
49  struct ISDGroup;
50  struct MSDGroup;
51  struct ResolverResult;
52 
54  struct ProteinEntry
55  {
56  std::list<PeptideEntry *> peptides;
57  bool traversed;
59  enum type {primary, secondary, primary_indistinguishable, secondary_indistinguishable} protein_type;
60  double weight; //monoisotopic
61  float coverage; //in percent
62  //if Protein is indistinguishable all his fellows are in the list indis
63  std::list<ProteinEntry *> indis;
65  Size msd_group; //index
66  Size isd_group; //index
68  };
69 
71  struct PeptideEntry
72  {
73  std::list<ProteinEntry *> proteins;
74  bool traversed;
79  Size msd_group; //index
80  Size isd_group; //index
82  float intensity;
84  };
85 
87  struct MSDGroup
88  {
89  std::list<ProteinEntry *> proteins;
90  std::list<PeptideEntry *> peptides;
96  float intensity;
97  };
98 
99  struct ISDGroup
100  {
101  std::list<ProteinEntry *> proteins;
102  std::list<PeptideEntry *> peptides;
104  std::list<Size> msd_groups;
105  };
106 
108  {
110  std::vector<ISDGroup> * isds;
111  std::vector<MSDGroup> * msds;
112  std::vector<ProteinEntry> * protein_entries;
113  std::vector<PeptideEntry> * peptide_entries;
114  std::vector<Size> * reindexed_peptides;
115  std::vector<Size> * reindexed_proteins;
116  enum type {PeptideIdent, Consensus} input_type;
117  std::vector<PeptideIdentification> * peptide_identification;
119  };
120 
128  void resolveConsensus(ConsensusMap & consensus);
129 
137  void resolveID(std::vector<PeptideIdentification> & peptide_identifications);
138 
145  void countTargetDecoy(std::vector<MSDGroup> & msd_groups, ConsensusMap & consensus);
146 
153  void countTargetDecoy(std::vector<MSDGroup> & msd_groups, std::vector<PeptideIdentification> & peptide_nodes);
154 
155  void clearResult();
156 
157  void setProteinData(std::vector<FASTAFile::FASTAEntry> & protein_data);
158 
159  const std::vector<ResolverResult> & getResults();
160 
162  static const PeptideIdentification & getPeptideIdentification(const ConsensusMap & consensus, const PeptideEntry * peptide);
163  static const PeptideHit & getPeptideHit(const ConsensusMap & consensus, const PeptideEntry * peptide);
164  static const PeptideIdentification & getPeptideIdentification(const std::vector<PeptideIdentification> & peptide_nodes, const PeptideEntry * peptide);
165  static const PeptideHit & getPeptideHit(const std::vector<PeptideIdentification> & peptide_nodes, const PeptideEntry * peptide);
166 
167 private:
168 
169  std::vector<ResolverResult> resolver_result_;
170  std::vector<FASTAFile::FASTAEntry> protein_data_;
171 
172  void computeIntensityOfMSD_(std::vector<MSDGroup> & msd_groups);
173 
175  void traverseProtein_(ProteinEntry * prot_node, MSDGroup & group);
176  void traversePeptide_(PeptideEntry * pep_node, MSDGroup & group);
178  Size findPeptideEntry_(String seq, std::vector<PeptideEntry> & nodes);
180  Size binarySearchNodes_(String & seq, std::vector<PeptideEntry> & nodes, Size start, Size end);
182  Size includeMSMSPeptides_(std::vector<PeptideIdentification> & peptide_identifications, std::vector<PeptideEntry> & peptide_nodes);
185  Size includeMSMSPeptides_(ConsensusMap & consensus, std::vector<PeptideEntry> & peptide_nodes);
187  void reindexingNodes_(std::vector<MSDGroup> & msd_groups, std::vector<Size> & reindexed_proteins, std::vector<Size> & reindexed_peptides);
189  void primaryProteins_(std::vector<PeptideEntry> & peptide_nodes, std::vector<Size> & reindexed_peptides);
190  void buildingMSDGroups_(std::vector<MSDGroup> & msd_groups, std::vector<ISDGroup> & isd_groups);
191  void buildingISDGroups_(std::vector<ProteinEntry> & protein_nodes, std::vector<PeptideEntry> & peptide_nodes,
192  std::vector<ISDGroup> & isd_groups);
193  // disabled/buggy
194  //ProteinResolver::indistinguishableProteins(vector<MSDGroup>& msd_groups);
195 
196  }; // class
197 
198 } // namespace
199 
A container for consensus elements.
Definition: ConsensusMap.h:66
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
Representation of a peptide hit.
Definition: PeptideHit.h:31
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:39
Helper class for peptide and protein quantification based on feature data annotated with IDs.
Definition: ProteinResolver.h:30
static const PeptideHit & getPeptideHit(const std::vector< PeptideIdentification > &peptide_nodes, const PeptideEntry *peptide)
Size peptide_hit
Definition: ProteinResolver.h:77
float intensity
Definition: ProteinResolver.h:82
void resolveID(std::vector< PeptideIdentification > &peptide_identifications)
Computing protein groups from peptide identifications OR consensus map.
String sequence
Definition: ProteinResolver.h:75
std::list< Size > msd_groups
Definition: ProteinResolver.h:104
std::vector< ResolverResult > resolver_result_
Definition: ProteinResolver.h:169
void buildingISDGroups_(std::vector< ProteinEntry > &protein_nodes, std::vector< PeptideEntry > &peptide_nodes, std::vector< ISDGroup > &isd_groups)
void countTargetDecoy(std::vector< MSDGroup > &msd_groups, std::vector< PeptideIdentification > &peptide_nodes)
brief
bool traversed
Definition: ProteinResolver.h:74
std::list< PeptideEntry * > peptides
Definition: ProteinResolver.h:90
void resolveConsensus(ConsensusMap &consensus)
Computing protein groups from peptide identifications OR consensus map.
Size number_of_decoy
Definition: ProteinResolver.h:93
Size includeMSMSPeptides_(std::vector< PeptideIdentification > &peptide_identifications, std::vector< PeptideEntry > &peptide_nodes)
includes all MS/MS derived peptides into the graph –idXML
String origin
Definition: ProteinResolver.h:83
void traversePeptide_(PeptideEntry *pep_node, MSDGroup &group)
bool experimental
Definition: ProteinResolver.h:81
void primaryProteins_(std::vector< PeptideEntry > &peptide_nodes, std::vector< Size > &reindexed_peptides)
marks Proteins which have a unique peptide as primary. Uses reindexed vector, thus reindexingNodes ha...
Size number_of_target_plus_decoy
Definition: ProteinResolver.h:95
static const PeptideIdentification & getPeptideIdentification(const std::vector< PeptideIdentification > &peptide_nodes, const PeptideEntry *peptide)
const std::vector< ResolverResult > & getResults()
ISDGroup * isd_group
Definition: ProteinResolver.h:92
Size number_of_target
Definition: ProteinResolver.h:94
Size includeMSMSPeptides_(ConsensusMap &consensus, std::vector< PeptideEntry > &peptide_nodes)
void traverseProtein_(ProteinEntry *prot_node, MSDGroup &group)
traverse protein and peptide nodes for building MSD groups
void buildingMSDGroups_(std::vector< MSDGroup > &msd_groups, std::vector< ISDGroup > &isd_groups)
ProteinResolver(const ProteinResolver &rhs)
static const PeptideIdentification & getPeptideIdentification(const ConsensusMap &consensus, const PeptideEntry *peptide)
overloaded functions – return a const reference to a PeptideIdentification object or a peptideHit eit...
Size msd_group
Definition: ProteinResolver.h:79
Size findPeptideEntry_(String seq, std::vector< PeptideEntry > &nodes)
searches given sequence in all nodes and returns its index or nodes.size() if not found.
void countTargetDecoy(std::vector< MSDGroup > &msd_groups, ConsensusMap &consensus)
brief
std::list< ProteinEntry * > proteins
Definition: ProteinResolver.h:73
Size binarySearchNodes_(String &seq, std::vector< PeptideEntry > &nodes, Size start, Size end)
helper function for findPeptideEntry.
void setProteinData(std::vector< FASTAFile::FASTAEntry > &protein_data)
std::vector< FASTAFile::FASTAEntry > protein_data_
Definition: ProteinResolver.h:170
static const PeptideHit & getPeptideHit(const ConsensusMap &consensus, const PeptideEntry *peptide)
void reindexingNodes_(std::vector< MSDGroup > &msd_groups, std::vector< Size > &reindexed_proteins, std::vector< Size > &reindexed_peptides)
Proteins and Peptides get reindexed, based on whether they belong to msd groups or not....
Size peptide_identification
Definition: ProteinResolver.h:76
Size index
Definition: ProteinResolver.h:78
ProteinResolver & operator=(const ProteinResolver &rhs)
void computeIntensityOfMSD_(std::vector< MSDGroup > &msd_groups)
Size isd_group
Definition: ProteinResolver.h:80
Definition: ProteinResolver.h:100
representation of an msd group. Contains peptides, proteins and a pointer to its ISD group
Definition: ProteinResolver.h:88
represents a peptide. First in silico. If experimental is set to true it is MS/MS derived.
Definition: ProteinResolver.h:72
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
FASTA entry type (identifier, description and sequence) The first String corresponds to the identifie...
Definition: FASTAFile.h:46
represents a protein from FASTA file
Definition: ProteinResolver.h:55
float coverage
Definition: ProteinResolver.h:61
std::list< ProteinEntry * > indis
Definition: ProteinResolver.h:63
bool traversed
Definition: ProteinResolver.h:57
std::list< PeptideEntry * > peptides
Definition: ProteinResolver.h:56
type
Definition: ProteinResolver.h:59
@ primary
Definition: ProteinResolver.h:59
double weight
Definition: ProteinResolver.h:60
Size number_of_experimental_peptides
Definition: ProteinResolver.h:67
Size msd_group
Definition: ProteinResolver.h:65
FASTAFile::FASTAEntry * fasta_entry
Definition: ProteinResolver.h:58
Size index
Definition: ProteinResolver.h:64
Size isd_group
Definition: ProteinResolver.h:66
Definition: ProteinResolver.h:108
std::vector< MSDGroup > * msds
Definition: ProteinResolver.h:111
std::vector< ISDGroup > * isds
Definition: ProteinResolver.h:110
std::vector< PeptideIdentification > * peptide_identification
Definition: ProteinResolver.h:117
type
Definition: ProteinResolver.h:116
std::vector< Size > * reindexed_proteins
Definition: ProteinResolver.h:115
std::vector< PeptideEntry > * peptide_entries
Definition: ProteinResolver.h:113
std::vector< Size > * reindexed_peptides
Definition: ProteinResolver.h:114
std::vector< ProteinEntry > * protein_entries
Definition: ProteinResolver.h:112
ConsensusMap * consensus_map
Definition: ProteinResolver.h:118
String identifier
Definition: ProteinResolver.h:109