Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
IDFilter.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-2016.
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: Nico Pfeifer, Mathias Walzer, Hendrik Weisser $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_FILTERING_ID_IDFILTER_H
36 #define OPENMS_FILTERING_ID_IDFILTER_H
37 
38 #include <OpenMS/config.h>
43 
44 #include <algorithm>
45 #include <climits>
46 #include <functional>
47 
48 namespace OpenMS
49 {
70  class OPENMS_DLLAPI IDFilter
71  {
72 public:
73 
75  IDFilter();
76 
78  virtual ~IDFilter();
79 
80 
86 
89  template <class HitType>
90  struct HasGoodScore
91  {
92  typedef HitType argument_type; // for use as a predicate
93 
94  double score;
96 
97  HasGoodScore(double score, bool higher_score_better):
98  score(score), higher_score_better(higher_score_better)
99  {}
100 
101  bool operator()(const HitType& hit) const
102  {
103  if (higher_score_better)
104  {
105  return hit.getScore() >= score;
106  }
107  return hit.getScore() <= score;
108  }
109  };
110 
116  template <class HitType>
117  struct HasMaxRank
118  {
119  typedef HitType argument_type; // for use as a predicate
120 
122 
124  rank(rank)
125  {
126  if (rank == 0)
127  {
128  throw Exception::IllegalArgument(__FILE__, __LINE__, __PRETTY_FUNCTION__, "The cut-off value for rank filtering must not be zero!");
129  }
130  }
131 
132  bool operator()(const HitType& hit) const
133  {
134  Size hit_rank = hit.getRank();
135  if (hit_rank == 0)
136  {
137  throw Exception::MissingInformation(__FILE__, __LINE__, __PRETTY_FUNCTION__, "No rank assigned to peptide or protein hit");
138  }
139  return hit_rank <= rank;
140  }
141  };
142 
148  template <class HitType>
150  {
151  typedef HitType argument_type; // for use as a predicate
152 
155 
156  HasMetaValue(const String& key, const DataValue& value):
157  key(key), value(value)
158  {}
159 
160  bool operator()(const HitType& hit) const
161  {
162  DataValue found = hit.getMetaValue(key);
163  if (found.isEmpty()) return false; // meta value "key" not set
164  if (value.isEmpty()) return true; // "key" is set, value doesn't matter
165  return found == value;
166  }
167  };
168 
170  template <class HitType>
172  {
173  typedef HitType argument_type; // for use as a predicate
174 
176  double value;
177 
178  HasMaxMetaValue(const String& key, const double& value):
179  key(key), value(value)
180  {}
181 
182  bool operator()(const HitType& hit) const
183  {
184  DataValue found = hit.getMetaValue(key);
185  if (found.isEmpty()) return false; // meta value "key" not set
186  return double(found) <= value;
187  }
188  };
189 
191  template <class HitType>
193  {
194  typedef HitType argument_type; // for use as a predicate
195 
196  struct HasMetaValue<HitType> target_decoy, is_decoy;
197 
199  target_decoy("target_decoy", "decoy"), is_decoy("isDecoy", "true")
200  {}
201 
202  bool operator()(const HitType& hit) const
203  {
204  // @TODO: this could be done slightly more efficiently by returning
205  // false if the "target_decoy" meta value is "target" or "target+decoy",
206  // without checking for an "isDecoy" meta value in that case
207  return target_decoy(hit) || is_decoy(hit);
208  }
209  };
210 
216  template <class HitType>
218  {
219  typedef HitType argument_type; // for use as a predicate
220 
221  const std::set<String>& accessions;
222 
223  HasMatchingAccession(const std::set<String>& accessions):
224  accessions(accessions)
225  {}
226 
227  bool operator()(const PeptideHit& hit) const
228  {
229  std::set<String> present_accessions = hit.extractProteinAccessions();
230  for (std::set<String>::iterator it = present_accessions.begin();
231  it != present_accessions.end(); ++it)
232  {
233  if (accessions.count(*it) > 0) return true;
234  }
235  return false;
236  }
237 
238  bool operator()(const ProteinHit& hit) const
239  {
240  return (accessions.count(hit.getAccession()) > 0);
241  }
242 
243  bool operator()(const PeptideEvidence& evidence) const
244  {
245  return (accessions.count(evidence.getProteinAccession()) > 0);
246  }
247  };
248 
250 
251 
257 
260  struct HasMinPeptideLength;
261 
263  struct HasMinCharge;
264 
266  struct HasLowMZError;
267 
273  struct HasMatchingModification;
274 
280  struct HasMatchingSequence;
281 
283  struct HasNoEvidence;
284 
286 
287 
290 
292  template <class IdentificationType>
293  struct HasNoHits
294  {
295  typedef IdentificationType argument_type; // for use as a predicate
296 
297  bool operator()(const IdentificationType& id) const
298  {
299  return id.getHits().empty();
300  }
301  };
302 
304 
305 
308 
310  struct HasRTInRange;
311 
313  struct HasMZInRange;
314 
316 
317 
323 
326  template <class Container, class Predicate>
327  static void removeMatchingItems(Container& items, const Predicate& pred)
328  {
329  items.erase(std::remove_if(items.begin(), items.end(), pred),
330  items.end());
331  }
332 
334  template <class Container, class Predicate>
335  static void keepMatchingItems(Container& items, const Predicate& pred)
336  {
337  items.erase(std::remove_if(items.begin(), items.end(), std::not1(pred)),
338  items.end());
339  }
340 
342 
343 
346 
348  template <class IdentificationType>
349  static Size countHits(const std::vector<IdentificationType>& ids)
350  {
351  Size counter = 0;
352  for (typename std::vector<IdentificationType>::const_iterator id_it =
353  ids.begin(); id_it != ids.end(); ++id_it)
354  {
355  counter += id_it->getHits().size();
356  }
357  return counter;
358  }
359 
372  template <class IdentificationType>
373  static bool getBestHit(
374  const std::vector<IdentificationType>& identifications,
375  bool assume_sorted, typename IdentificationType::HitType& best_hit)
376  {
377  if (identifications.empty()) return false;
378 
379  typename std::vector<IdentificationType>::const_iterator best_id_it =
380  identifications.end();
381  typename std::vector<typename IdentificationType::HitType>::const_iterator
382  best_hit_it;
383 
384  for (typename std::vector<IdentificationType>::const_iterator id_it =
385  identifications.begin(); id_it != identifications.end(); ++id_it)
386  {
387  if (id_it->getHits().empty()) continue;
388 
389  if (best_id_it == identifications.end()) // no previous "best" hit
390  {
391  best_id_it = id_it;
392  best_hit_it = id_it->getHits().begin();
393  }
394  else if (best_id_it->getScoreType() != id_it->getScoreType())
395  {
396  throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Can't compare scores of different types", best_id_it->getScoreType() + "/" + id_it->getScoreType());
397  }
398 
399  bool higher_better = best_id_it->isHigherScoreBetter();
400  for (typename std::vector<typename IdentificationType::HitType>::
401  const_iterator hit_it = id_it->getHits().begin(); hit_it !=
402  id_it->getHits().end(); ++hit_it)
403  {
404  if ((higher_better && (hit_it->getScore() >
405  best_hit_it->getScore())) ||
406  (!higher_better && (hit_it->getScore() <
407  best_hit_it->getScore())))
408  {
409  best_hit_it = hit_it;
410  }
411  if (assume_sorted) break; // only consider the first hit
412  }
413  }
414 
415  if (best_id_it == identifications.end())
416  {
417  return false; // no hits in any IDs
418  }
419 
420  best_hit = *best_hit_it;
421  return true;
422  }
423 
431  static void extractPeptideSequences(
432  const std::vector<PeptideIdentification>& peptides,
433  std::set<String>& sequences, bool ignore_mods = false);
434 
436 
437 
440 
442  template <class IdentificationType>
443  static void updateHitRanks(std::vector<IdentificationType>& ids)
444  {
445  for (typename std::vector<IdentificationType>::iterator it = ids.begin();
446  it != ids.end(); ++it)
447  {
448  it->assignRanks();
449  }
450  }
451 
453  static void removeUnreferencedProteins(
454  std::vector<ProteinIdentification>& proteins,
455  const std::vector<PeptideIdentification>& peptides);
456 
464  static void updateProteinReferences(
465  std::vector<PeptideIdentification>& peptides,
466  const std::vector<ProteinIdentification>& proteins,
467  bool remove_peptides_without_reference = false);
468 
477  static bool updateProteinGroups(
478  std::vector<ProteinIdentification::ProteinGroup>& groups,
479  const std::vector<ProteinHit>& hits);
480 
482 
483 
486 
488  template <class IdentificationType>
489  static void removeEmptyIdentifications(std::vector<IdentificationType>& ids)
490  {
491  struct HasNoHits<IdentificationType> empty_filter;
492  removeMatchingItems(ids, empty_filter);
493  }
494 
500  template <class IdentificationType>
501  static void filterHitsByScore(std::vector<IdentificationType>& ids,
502  double threshold_score)
503  {
504  for (typename std::vector<IdentificationType>::iterator id_it =
505  ids.begin(); id_it != ids.end(); ++id_it)
506  {
507  struct HasGoodScore<typename IdentificationType::HitType> score_filter(
508  threshold_score, id_it->isHigherScoreBetter());
509  keepMatchingItems(id_it->getHits(), score_filter);
510  }
511  }
512 
518  template <class IdentificationType>
519  static void filterHitsBySignificance(std::vector<IdentificationType>& ids,
520  double threshold_fraction = 1.0)
521  {
522  for (typename std::vector<IdentificationType>::iterator id_it =
523  ids.begin(); id_it != ids.end(); ++id_it)
524  {
525  double threshold_score = (threshold_fraction *
526  id_it->getSignificanceThreshold());
527  struct HasGoodScore<typename IdentificationType::HitType> score_filter(
528  threshold_score, id_it->isHigherScoreBetter());
529  keepMatchingItems(id_it->getHits(), score_filter);
530  }
531  }
532 
538  template <class IdentificationType>
539  static void keepNBestHits(std::vector<IdentificationType>& ids, Size n)
540  {
541  for (typename std::vector<IdentificationType>::iterator id_it =
542  ids.begin(); id_it != ids.end(); ++id_it)
543  {
544  id_it->sort();
545  if (n < id_it->getHits().size()) id_it->getHits().resize(n);
546  }
547  }
548 
563  template <class IdentificationType>
564  static void filterHitsByRank(std::vector<IdentificationType>& ids,
565  Size min_rank, Size max_rank)
566  {
567  updateHitRanks(ids);
568  if (min_rank > 1)
569  {
570  struct HasMaxRank<typename IdentificationType::HitType>
571  rank_filter(min_rank - 1);
572  for (typename std::vector<IdentificationType>::iterator id_it =
573  ids.begin(); id_it != ids.end(); ++id_it)
574  {
575  removeMatchingItems(id_it->getHits(), rank_filter);
576  }
577  }
578  if (max_rank >= min_rank)
579  {
580  struct HasMaxRank<typename IdentificationType::HitType>
581  rank_filter(max_rank);
582  for (typename std::vector<IdentificationType>::iterator id_it =
583  ids.begin(); id_it != ids.end(); ++id_it)
584  {
585  keepMatchingItems(id_it->getHits(), rank_filter);
586  }
587  }
588  }
589 
597  template <class IdentificationType>
598  static void removeDecoyHits(std::vector<IdentificationType>& ids)
599  {
600  struct HasDecoyAnnotation<typename IdentificationType::HitType>
601  decoy_filter;
602  for (typename std::vector<IdentificationType>::iterator id_it =
603  ids.begin(); id_it != ids.end(); ++id_it)
604  {
605  removeMatchingItems(id_it->getHits(), decoy_filter);
606  }
607  }
608 
616  template <class IdentificationType>
617  static void removeHitsMatchingProteins(std::vector<IdentificationType>& ids,
618  const std::set<String> accessions)
619  {
620  struct HasMatchingAccession<typename IdentificationType::HitType>
621  acc_filter(accessions);
622  for (typename std::vector<IdentificationType>::iterator id_it =
623  ids.begin(); id_it != ids.end(); ++id_it)
624  {
625  removeMatchingItems(id_it->getHits(), acc_filter);
626  }
627  }
628 
636  template <class IdentificationType>
637  static void keepHitsMatchingProteins(std::vector<IdentificationType>& ids,
638  const std::set<String> accessions)
639  {
640  struct HasMatchingAccession<typename IdentificationType::HitType>
641  acc_filter(accessions);
642  for (typename std::vector<IdentificationType>::iterator id_it =
643  ids.begin(); id_it != ids.end(); ++id_it)
644  {
645  keepMatchingItems(id_it->getHits(), acc_filter);
646  }
647  }
648 
650 
651 
654 
661  static void keepBestPeptideHits(
662  std::vector<PeptideIdentification>& peptides, bool strict = false);
663 
672  static void filterPeptidesByLength(
673  std::vector<PeptideIdentification>& peptides, Size min_length,
674  Size max_length = UINT_MAX);
675 
684  static void filterPeptidesByCharge(
685  std::vector<PeptideIdentification>& peptides, Int min_charge,
686  Int max_charge);
687 
689  static void filterPeptidesByRT(std::vector<PeptideIdentification>& peptides,
690  double min_rt, double max_rt);
691 
693  static void filterPeptidesByMZ(std::vector<PeptideIdentification>& peptides,
694  double min_mz, double max_mz);
695 
707  static void filterPeptidesByMZError(
708  std::vector<PeptideIdentification>& peptides, double mass_error,
709  bool unit_ppm);
710 
722  static void filterPeptidesByRTPredictPValue(
723  std::vector<PeptideIdentification>& peptides,
724  const String& metavalue_key, double threshold = 0.05);
725 
727  static void removePeptidesWithMatchingModifications(
728  std::vector<PeptideIdentification>& peptides,
729  const std::set<String>& modifications);
730 
732  static void keepPeptidesWithMatchingModifications(
733  std::vector<PeptideIdentification>& peptides,
734  const std::set<String>& modifications);
735 
743  static void removePeptidesWithMatchingSequences(
744  std::vector<PeptideIdentification>& peptides,
745  const std::vector<PeptideIdentification>& bad_peptides,
746  bool ignore_mods = false);
747 
755  static void keepPeptidesWithMatchingSequences(
756  std::vector<PeptideIdentification>& peptides,
757  const std::vector<PeptideIdentification>& good_peptides,
758  bool ignore_mods = false);
759 
761  static void keepUniquePeptidesPerProtein(std::vector<PeptideIdentification>&
762  peptides);
763 
769  static void removeDuplicatePeptideHits(std::vector<PeptideIdentification>&
770  peptides);
771 
773 
774 
777 
779  template <class PeakT>
780  static void filterHitsByScore(MSExperiment<PeakT>& experiment,
781  double peptide_threshold_score,
782  double protein_threshold_score)
783  {
784  // filter protein hits:
785  filterHitsByScore(experiment.getProteinIdentifications(),
786  protein_threshold_score);
787  // don't remove empty protein IDs - they contain search meta data and may
788  // be referenced by peptide IDs (via run ID)
789 
790  // filter peptide hits:
791  for (typename MSExperiment<PeakT>::Iterator exp_it = experiment.begin();
792  exp_it != experiment.end(); ++exp_it)
793  {
794  filterHitsByScore(exp_it->getPeptideIdentifications(),
795  peptide_threshold_score);
796  removeEmptyIdentifications(exp_it->getPeptideIdentifications());
797  updateProteinReferences(exp_it->getPeptideIdentifications(),
798  experiment.getProteinIdentifications());
799  }
800  // @TODO: remove proteins that aren't referenced by peptides any more?
801  }
802 
804  template <class PeakT>
806  double peptide_threshold_fraction,
807  double protein_threshold_fraction)
808  {
809  // filter protein hits:
810  filterHitsBySignificance(experiment.getProteinIdentifications(),
811  protein_threshold_fraction);
812  // don't remove empty protein IDs - they contain search meta data and may
813  // be referenced by peptide IDs (via run ID)
814 
815  // filter peptide hits:
816  for (typename MSExperiment<PeakT>::Iterator exp_it = experiment.begin();
817  exp_it != experiment.end(); ++exp_it)
818  {
819  filterHitsBySignificance(exp_it->getPeptideIdentifications(),
820  peptide_threshold_fraction);
821  removeEmptyIdentifications(exp_it->getPeptideIdentifications());
822  updateProteinReferences(exp_it->getPeptideIdentifications(),
823  experiment.getProteinIdentifications());
824  }
825  // @TODO: remove proteins that aren't referenced by peptides any more?
826  }
827 
829  template <class PeakT>
830  static void keepNBestHits(MSExperiment<PeakT>& experiment, Size n)
831  {
832  // don't filter the protein hits by "N best" here - filter the peptides
833  // and update the protein hits!
834  std::vector<PeptideIdentification> all_peptides; // IDs from all spectra
835 
836  // filter peptide hits:
837  for (typename MSExperiment<PeakT>::Iterator exp_it = experiment.begin();
838  exp_it != experiment.end(); ++exp_it)
839  {
840  std::vector<PeptideIdentification>& peptides =
841  exp_it->getPeptideIdentifications();
842  keepNBestHits(peptides, n);
843  removeEmptyIdentifications(peptides);
844  updateProteinReferences(peptides,
845  experiment.getProteinIdentifications());
846  all_peptides.insert(all_peptides.end(), peptides.begin(),
847  peptides.end());
848  }
849  // update protein hits:
850  removeUnreferencedProteins(experiment.getProteinIdentifications(),
851  all_peptides);
852  }
853 
855  template <class PeakT>
857  MSExperiment<PeakT>& experiment,
858  const std::vector<FASTAFile::FASTAEntry>& proteins)
859  {
860  std::set<String> accessions;
861  for (std::vector<FASTAFile::FASTAEntry>::const_iterator it =
862  proteins.begin(); it != proteins.end(); ++it)
863  {
864  accessions.insert(it->identifier);
865  }
866 
867  // filter protein hits:
868  keepHitsMatchingProteins(experiment.getProteinIdentifications(),
869  accessions);
870  updateHitRanks(experiment.getProteinIdentifications());
871 
872  // filter peptide hits:
873  for (typename MSExperiment<PeakT>::Iterator exp_it = experiment.begin();
874  exp_it != experiment.end(); ++exp_it)
875  {
876  if (exp_it->getMSLevel() == 2)
877  {
878  keepHitsMatchingProteins(exp_it->getPeptideIdentifications(),
879  accessions);
880  removeEmptyIdentifications(exp_it->getPeptideIdentifications());
881  updateHitRanks(exp_it->getPeptideIdentifications());
882  }
883  }
884  }
885 
887 
888  };
889 
890 } // namespace OpenMS
891 
892 #endif // OPENMS_FILTERING_ID_IDFILTER_H
Is the rank of this hit below or at the given cut-off?
Definition: IDFilter.h:117
A more convenient string class.
Definition: String.h:57
static void removeHitsMatchingProteins(std::vector< IdentificationType > &ids, const std::set< String > accessions)
Filters peptide or protein identifications according to the given proteins (negative).
Definition: IDFilter.h:617
static Size countHits(const std::vector< IdentificationType > &ids)
Returns the total number of peptide/protein hits in a vector of peptide/protein identifications.
Definition: IDFilter.h:349
static void keepHitsMatchingProteins(MSExperiment< PeakT > &experiment, const std::vector< FASTAFile::FASTAEntry > &proteins)
Filters an MS/MS experiment according to the given proteins.
Definition: IDFilter.h:856
static void filterHitsBySignificance(MSExperiment< PeakT > &experiment, double peptide_threshold_fraction, double protein_threshold_fraction)
Filters an MS/MS experiment according to fractions of the significance thresholds.
Definition: IDFilter.h:805
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:103
const std::vector< ProteinIdentification > & getProteinIdentifications() const
returns a const reference to the protein ProteinIdentification vector
HasMatchingAccession(const std::set< String > &accessions)
Definition: IDFilter.h:223
Is a meta value with given key and value set on this hit?
Definition: IDFilter.h:149
double score
Definition: IDFilter.h:94
Is this a decoy hit?
Definition: IDFilter.h:192
Is the list of hits of this peptide/protein ID empty?
Definition: IDFilter.h:293
const String & getProteinAccession() const
get the protein accession the peptide matches to. If not available the empty string is returned...
bool operator()(const IdentificationType &id) const
Definition: IDFilter.h:297
bool operator()(const HitType &hit) const
Definition: IDFilter.h:182
Iterator begin()
Definition: MSExperiment.h:149
HasMaxMetaValue(const String &key, const double &value)
Definition: IDFilter.h:178
bool operator()(const ProteinHit &hit) const
Definition: IDFilter.h:238
const std::set< String > & accessions
Definition: IDFilter.h:221
static void keepHitsMatchingProteins(std::vector< IdentificationType > &ids, const std::set< String > accessions)
Filters peptide or protein identifications according to the given proteins (positive).
Definition: IDFilter.h:637
double value
Definition: IDFilter.h:176
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
static void removeDecoyHits(std::vector< IdentificationType > &ids)
Removes hits annotated as decoys from peptide or protein identifications.
Definition: IDFilter.h:598
static void filterHitsByScore(std::vector< IdentificationType > &ids, double threshold_score)
Filters peptide or protein identifications according to the score of the hits.
Definition: IDFilter.h:501
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:57
HitType argument_type
Definition: IDFilter.h:173
Iterator end()
Definition: MSExperiment.h:159
String key
Definition: IDFilter.h:175
static void updateHitRanks(std::vector< IdentificationType > &ids)
Updates the hit ranks on all peptide or protein IDs.
Definition: IDFilter.h:443
HasMaxRank(Size rank)
Definition: IDFilter.h:123
HitType argument_type
Definition: IDFilter.h:151
A method or algorithm argument contains illegal values.
Definition: Exception.h:634
Size rank
Definition: IDFilter.h:121
static void removeMatchingItems(Container &items, const Predicate &pred)
Remove items that satisfy a condition from a container (e.g. vector)
Definition: IDFilter.h:327
bool operator()(const PeptideHit &hit) const
Definition: IDFilter.h:227
Representation of a peptide hit.
Definition: PeptideHit.h:55
HasGoodScore(double score, bool higher_score_better)
Definition: IDFilter.h:97
IdentificationType argument_type
Definition: IDFilter.h:295
HasDecoyAnnotation()
Definition: IDFilter.h:198
Is the score of this hit at least as good as the given value?
Definition: IDFilter.h:90
DataValue value
Definition: IDFilter.h:154
Representation of a peptide evidence.
Definition: PeptideEvidence.h:51
Given a list of protein accessions, do any occur in the annotation(s) of this hit?
Definition: IDFilter.h:217
HitType argument_type
Definition: IDFilter.h:194
HitType argument_type
Definition: IDFilter.h:92
Does a meta value of this hit have at most the given value?
Definition: IDFilter.h:171
bool operator()(const HitType &hit) const
Definition: IDFilter.h:202
bool isEmpty() const
test if the value is empty
Definition: DataValue.h:360
Representation of a protein hit.
Definition: ProteinHit.h:54
Invalid value exception.
Definition: Exception.h:336
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:71
bool operator()(const HitType &hit) const
Definition: IDFilter.h:160
static void keepNBestHits(MSExperiment< PeakT > &experiment, Size n)
Filters an MS/MS experiment by keeping the N best peptide hits for every spectrum.
Definition: IDFilter.h:830
static void removeEmptyIdentifications(std::vector< IdentificationType > &ids)
Removes peptide or protein identifications that have no hits in them.
Definition: IDFilter.h:489
std::set< String > extractProteinAccessions() const
extracts the set of non-empty protein accessions from peptide evidences
bool operator()(const PeptideEvidence &evidence) const
Definition: IDFilter.h:243
bool higher_score_better
Definition: IDFilter.h:95
static void filterHitsByRank(std::vector< IdentificationType > &ids, Size min_rank, Size max_rank)
Filters peptide or protein identifications according to the ranking of the hits.
Definition: IDFilter.h:564
bool operator()(const HitType &hit) const
Definition: IDFilter.h:101
String key
Definition: IDFilter.h:153
HitType argument_type
Definition: IDFilter.h:219
HitType argument_type
Definition: IDFilter.h:119
static bool getBestHit(const std::vector< IdentificationType > &identifications, bool assume_sorted, typename IdentificationType::HitType &best_hit)
Finds the best-scoring hit in a vector of peptide or protein identifications.
Definition: IDFilter.h:373
Collection of functions for filtering peptide and protein identifications.
Definition: IDFilter.h:70
HasMetaValue(const String &key, const DataValue &value)
Definition: IDFilter.h:156
bool operator()(const HitType &hit) const
Definition: IDFilter.h:132
int Int
Signed integer type.
Definition: Types.h:103
static void filterHitsByScore(MSExperiment< PeakT > &experiment, double peptide_threshold_score, double protein_threshold_score)
Filters an MS/MS experiment according to score thresholds.
Definition: IDFilter.h:780
static void keepMatchingItems(Container &items, const Predicate &pred)
Keep items that satisfy a condition in a container (e.g. vector), removing all others.
Definition: IDFilter.h:335
Not all required information provided.
Definition: Exception.h:196
const String & getAccession() const
returns the accession of the protein

OpenMS / TOPP release 2.0.0 Documentation generated on Tue Jan 31 2017 06:39:45 using doxygen 1.8.8