OpenMS
Loading...
Searching...
No Matches
IDBoostGraph.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: Julianus Pfeuffer $
6// $Authors: Julianus Pfeuffer $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11// define to get timings for connected components
12//#define INFERENCE_BENCH
13
14#include <OpenMS/ANALYSIS/ID/MessagePasserFactory.h> //included in BPI
21
22#include <vector>
23#include <unordered_map>
24#include <queue>
25
26#include <boost/function.hpp>
27#include <boost/blank.hpp>
28#include <boost/serialization/strong_typedef.hpp>
29#include <boost/graph/adjacency_list.hpp>
30#include <boost/graph/depth_first_search.hpp>
31#include <boost/graph/filtered_graph.hpp>
32#include <boost/graph/properties.hpp>
33#include <boost/variant.hpp>
34#include <boost/variant/detail/hash_variant.hpp>
35#include <boost/variant/static_visitor.hpp>
36
37namespace OpenMS
38{
39 struct ScoreToTgtDecLabelPairs;
40
41 namespace Internal
42 {
43
56 //TODO Add OPENMS_DLLAPI everywhere
57 class OPENMS_DLLAPI IDBoostGraph
58 {
59
60 public:
61
62 // boost has a weird extra semicolon in their strong typedef
63 #ifdef __clang__
64 #pragma clang diagnostic push
65 #pragma clang diagnostic ignored "-Wextra-semi"
66 #endif
67
69 BOOST_STRONG_TYPEDEF(boost::blank, PeptideCluster);
70
73 {
74 int size = 0;
75 int tgts = 0;
76 double score = 0.;
77 };
78
81
84
87
88 #ifdef __clang__
89 #pragma clang diagnostic pop
90 #endif
91
92 //typedefs
93 //TODO rename ProteinGroup type since it collides with the actual OpenMS ProteinGroup
94 typedef boost::variant<ProteinHit*, ProteinGroup, PeptideCluster, Peptide, RunIndex, Charge, PeptideHit*> IDPointer;
95 typedef boost::variant<const ProteinHit*, const ProteinGroup*, const PeptideCluster*, const Peptide, const RunIndex, const Charge, const PeptideHit*> IDPointerConst;
96 //TODO check the impact of different data structures to store nodes/edges
97 // Directed graphs would make the internal computations much easier (less in/out edge checking) but boost
98 // does not allow computation of "non-strongly" connected components for directed graphs, which is what we would
99 // need. We can think about after/while copying to CCs, to insert it into a directed graph!
100 typedef boost::adjacency_list <boost::setS, boost::vecS, boost::undirectedS, IDPointer> Graph;
101 typedef std::vector<Graph> Graphs;
102 typedef boost::adjacency_list <boost::setS, boost::vecS, boost::undirectedS, IDPointer> GraphConst;
103
104 typedef boost::graph_traits<Graph>::vertex_descriptor vertex_t;
105 typedef boost::graph_traits<Graph>::edge_descriptor edge_t;
106
107 typedef std::set<IDBoostGraph::vertex_t> ProteinNodeSet;
108 typedef std::set<IDBoostGraph::vertex_t> PeptideNodeSet;
109
110
113 public boost::default_dfs_visitor
114 {
115 public:
117 : gs(vgs), curr_v(0), next_v(0), m()
118 {}
119
120 template < typename Vertex, typename Graph >
121 void start_vertex(Vertex u, const Graph & tg)
122 {
123 gs.emplace_back();
124 next_v = boost::add_vertex(tg[u], gs.back());
125 m[u] = next_v;
126 }
127
128 template < typename Vertex, typename Graph >
129 void discover_vertex(Vertex /*u*/, const Graph & /*tg*/)
130 {
131 curr_v = next_v;
132 }
133
134 template < typename Edge, typename Graph >
135 void examine_edge(Edge e, const Graph & tg)
136 {
137 if (m.find(e.m_target) == m.end())
138 {
139 next_v = boost::add_vertex(tg[e.m_target], gs.back());
140 m[e.m_target] = next_v;
141 }
142 else
143 {
144 next_v = m[e.m_target];
145 }
146
147 boost::add_edge(m[e.m_source], next_v, gs.back());
148 }
149
153 std::map<vertex_t, vertex_t> m;
154 };
155
159 public boost::static_visitor<OpenMS::String>
160 {
161 public:
162
164 {
165 return pep->getSequence().toString() + "_" + pep->getCharge();
166 }
167
169 {
170 return prot->getAccession();
171 }
172
173 OpenMS::String operator()(const ProteinGroup& /*protgrp*/) const
174 {
175 return "PG";
176 }
177
178 OpenMS::String operator()(const PeptideCluster& /*pc*/) const
179 {
180 return "PepClust";
181 }
182
183 OpenMS::String operator()(const Peptide& peptide) const
184 {
185 return peptide;
186 }
187
188 OpenMS::String operator()(const RunIndex& ri) const
189 {
190 return "rep" + String(ri);
191 }
192
193 OpenMS::String operator()(const Charge& chg) const
194 {
195 return "chg" + String(chg);
196 }
197
198 };
199
202 template<class CharT>
204 public boost::static_visitor<>
205 {
206 public:
207
208 explicit PrintAddressVisitor(std::basic_ostream<CharT> stream):
209 stream_(stream)
210 {}
211
212 void operator()(PeptideHit* pep) const
213 {
214 stream_ << pep->getSequence().toUnmodifiedString() << ": " << pep << std::endl;
215 }
216
217 void operator()(ProteinHit* prot) const
218 {
219 stream_ << prot->getAccession() << ": " << prot << std::endl;
220 }
221
222 void operator()(const ProteinGroup& /*protgrp*/) const
223 {
224 stream_ << "PG" << std::endl;
225 }
226
227 void operator()(const PeptideCluster& /*pc*/) const
228 {
229 stream_ << "PepClust" << std::endl;
230 }
231
232 void operator()(const Peptide& peptide) const
233 {
234 stream_ << peptide << std::endl;
235 }
236
237 void operator()(const RunIndex& ri) const
238 {
239 stream_ << "rep" << ri << std::endl;
240 }
241
242 void operator()(const Charge& chg) const
243 {
244 stream_ << "chg" << chg << std::endl;
245 }
246
247 std::basic_ostream<CharT> stream_;
248 };
249
254 public boost::static_visitor<>
255 {
256 public:
257
258 void operator()(PeptideHit* pep, double posterior) const
259 {
260 pep->setScore(posterior);
261 }
262
263 void operator()(ProteinHit* prot, double posterior) const
264 {
265 prot->setScore(posterior);
266 }
267
268 void operator()(ProteinGroup& pg, double posterior) const
269 {
270 pg.score = posterior;
271 }
272
273 // Everything else, do nothing for now
274 template <class T>
275 void operator()(T& /*any node type*/, double /*posterior*/) const
276 {
277 // do nothing
278 }
279
280 };
281
285 public boost::static_visitor<double>
286 {
287 public:
288
289 double operator()(PeptideHit* pep) const
290 {
291 return pep->getScore();
292 }
293
294 double operator()(ProteinHit* prot) const
295 {
296 return prot->getScore();
297 }
298
299 double operator()(ProteinGroup& pg) const
300 {
301 return pg.score;
302 }
303
304 // Everything else, do nothing for now
305 template <class T>
306 double operator()(T& /*any node type*/) const
307 {
308 return -1.0;
309 }
310
311 };
312
317 public boost::static_visitor<std::pair<double,bool>>
318 {
319 public:
320
321 std::pair<double,bool> operator()(PeptideHit* pep) const
322 {
323 return {pep->getScore(), pep->getMetaValue("target_decoy").toString()[0] == 't'};
324 }
325
326 std::pair<double,bool> operator()(ProteinHit* prot) const
327 {
328 return {prot->getScore(), prot->getMetaValue("target_decoy").toString()[0] == 't'};
329 }
330
331 std::pair<double,bool> operator()(ProteinGroup& pg) const
332 {
333 return {pg.score, pg.tgts > 0};
334 }
335
336 // Everything else, do nothing for now
337 template <class T>
338 std::pair<double,bool> operator()(T& /*any node type*/) const
339 {
340 return {-1.0, false};
341 }
342 };
343
346 PeptideIdentificationList& idedSpectra,
347 Size use_top_psms,
348 bool use_run_info,
349 bool best_psms_annotated,
350 const std::optional<const ExperimentalDesign>& ed = std::optional<const ExperimentalDesign>());
351
353 ConsensusMap& cmap,
354 Size use_top_psms,
355 bool use_run_info,
356 bool use_unassigned_ids,
357 bool best_psms_annotated,
358 const std::optional<const ExperimentalDesign>& ed = std::optional<const ExperimentalDesign>());
359
360
361 //TODO think about templating to avoid wrapping to std::function
362 // although we usually do long-running tasks per CC such that the extra virtual call does not matter much
363 // Instead we gain type erasure.
365 void applyFunctorOnCCs(const std::function<unsigned long(Graph&, unsigned int)>& functor);
367 void applyFunctorOnCCsST(const std::function<void(Graph&)>& functor);
368
372
373 //TODO create a new class for an extended Graph and try to reuse as much as possible
374 // use inheritance or templates
378
385 void annotateIndistProteins(bool addSingletons = true);
386
390 void calculateAndAnnotateIndistProteins(bool addSingletons = true);
391
394
401 void resolveGraphPeptideCentric(bool removeAssociationsInData = true);
402
403
404
407
412
416
417 //TODO docu
418 //void buildExtendedGraph(bool use_all_psms, std::pair<int,int> chargeRange, unsigned int nrReplicates);
419
423 static void printGraph(std::ostream& out, const Graph& fg);
424
433 void getUpstreamNodesNonRecursive(std::queue<vertex_t>& q, const Graph& graph, int lvl,
434 bool stop_at_first, std::vector<vertex_t>& result);
435
444 void getDownstreamNodesNonRecursive(std::queue<vertex_t>& q, const Graph& graph, int lvl,
445 bool stop_at_first, std::vector<vertex_t>& result);
446
455
456 private:
457
459
460 struct SequenceToReplicateChargeVariantHierarchy;
461
462
463 //TODO introduce class hierarchy:
464 /*
465 * IDGraph<UnderlyingIDStruc>
466 *
467 * - BasicGraph<>
468 * - ExtendedGraphClustered<>
469 * - ExtendedGraphClusteredWithRunInfo<>
470 *
471 * in theory extending a basic one is desirable to create the extended one. But it means we have to
472 * copy/move the graph (node by node) because the nodes are of a broader boost::variant type. So we probably have to
473 * duplicate code and offer a from-scratch step-wise building for the extended graph, too.
474 * Note that there could be several levels of extension in the future. For now I keep everything in one
475 * class by having potential storage for the broadest extended type. Differences in the underlying ID structure
476 * e.g. ConsensusMap or PeptideIDs from idXML currently only have an effect during building, so I just overload
477 * the constructors. In theory it would be nice to generalize on that, too, especially when we adapt to the new
478 * ID data structure.
479 */
480
481
482 /* ---------------- Either of them is used, preferably second --------------- */
485
488 /* ---------------------------------------------------------------------------- */
489
490 #ifdef INFERENCE_BENCH
492 std::vector<std::tuple<vertex_t, vertex_t, unsigned long, double>> sizes_and_times_{1};
493 #endif
494
495
496 /* ---- Only used when run information was available --------- */
497
498 //TODO think about preallocating it, but the number of peptide hits is not easily computed
499 // since they are inside the pepIDs
500 //TODO would multiple sets be better?
501
504 std::unordered_map<vertex_t, Size> pepHitVtx_to_run_;
505
510 Size nrPrefractionationGroups_ = 0;
511
512 /* ----------------------------------------------------------- */
513
514
517 vertex_t addVertexWithLookup_(const IDPointer& ptr, std::unordered_map<IDPointer, vertex_t, boost::hash<IDPointer>>& vertex_map);
518 //vertex_t addVertexWithLookup_(IDPointerConst& ptr, std::unordered_map<IDPointerConst, vertex_t, boost::hash<IDPointerConst>>& vertex_map);
519
520
522 void annotateIndistProteins_(const Graph& fg, bool addSingletons);
523 void calculateAndAnnotateIndistProteins_(const Graph& fg, bool addSingletons);
524
535 PeptideIdentificationList& idedSpectra,
536 Size use_top_psms,
537 bool best_psms_annotated = false);
538
540 ConsensusMap& cmap,
541 Size use_top_psms,
542 bool use_unassigned_ids,
543 bool best_psms_annotated = false);
544
547 PeptideIdentification& spectrum,
548 std::unordered_map<IDPointer, vertex_t, boost::hash<IDPointer>>& vertex_map,
549 const std::unordered_map<std::string, ProteinHit*>& accession_map,
550 Size use_top_psms,
551 bool best_psms_annotated);
552
554 PeptideIdentification& spectrum,
555 std::unordered_map<unsigned, unsigned>& indexToPrefractionationGroup,
556 std::unordered_map<IDPointer, vertex_t, boost::hash<IDPointer>>& vertex_map,
557 std::unordered_map<std::string, ProteinHit*>& accession_map,
558 Size use_top_psms
559 );
560
569 ConsensusMap& cmap,
570 Size use_top_psms,
571 bool use_unassigned_ids,
572 const ExperimentalDesign& ed);
573
575 PeptideIdentificationList& idedSpectra,
576 Size use_top_psms,
577 const ExperimentalDesign& ed);
578
579
581 void resolveGraphPeptideCentric_(Graph& fg, bool removeAssociationsInData);
582
583 template<class NodeType>
584 void getDownstreamNodes(const vertex_t& start, const Graph& graph, std::vector<NodeType>& result)
585 {
586 Graph::adjacency_iterator adjIt, adjIt_end;
587 boost::tie(adjIt, adjIt_end) = boost::adjacent_vertices(start, graph);
588 for (;adjIt != adjIt_end; ++adjIt)
589 {
590 if (graph[*adjIt].type() == typeid(NodeType))
591 {
592 result.emplace_back(boost::get<NodeType>(graph[*adjIt]));
593 }
594 else if (graph[*adjIt].which() > graph[start].which())
595 {
596 getDownstreamNodes(*adjIt, graph, result);
597 }
598 }
599 }
600
601 template<class NodeType>
602 void getUpstreamNodes(const vertex_t& start, const Graph graph, std::vector<NodeType>& result)
603 {
604 Graph::adjacency_iterator adjIt, adjIt_end;
605 boost::tie(adjIt, adjIt_end) = boost::adjacent_vertices(start, graph);
606 for (;adjIt != adjIt_end; ++adjIt)
607 {
608 if (graph[*adjIt].type() == typeid(NodeType))
609 {
610 result.emplace_back(boost::get<NodeType>(graph[*adjIt]));
611 }
612 else if (graph[*adjIt].which() < graph[start].which())
613 {
614 getUpstreamNodes(*adjIt, graph, result);
615 }
616 }
617 }
618 };
619
621 } //namespace Internal
622} //namespace OpenMS
623
String toString() const
returns the peptide as string with modifications embedded in brackets
String toUnmodifiedString() const
returns the peptide as string without any modifications or (e.g., "PEPTIDER")
A container for consensus elements.
Definition ConsensusMap.h:68
String toString(bool full_precision=true) const
Conversion to String full_precision Controls number of fractional digits for all double types or list...
Representation of an experimental design in OpenMS. Instances can be loaded with the ExperimentalDesi...
Definition ExperimentalDesign.h:109
Visits nodes in the boost graph (either ptrs to an ID Object or some lightweight surrogates) and depe...
Definition IDBoostGraph.h:286
double operator()(PeptideHit *pep) const
Definition IDBoostGraph.h:289
double operator()(ProteinHit *prot) const
Definition IDBoostGraph.h:294
double operator()(T &) const
Definition IDBoostGraph.h:306
double operator()(ProteinGroup &pg) const
Definition IDBoostGraph.h:299
Visits nodes in the boost graph (either ptrs to an ID Object or some lightweight surrogates) and depe...
Definition IDBoostGraph.h:318
std::pair< double, bool > operator()(PeptideHit *pep) const
Definition IDBoostGraph.h:321
std::pair< double, bool > operator()(ProteinHit *prot) const
Definition IDBoostGraph.h:326
std::pair< double, bool > operator()(ProteinGroup &pg) const
Definition IDBoostGraph.h:331
std::pair< double, bool > operator()(T &) const
Definition IDBoostGraph.h:338
Visits nodes in the boost graph (ptrs to an ID Object) and depending on their type creates a label e....
Definition IDBoostGraph.h:160
OpenMS::String operator()(const Peptide &peptide) const
Definition IDBoostGraph.h:183
OpenMS::String operator()(const Charge &chg) const
Definition IDBoostGraph.h:193
OpenMS::String operator()(const PeptideHit *pep) const
Definition IDBoostGraph.h:163
OpenMS::String operator()(const ProteinGroup &) const
Definition IDBoostGraph.h:173
OpenMS::String operator()(const RunIndex &ri) const
Definition IDBoostGraph.h:188
OpenMS::String operator()(const ProteinHit *prot) const
Definition IDBoostGraph.h:168
OpenMS::String operator()(const PeptideCluster &) const
Definition IDBoostGraph.h:178
Visits nodes in the boost graph (ptrs to an ID Object) and depending on their type prints the address...
Definition IDBoostGraph.h:205
void operator()(const Charge &chg) const
Definition IDBoostGraph.h:242
std::basic_ostream< CharT > stream_
Definition IDBoostGraph.h:247
PrintAddressVisitor(std::basic_ostream< CharT > stream)
Definition IDBoostGraph.h:208
void operator()(const PeptideCluster &) const
Definition IDBoostGraph.h:227
void operator()(const RunIndex &ri) const
Definition IDBoostGraph.h:237
void operator()(PeptideHit *pep) const
Definition IDBoostGraph.h:212
void operator()(ProteinHit *prot) const
Definition IDBoostGraph.h:217
void operator()(const Peptide &peptide) const
Definition IDBoostGraph.h:232
void operator()(const ProteinGroup &) const
Definition IDBoostGraph.h:222
Visits nodes in the boost graph (either ptrs to an ID Object or some lightweight surrogates) and depe...
Definition IDBoostGraph.h:255
void operator()(T &, double) const
Definition IDBoostGraph.h:275
void operator()(PeptideHit *pep, double posterior) const
Definition IDBoostGraph.h:258
void operator()(ProteinGroup &pg, double posterior) const
Definition IDBoostGraph.h:268
void operator()(ProteinHit *prot, double posterior) const
Definition IDBoostGraph.h:263
A boost dfs visitor that copies connected components into a vector of graphs.
Definition IDBoostGraph.h:114
std::map< vertex_t, vertex_t > m
A mapping from old node id to new node id to not duplicate existing ones in the new graph.
Definition IDBoostGraph.h:153
void start_vertex(Vertex u, const Graph &tg)
Definition IDBoostGraph.h:121
void examine_edge(Edge e, const Graph &tg)
Definition IDBoostGraph.h:135
dfs_ccsplit_visitor(Graphs &vgs)
Definition IDBoostGraph.h:116
vertex_t curr_v
Definition IDBoostGraph.h:151
void discover_vertex(Vertex, const Graph &)
Definition IDBoostGraph.h:129
Graphs & gs
Definition IDBoostGraph.h:150
Creates and maintains a boost graph based on the OpenMS ID datastructures.
Definition IDBoostGraph.h:58
void buildGraph_(ProteinIdentification &proteins, PeptideIdentificationList &idedSpectra, Size use_top_psms, bool best_psms_annotated=false)
boost::graph_traits< Graph >::vertex_descriptor vertex_t
Definition IDBoostGraph.h:104
BOOST_STRONG_TYPEDEF(boost::blank, PeptideCluster)
placeholder for peptides with the same parent proteins or protein groups
BOOST_STRONG_TYPEDEF(int, Charge)
in which charge state a PSM was observed
std::unordered_map< vertex_t, Size > pepHitVtx_to_run_
Definition IDBoostGraph.h:504
boost::variant< const ProteinHit *, const ProteinGroup *, const PeptideCluster *, const Peptide, const RunIndex, const Charge, const PeptideHit * > IDPointerConst
Definition IDBoostGraph.h:95
std::vector< Graph > Graphs
Definition IDBoostGraph.h:101
double score
Definition IDBoostGraph.h:76
void addPeptideAndAssociatedProteinsWithRunInfo_(PeptideIdentification &spectrum, std::unordered_map< unsigned, unsigned > &indexToPrefractionationGroup, std::unordered_map< IDPointer, vertex_t, boost::hash< IDPointer > > &vertex_map, std::unordered_map< std::string, ProteinHit * > &accession_map, Size use_top_psms)
IDBoostGraph(ProteinIdentification &proteins, ConsensusMap &cmap, Size use_top_psms, bool use_run_info, bool use_unassigned_ids, bool best_psms_annotated, const std::optional< const ExperimentalDesign > &ed=std::optional< const ExperimentalDesign >())
IDBoostGraph(ProteinIdentification &proteins, PeptideIdentificationList &idedSpectra, Size use_top_psms, bool use_run_info, bool best_psms_annotated, const std::optional< const ExperimentalDesign > &ed=std::optional< const ExperimentalDesign >())
Constructors.
void getDownstreamNodes(const vertex_t &start, const Graph &graph, std::vector< NodeType > &result)
Definition IDBoostGraph.h:584
ProteinIdentification & protIDs_
Definition IDBoostGraph.h:458
void getUpstreamNodes(const vertex_t &start, const Graph graph, std::vector< NodeType > &result)
Definition IDBoostGraph.h:602
void computeConnectedComponents()
Splits the initialized graph into connected components and clears it.
void getProteinGroupScoresAndHitchhikingTgtFraction(ScoreToTgtDecLabelPairs &scores_and_tgt_fraction)
const Graph & getComponent(Size cc)
Returns a specific connected component of the graph as a graph itself.
int tgts
Definition IDBoostGraph.h:75
Size getNrConnectedComponents()
Zero means the graph was not split yet.
void resolveGraphPeptideCentric_(Graph &fg, bool removeAssociationsInData)
see equivalent public method
void getUpstreamNodesNonRecursive(std::queue< vertex_t > &q, const Graph &graph, int lvl, bool stop_at_first, std::vector< vertex_t > &result)
Searches for all upstream nodes from a (set of) start nodes that are lower or equal than a given leve...
void applyFunctorOnCCsST(const std::function< void(Graph &)> &functor)
Do sth on connected components single threaded (your functor object has to inherit from std::function...
Graph g
the initial boost Graph (will be cleared when split into CCs)
Definition IDBoostGraph.h:484
void annotateIndistProteins_(const Graph &fg, bool addSingletons)
internal function to annotate the underlying ID structures based on the given Graph
void clusterIndistProteinsAndPeptidesAndExtendGraph()
std::set< IDBoostGraph::vertex_t > PeptideNodeSet
Definition IDBoostGraph.h:108
std::set< IDBoostGraph::vertex_t > ProteinNodeSet
Definition IDBoostGraph.h:107
void buildGraphWithRunInfo_(ProteinIdentification &proteins, ConsensusMap &cmap, Size use_top_psms, bool use_unassigned_ids, const ExperimentalDesign &ed)
boost::adjacency_list< boost::setS, boost::vecS, boost::undirectedS, IDPointer > GraphConst
Definition IDBoostGraph.h:102
vertex_t addVertexWithLookup_(const IDPointer &ptr, std::unordered_map< IDPointer, vertex_t, boost::hash< IDPointer > > &vertex_map)
void calculateAndAnnotateIndistProteins(bool addSingletons=true)
void addPeptideIDWithAssociatedProteins_(PeptideIdentification &spectrum, std::unordered_map< IDPointer, vertex_t, boost::hash< IDPointer > > &vertex_map, const std::unordered_map< std::string, ProteinHit * > &accession_map, Size use_top_psms, bool best_psms_annotated)
Used during building.
static void printGraph(std::ostream &out, const Graph &fg)
Prints a graph (component or if not split, the full graph) in graphviz (i.e. dot) format.
void calculateAndAnnotateIndistProteins_(const Graph &fg, bool addSingletons)
boost::graph_traits< Graph >::edge_descriptor edge_t
Definition IDBoostGraph.h:105
void buildGraphWithRunInfo_(ProteinIdentification &proteins, PeptideIdentificationList &idedSpectra, Size use_top_psms, const ExperimentalDesign &ed)
BOOST_STRONG_TYPEDEF(String, Peptide)
an (currently unmodified) peptide sequence
void annotateIndistProteins(bool addSingletons=true)
BOOST_STRONG_TYPEDEF(Size, RunIndex)
in which run a PSM was observed
void resolveGraphPeptideCentric(bool removeAssociationsInData=true)
void getProteinGroupScoresAndTgtFraction(ScoreToTgtDecLabelPairs &scores_and_tgt_fraction)
void buildGraph_(ProteinIdentification &proteins, ConsensusMap &cmap, Size use_top_psms, bool use_unassigned_ids, bool best_psms_annotated=false)
void getProteinScores_(ScoreToTgtDecLabelPairs &scores_and_tgt)
const ProteinIdentification & getProteinIDs()
Returns the underlying protein identifications for viewing.
boost::adjacency_list< boost::setS, boost::vecS, boost::undirectedS, IDPointer > Graph
Definition IDBoostGraph.h:100
void getDownstreamNodesNonRecursive(std::queue< vertex_t > &q, const Graph &graph, int lvl, bool stop_at_first, std::vector< vertex_t > &result)
Searches for all downstream nodes from a (set of) start nodes that are higher or equal than a given l...
boost::variant< ProteinHit *, ProteinGroup, PeptideCluster, Peptide, RunIndex, Charge, PeptideHit * > IDPointer
Definition IDBoostGraph.h:94
void applyFunctorOnCCs(const std::function< unsigned long(Graph &, unsigned int)> &functor)
Do sth on connected components (your functor object has to inherit from std::function or be a lambda)
Graphs ccs_
the Graph split into connected components
Definition IDBoostGraph.h:487
indistinguishable protein groups (size, nr targets, score)
Definition IDBoostGraph.h:73
const DataValue & getMetaValue(const String &name) const
Returns the value corresponding to a string, or DataValue::EMPTY if not found.
Represents a single spectrum match (candidate) for a specific tandem mass spectrum (MS/MS).
Definition PeptideHit.h:52
double getScore() const
returns the PSM score
const AASequence & getSequence() const
returns the peptide sequence
Int getCharge() const
returns the charge of the peptide
void setScore(double score)
sets the PSM score
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:64
Representation of a protein hit.
Definition ProteinHit.h:35
double getScore() const
returns the score of the protein hit
void setScore(const double score)
sets the score of the protein hit
const String & getAccession() const
returns the accession of the protein
Representation of a protein identification run.
Definition ProteinIdentification.h:54
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
bool operator==(const IDBoostGraph::ProteinGroup &lhs, const IDBoostGraph::ProteinGroup &rhs)
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Definition IDScoreGetterSetter.h:32