OpenMS  3.0.0
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-2022.
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 #pragma once
36 
37 #include <OpenMS/config.h>
48 
49 #include <algorithm>
50 #include <climits>
51 #include <vector>
52 #include <set>
53 #include <map>
54 #include <unordered_set>
55 
56 namespace OpenMS
57 {
78  class OPENMS_DLLAPI IDFilter
79  {
80 public:
81 
83  IDFilter() = default;
84 
86  virtual ~IDFilter() = default;
87 
89  typedef std::map<Int, PeptideHit*> ChargeToPepHitP;
90  typedef std::unordered_map<std::string, ChargeToPepHitP> SequenceToChargeToPepHitP;
91  typedef std::map<std::string, SequenceToChargeToPepHitP> RunToSequenceToChargeToPepHitP;
92 
98 
101  template <class HitType>
103  {
104  typedef HitType argument_type; // for use as a predicate
105 
106  double score;
108 
109  HasGoodScore(double score_, bool higher_score_better_) :
110  score(score_),
111  higher_score_better(higher_score_better_)
112  {}
113 
114  bool operator()(const HitType& hit) const
115  {
116  if (higher_score_better)
117  {
118  return hit.getScore() >= score;
119  }
120  return hit.getScore() <= score;
121  }
122  };
123 
129  template <class HitType>
130  struct HasMaxRank
131  {
132  typedef HitType argument_type; // for use as a predicate
133 
135 
136  HasMaxRank(Size rank_):
137  rank(rank_)
138  {
139  if (rank_ == 0)
140  {
141  throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "The cut-off value for rank filtering must not be zero!");
142  }
143  }
144 
145  bool operator()(const HitType& hit) const
146  {
147  Size hit_rank = hit.getRank();
148  if (hit_rank == 0)
149  {
150  throw Exception::MissingInformation(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "No rank assigned to peptide or protein hit");
151  }
152  return hit_rank <= rank;
153  }
154  };
155 
161  template <class HitType>
163  {
164  typedef HitType argument_type; // for use as a predicate
165 
168 
169  HasMetaValue(const String& key_, const DataValue& value_):
170  key(key_),
171  value(value_)
172  {}
173 
174  bool operator()(const HitType& hit) const
175  {
176  DataValue found = hit.getMetaValue(key);
177  if (found.isEmpty()) return false; // meta value "key" not set
178  if (value.isEmpty()) return true; // "key" is set, value doesn't matter
179  return found == value;
180  }
181  };
182 
184  template <class HitType>
186  {
187  typedef HitType argument_type; // for use as a predicate
188 
190  double value;
191 
192  HasMaxMetaValue(const String& key_, const double& value_):
193  key(key_),
194  value(value_)
195  {}
196 
197  bool operator()(const HitType& hit) const
198  {
199  DataValue found = hit.getMetaValue(key);
200  if (found.isEmpty()) return false; // meta value "key" not set
201  return double(found) <= value;
202  }
203  };
204 
206  template <class HitType>
208  {
209  typedef HitType argument_type; // for use as a predicate
210 
211  struct HasMetaValue<HitType> target_decoy, is_decoy;
212 
214  target_decoy("target_decoy", "decoy"), is_decoy("isDecoy", "true")
215  {}
216 
217  bool operator()(const HitType& hit) const
218  {
219  // @TODO: this could be done slightly more efficiently by returning
220  // false if the "target_decoy" meta value is "target" or "target+decoy",
221  // without checking for an "isDecoy" meta value in that case
222  return target_decoy(hit) || is_decoy(hit);
223  }
224  };
225 
231  template <class HitType>
233  {
234  typedef HitType argument_type; // for use as a predicate
235 
236  const std::unordered_set<String>& accessions;
237 
238  HasMatchingAccessionUnordered(const std::unordered_set<String>& accessions_):
239  accessions(accessions_)
240  {}
241 
242  bool operator()(const PeptideHit& hit) const
243  {
244  for (const auto& it : hit.extractProteinAccessionsSet())
245  {
246  if (accessions.count(it) > 0) return true;
247  }
248  return false;
249  }
250 
251  bool operator()(const ProteinHit& hit) const
252  {
253  return (accessions.count(hit.getAccession()) > 0);
254  }
255 
256  bool operator()(const PeptideEvidence& evidence) const
257  {
258  return (accessions.count(evidence.getProteinAccession()) > 0);
259  }
260  };
261 
267  template <class HitType>
269  {
270  typedef HitType argument_type; // for use as a predicate
271 
272  const std::set<String>& accessions;
273 
274  HasMatchingAccession(const std::set<String>& accessions_):
275  accessions(accessions_)
276  {}
277 
278  bool operator()(const PeptideHit& hit) const
279  {
280  for (const auto& it : hit.extractProteinAccessionsSet())
281  {
282  if (accessions.count(it) > 0) return true;
283  }
284  return false;
285  }
286 
287  bool operator()(const ProteinHit& hit) const
288  {
289  return (accessions.count(hit.getAccession()) > 0);
290  }
291 
292  bool operator()(const PeptideEvidence& evidence) const
293  {
294  return (accessions.count(evidence.getProteinAccession()) > 0);
295  }
296  };
297 
303  template <class HitType, class Entry>
305  {
306  typedef HitType argument_type; // for use as a predicate
307  typedef std::map<String, Entry*> ItemMap;//Store pointers to avoid copying data
309 
310  GetMatchingItems(std::vector<Entry>& records)
311  {
312  for(typename std::vector<Entry>::iterator rec_it = records.begin();
313  rec_it != records.end(); ++rec_it)
314  {
315  items[getKey(*rec_it)] = &(*rec_it);
316  }
317  }
318 
320 
321  const String& getKey(const FASTAFile::FASTAEntry& entry) const
322  {
323  return entry.identifier;
324  }
325 
326  bool exists(const HitType& hit) const
327  {
328  return items.count(getHitKey(hit)) > 0;
329  }
330 
331  const String& getHitKey(const PeptideEvidence& p) const
332  {
333  return p.getProteinAccession();
334  }
335 
336  const Entry& getValue(const PeptideEvidence& evidence) const
337  {
338  if(!exists(evidence)){
339  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Accession: '"+ getHitKey(evidence) + "'. peptide evidence accession not in data");
340  }
341  return *(items.find(getHitKey(evidence))->second);
342  }
343 
344  };
345 
347 
348 
354 
357  struct HasMinPeptideLength;
358 
360  struct HasMinCharge;
361 
363  struct HasLowMZError;
364 
370  struct HasMatchingModification;
371 
377  struct HasMatchingSequence;
378 
380  struct HasNoEvidence;
381 
382 
389  {
390  private:
394 
395  public:
398  digestion_(digestion), min_cleavages_(min), max_cleavages_(max)
399  {}
400 
401  static inline Int disabledValue(){ return -1; }
402 
405  bool operator()(PeptideHit& p) const
406  {
407  const auto& fun = [&](const Int missed_cleavages)
408  {
409 
410  bool max_filter = max_cleavages_ != disabledValue() ?
411  missed_cleavages > max_cleavages_ : false;
412  bool min_filter = min_cleavages_ != disabledValue() ?
413  missed_cleavages < min_cleavages_ : false;
414  return max_filter || min_filter;
415  };
416  return digestion_.filterByMissedCleavages(
418  fun);
419  }
420 
421  void filterPeptideSequences(std::vector<PeptideHit>& hits)
422  {
423  hits.erase(std::remove_if(hits.begin(), hits.end(), (*this)),
424  hits.end());
425  }
426 
427  };
428 
429 
436  {
438 
439  // Build an accession index to avoid the linear search cost
444 
445  DigestionFilter(std::vector<FASTAFile::FASTAEntry>& entries,
446  ProteaseDigestion& digestion,
447  bool ignore_missed_cleavages,
448  bool methionine_cleavage) :
449  accession_resolver_(entries),
450  digestion_(digestion),
451  ignore_missed_cleavages_(ignore_missed_cleavages),
452  methionine_cleavage_(methionine_cleavage)
453  {}
454 
455  bool operator()(const PeptideEvidence& evidence) const
456  {
457  if(!evidence.hasValidLimits())
458  {
459  OPENMS_LOG_WARN << "Invalid limits! Peptide '" << evidence.getProteinAccession() << "' not filtered" << std::endl;
460  return true;
461  }
462 
463  if (accession_resolver_.exists(evidence))
464  {
465  return digestion_.isValidProduct(
466  AASequence::fromString(accession_resolver_.getValue(evidence).sequence),
467  evidence.getStart(), evidence.getEnd() - evidence.getStart(), ignore_missed_cleavages_, methionine_cleavage_);
468  }
469  else
470  {
471  if (evidence.getProteinAccession().empty())
472  {
473  OPENMS_LOG_WARN << "Peptide accession not available! Skipping Evidence." << std::endl;
474  }
475  else
476  {
477  OPENMS_LOG_WARN << "Peptide accession '" << evidence.getProteinAccession()
478  << "' not found in fasta file!" << std::endl;
479  }
480  return true;
481  }
482  }
483 
484  void filterPeptideEvidences(std::vector<PeptideIdentification>& peptides)
485  {
486  IDFilter::FilterPeptideEvidences<IDFilter::DigestionFilter>(*this,peptides);
487  }
488 
489  };
490 
492 
493 
496 
498  template <class IdentificationType>
499  struct HasNoHits
500  {
501  typedef IdentificationType argument_type; // for use as a predicate
502 
503  bool operator()(const IdentificationType& id) const
504  {
505  return id.getHits().empty();
506  }
507  };
508 
510 
511 
514 
516  struct HasRTInRange;
517 
519  struct HasMZInRange;
520 
522 
523 
529 
532  template <class Container, class Predicate>
533  static void removeMatchingItems(Container& items, const Predicate& pred)
534  {
535  items.erase(std::remove_if(items.begin(), items.end(), pred),
536  items.end());
537  }
538 
540  template <class Container, class Predicate>
541  static void keepMatchingItems(Container& items, const Predicate& pred)
542  {
543  items.erase(std::remove_if(items.begin(), items.end(), std::not1(pred)),
544  items.end());
545  }
546 
548  template <class Container, class Predicate>
549  static void moveMatchingItems(Container& items, const Predicate& pred, Container& target)
550  {
551  auto part = std::partition(items.begin(), items.end(), std::not1(pred));
552  std::move(part, items.end(), std::back_inserter(target));
553  items.erase(part, items.end());
554  }
555 
557  template <class IDContainer, class Predicate>
558  static void removeMatchingItemsUnroll(IDContainer& items, const Predicate& pred)
559  {
560  for (auto& item : items)
561  {
562  removeMatchingItems(item.getHits(), pred);
563  }
564  }
565 
567  template <class IDContainer, class Predicate>
568  static void keepMatchingItemsUnroll(IDContainer& items, const Predicate& pred)
569  {
570  for (auto& item : items)
571  {
572  keepMatchingItems(item.getHits(), pred);
573  }
574  }
575 
576  template <class MapType, class Predicate>
577  static void keepMatchingPeptideHits(MapType& prot_and_pep_ids, Predicate& pred)
578  {
579  for (auto& feat : prot_and_pep_ids)
580  {
581  keepMatchingItemsUnroll(feat.getPeptideIdentifications(), pred);
582  }
583  keepMatchingItemsUnroll(prot_and_pep_ids.getUnassignedPeptideIdentifications(), pred);
584  }
585 
586  template <class MapType, class Predicate>
587  static void removeMatchingPeptideHits(MapType& prot_and_pep_ids, Predicate& pred)
588  {
589  for (auto& feat : prot_and_pep_ids)
590  {
591  removeMatchingItemsUnroll(feat.getPeptideIdentifications(), pred);
592  }
593  removeMatchingItemsUnroll(prot_and_pep_ids.getUnassignedPeptideIdentifications(), pred);
594  }
595 
596  template <class MapType, class Predicate>
597  static void removeMatchingPeptideIdentifications(MapType& prot_and_pep_ids, Predicate& pred)
598  {
599  for (auto& feat : prot_and_pep_ids)
600  {
601  removeMatchingItems(feat.getPeptideIdentifications(), pred);
602  }
603  removeMatchingItems(prot_and_pep_ids.getUnassignedPeptideIdentifications(), pred);
604  }
605 
607 
608 
611 
613  template <class IdentificationType>
614  static Size countHits(const std::vector<IdentificationType>& ids)
615  {
616  Size counter = 0;
617  for (typename std::vector<IdentificationType>::const_iterator id_it =
618  ids.begin(); id_it != ids.end(); ++id_it)
619  {
620  counter += id_it->getHits().size();
621  }
622  return counter;
623  }
624 
638  template <class IdentificationType>
639  static bool getBestHit(
640  const std::vector<IdentificationType>& identifications,
641  bool assume_sorted, typename IdentificationType::HitType& best_hit)
642  {
643  if (identifications.empty()) return false;
644 
645  typename std::vector<IdentificationType>::const_iterator best_id_it =
646  identifications.end();
647  typename std::vector<typename IdentificationType::HitType>::const_iterator
648  best_hit_it;
649 
650  for (typename std::vector<IdentificationType>::const_iterator id_it =
651  identifications.begin(); id_it != identifications.end(); ++id_it)
652  {
653  if (id_it->getHits().empty()) continue;
654 
655  if (best_id_it == identifications.end()) // no previous "best" hit
656  {
657  best_id_it = id_it;
658  best_hit_it = id_it->getHits().begin();
659  }
660  else if (best_id_it->getScoreType() != id_it->getScoreType())
661  {
662  throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Can't compare scores of different types", best_id_it->getScoreType() + "/" + id_it->getScoreType());
663  }
664 
665  bool higher_better = best_id_it->isHigherScoreBetter();
666  for (typename std::vector<typename IdentificationType::HitType>::
667  const_iterator hit_it = id_it->getHits().begin(); hit_it !=
668  id_it->getHits().end(); ++hit_it)
669  {
670  if ((higher_better && (hit_it->getScore() >
671  best_hit_it->getScore())) ||
672  (!higher_better && (hit_it->getScore() <
673  best_hit_it->getScore())))
674  {
675  best_hit_it = hit_it;
676  }
677  if (assume_sorted) break; // only consider the first hit
678  }
679  }
680 
681  if (best_id_it == identifications.end())
682  {
683  return false; // no hits in any IDs
684  }
685 
686  best_hit = *best_hit_it;
687  return true;
688  }
689 
697  static void extractPeptideSequences(
698  const std::vector<PeptideIdentification>& peptides,
699  std::set<String>& sequences, bool ignore_mods = false);
700 
706  static std::map<String,std::vector<ProteinHit>> extractUnassignedProteins(ConsensusMap& cmap);
707 
713  template<class EvidenceFilter>
715  EvidenceFilter& filter,
716  std::vector<PeptideIdentification>& peptides)
717  {
718  for(std::vector<PeptideIdentification>::iterator pep_it = peptides.begin();
719  pep_it != peptides.end(); ++pep_it)
720  {
721  for(std::vector<PeptideHit>::iterator hit_it = pep_it->getHits().begin();
722  hit_it != pep_it->getHits().end(); ++hit_it )
723  {
724  std::vector<PeptideEvidence> evidences;
725  remove_copy_if(hit_it->getPeptideEvidences().begin(),
726  hit_it->getPeptideEvidences().end(),
727  back_inserter(evidences),
728  std::not1(filter));
729  hit_it->setPeptideEvidences(evidences);
730  }
731  }
732  }
733 
735 
736 
739 
741  template <class IdentificationType>
742  static void updateHitRanks(std::vector<IdentificationType>& ids)
743  {
744  for (typename std::vector<IdentificationType>::iterator it = ids.begin();
745  it != ids.end(); ++it)
746  {
747  it->assignRanks();
748  }
749  }
750 
753  static void removeUnreferencedProteins(ConsensusMap& cmap, bool include_unassigned);
754 
756  static void removeUnreferencedProteins(
757  std::vector<ProteinIdentification>& proteins,
758  const std::vector<PeptideIdentification>& peptides);
760  static void removeUnreferencedProteins(
761  ProteinIdentification& proteins,
762  const std::vector<PeptideIdentification>& peptides);
763 
771  static void updateProteinReferences(
772  std::vector<PeptideIdentification>& peptides,
773  const std::vector<ProteinIdentification>& proteins,
774  bool remove_peptides_without_reference = false);
775 
783  static void updateProteinReferences(
784  ConsensusMap& cmap,
785  bool remove_peptides_without_reference = false);
786 
794  static void updateProteinReferences(
795  ConsensusMap& cmap,
796  const ProteinIdentification& ref_run,
797  bool remove_peptides_without_reference = false);
798 
807  static bool updateProteinGroups(
808  std::vector<ProteinIdentification::ProteinGroup>& groups,
809  const std::vector<ProteinHit>& hits);
810 
817  static void removeUngroupedProteins(
818  const std::vector<ProteinIdentification::ProteinGroup>& groups,
819  std::vector<ProteinHit>& hits);
821 
822 
825 
827  template <class IdentificationType>
828  static void removeEmptyIdentifications(std::vector<IdentificationType>& ids)
829  {
830  struct HasNoHits<IdentificationType> empty_filter;
831  removeMatchingItems(ids, empty_filter);
832  }
833 
839  template <class IdentificationType>
840  static void filterHitsByScore(std::vector<IdentificationType>& ids,
841  double threshold_score)
842  {
843  for (typename std::vector<IdentificationType>::iterator id_it =
844  ids.begin(); id_it != ids.end(); ++id_it)
845  {
846  struct HasGoodScore<typename IdentificationType::HitType> score_filter(
847  threshold_score, id_it->isHigherScoreBetter());
848  keepMatchingItems(id_it->getHits(), score_filter);
849  }
850  }
851 
858  static void filterGroupsByScore(std::vector<ProteinIdentification::ProteinGroup>& grps,
859  double threshold_score, bool higher_better);
860 
866  template <class IdentificationType>
867  static void filterHitsByScore(IdentificationType& id,
868  double threshold_score)
869  {
870  struct HasGoodScore<typename IdentificationType::HitType> score_filter(
871  threshold_score, id->isHigherScoreBetter());
872  keepMatchingItems(id->getHits(), score_filter);
873  }
874 
880  template <class IdentificationType>
881  static void keepNBestHits(std::vector<IdentificationType>& ids, Size n)
882  {
883  for (typename std::vector<IdentificationType>::iterator id_it =
884  ids.begin(); id_it != ids.end(); ++id_it)
885  {
886  id_it->sort();
887  if (n < id_it->getHits().size()) id_it->getHits().resize(n);
888  }
889  }
890 
905  template <class IdentificationType>
906  static void filterHitsByRank(std::vector<IdentificationType>& ids,
907  Size min_rank, Size max_rank)
908  {
909  updateHitRanks(ids);
910  if (min_rank > 1)
911  {
912  struct HasMaxRank<typename IdentificationType::HitType>
913  rank_filter(min_rank - 1);
914  for (typename std::vector<IdentificationType>::iterator id_it =
915  ids.begin(); id_it != ids.end(); ++id_it)
916  {
917  removeMatchingItems(id_it->getHits(), rank_filter);
918  }
919  }
920  if (max_rank >= min_rank)
921  {
922  struct HasMaxRank<typename IdentificationType::HitType>
923  rank_filter(max_rank);
924  for (typename std::vector<IdentificationType>::iterator id_it =
925  ids.begin(); id_it != ids.end(); ++id_it)
926  {
927  keepMatchingItems(id_it->getHits(), rank_filter);
928  }
929  }
930  }
931 
939  template <class IdentificationType>
940  static void removeDecoyHits(std::vector<IdentificationType>& ids)
941  {
942  struct HasDecoyAnnotation<typename IdentificationType::HitType>
943  decoy_filter;
944  for (typename std::vector<IdentificationType>::iterator id_it =
945  ids.begin(); id_it != ids.end(); ++id_it)
946  {
947  removeMatchingItems(id_it->getHits(), decoy_filter);
948  }
949  }
950 
958  template <class IdentificationType>
959  static void removeHitsMatchingProteins(std::vector<IdentificationType>& ids,
960  const std::set<String> accessions)
961  {
962  struct HasMatchingAccession<typename IdentificationType::HitType> acc_filter(accessions);
963  for (auto& id_it : ids)
964  {
965  removeMatchingItems(id_it.getHits(), acc_filter);
966  }
967  }
968 
976  template <class IdentificationType>
977  static void keepHitsMatchingProteins(std::vector<IdentificationType>& ids,
978  const std::set<String>& accessions)
979  {
980  struct HasMatchingAccession<typename IdentificationType::HitType> acc_filter(accessions);
981  for (auto& id_it : ids)
982  {
983  keepMatchingItems(id_it.getHits(), acc_filter);
984  }
985  }
986 
988 
989 
992 
999  static void keepBestPeptideHits(
1000  std::vector<PeptideIdentification>& peptides, bool strict = false);
1001 
1010  static void filterPeptidesByLength(
1011  std::vector<PeptideIdentification>& peptides, Size min_length,
1012  Size max_length = UINT_MAX);
1013 
1022  static void filterPeptidesByCharge(
1023  std::vector<PeptideIdentification>& peptides, Int min_charge,
1024  Int max_charge);
1025 
1027  static void filterPeptidesByRT(std::vector<PeptideIdentification>& peptides,
1028  double min_rt, double max_rt);
1029 
1031  static void filterPeptidesByMZ(std::vector<PeptideIdentification>& peptides,
1032  double min_mz, double max_mz);
1033 
1045  static void filterPeptidesByMZError(
1046  std::vector<PeptideIdentification>& peptides, double mass_error,
1047  bool unit_ppm);
1048 
1049 
1056  template <class Filter>
1057  static void filterPeptideEvidences(
1058  Filter& filter,
1059  std::vector<PeptideIdentification>& peptides);
1060 
1072  static void filterPeptidesByRTPredictPValue(
1073  std::vector<PeptideIdentification>& peptides,
1074  const String& metavalue_key, double threshold = 0.05);
1075 
1077  static void removePeptidesWithMatchingModifications(
1078  std::vector<PeptideIdentification>& peptides,
1079  const std::set<String>& modifications);
1080 
1081  static void removePeptidesWithMatchingRegEx(
1082  std::vector<PeptideIdentification>& peptides,
1083  const String& regex);
1084 
1086  static void keepPeptidesWithMatchingModifications(
1087  std::vector<PeptideIdentification>& peptides,
1088  const std::set<String>& modifications);
1089 
1097  static void removePeptidesWithMatchingSequences(
1098  std::vector<PeptideIdentification>& peptides,
1099  const std::vector<PeptideIdentification>& bad_peptides,
1100  bool ignore_mods = false);
1101 
1109  static void keepPeptidesWithMatchingSequences(
1110  std::vector<PeptideIdentification>& peptides,
1111  const std::vector<PeptideIdentification>& good_peptides,
1112  bool ignore_mods = false);
1113 
1115  static void keepUniquePeptidesPerProtein(std::vector<PeptideIdentification>&
1116  peptides);
1117 
1123  static void removeDuplicatePeptideHits(std::vector<PeptideIdentification>&
1124  peptides, bool seq_only = false);
1125 
1127 
1128 
1131 
1133  static void filterHitsByScore(PeakMap& experiment,
1134  double peptide_threshold_score,
1135  double protein_threshold_score)
1136  {
1137  // filter protein hits:
1138  filterHitsByScore(experiment.getProteinIdentifications(),
1139  protein_threshold_score);
1140  // don't remove empty protein IDs - they contain search meta data and may
1141  // be referenced by peptide IDs (via run ID)
1142 
1143  // filter peptide hits:
1144  for (PeakMap::Iterator exp_it = experiment.begin();
1145  exp_it != experiment.end(); ++exp_it)
1146  {
1147  filterHitsByScore(exp_it->getPeptideIdentifications(),
1148  peptide_threshold_score);
1149  removeEmptyIdentifications(exp_it->getPeptideIdentifications());
1150  updateProteinReferences(exp_it->getPeptideIdentifications(),
1151  experiment.getProteinIdentifications());
1152  }
1153  // @TODO: remove proteins that aren't referenced by peptides any more?
1154  }
1155 
1157  static void keepNBestHits(PeakMap& experiment, Size n)
1158  {
1159  // don't filter the protein hits by "N best" here - filter the peptides
1160  // and update the protein hits!
1161  std::vector<PeptideIdentification> all_peptides; // IDs from all spectra
1162 
1163  // filter peptide hits:
1164  for (PeakMap::Iterator exp_it = experiment.begin();
1165  exp_it != experiment.end(); ++exp_it)
1166  {
1167  std::vector<PeptideIdentification>& peptides =
1168  exp_it->getPeptideIdentifications();
1169  keepNBestHits(peptides, n);
1170  removeEmptyIdentifications(peptides);
1171  updateProteinReferences(peptides,
1172  experiment.getProteinIdentifications());
1173  all_peptides.insert(all_peptides.end(), peptides.begin(),
1174  peptides.end());
1175  }
1176  // update protein hits:
1177  removeUnreferencedProteins(experiment.getProteinIdentifications(),
1178  all_peptides);
1179  }
1180 
1183  static void keepNBestSpectra(std::vector<PeptideIdentification>& peptides, Size n);
1184 
1186  template <class MapType>
1187  static void keepNBestPeptideHits(MapType& map, Size n)
1188  {
1189  // The rank predicate needs annotated ranks, not sure if they are always updated. Use the following instead,
1190  // which sorts Hits first.
1191  for (auto& feat : map)
1192  {
1193  keepNBestHits(feat.getPeptideIdentifications(), n);
1194  }
1195  keepNBestHits(map.getUnassignedPeptideIdentifications(), n);
1196  }
1197 
1198  template <class MapType>
1199  static void removeEmptyIdentifications(MapType& prot_and_pep_ids)
1200  {
1201  const auto pred = HasNoHits<PeptideIdentification>();
1202  removeMatchingPeptideIdentifications(prot_and_pep_ids, pred);
1203  }
1204 
1206  static void keepBestPerPeptide(std::vector<PeptideIdentification>& pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
1207  {
1208  annotateBestPerPeptide(pep_ids, ignore_mods, ignore_charges, nr_best_spectrum);
1209  HasMetaValue<PeptideHit> best_per_peptide{"best_per_peptide", 1};
1210  keepMatchingItemsUnroll(pep_ids, best_per_peptide);
1211  }
1212 
1213  static void keepBestPerPeptidePerRun(std::vector<ProteinIdentification>& prot_ids, std::vector<PeptideIdentification>& pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
1214  {
1215  annotateBestPerPeptidePerRun(prot_ids, pep_ids, ignore_mods, ignore_charges, nr_best_spectrum);
1216  HasMetaValue<PeptideHit> best_per_peptide{"best_per_peptide", 1};
1217  keepMatchingItemsUnroll(pep_ids, best_per_peptide);
1218  }
1219 
1220  //TODO allow skipping unassigned?
1221  template <class MapType>
1222  static void annotateBestPerPeptidePerRun(MapType& prot_and_pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
1223  {
1224  const auto& prot_ids = prot_and_pep_ids.getProteinIdentifications();
1225 
1226  RunToSequenceToChargeToPepHitP best_peps_per_run;
1227  for (const auto& idrun : prot_ids)
1228  {
1229  best_peps_per_run[idrun.getIdentifier()] = SequenceToChargeToPepHitP();
1230  }
1231 
1232  for (auto& feat : prot_and_pep_ids)
1233  {
1234  annotateBestPerPeptidePerRunWithData(best_peps_per_run, feat.getPeptideIdentifications(), ignore_mods, ignore_charges, nr_best_spectrum);
1235  }
1236 
1237  annotateBestPerPeptidePerRunWithData(best_peps_per_run, prot_and_pep_ids.getUnassignedPeptideIdentifications(), ignore_mods, ignore_charges, nr_best_spectrum);
1238  }
1239 
1240  template <class MapType>
1241  static void keepBestPerPeptidePerRun(MapType& prot_and_pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
1242  {
1243  annotateBestPerPeptidePerRun(prot_and_pep_ids, ignore_mods, ignore_charges, nr_best_spectrum);
1244  HasMetaValue<PeptideHit> best_per_peptide{"best_per_peptide", 1};
1245  keepMatchingPeptideHits(prot_and_pep_ids, best_per_peptide);
1246  }
1247 
1250  static void annotateBestPerPeptidePerRun(const std::vector<ProteinIdentification>& prot_ids, std::vector<PeptideIdentification>& pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
1251  {
1252  RunToSequenceToChargeToPepHitP best_peps_per_run;
1253  for (const auto& id : prot_ids)
1254  {
1255  best_peps_per_run[id.getIdentifier()] = SequenceToChargeToPepHitP();
1256  }
1257  annotateBestPerPeptidePerRunWithData(best_peps_per_run, pep_ids, ignore_mods, ignore_charges, nr_best_spectrum);
1258  }
1259 
1263  static void annotateBestPerPeptidePerRunWithData(RunToSequenceToChargeToPepHitP& best_peps_per_run, std::vector<PeptideIdentification>& pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
1264  {
1265  for (auto &pep : pep_ids)
1266  {
1267  SequenceToChargeToPepHitP& best_pep = best_peps_per_run[pep.getIdentifier()];
1268  annotateBestPerPeptideWithData(best_pep, pep, ignore_mods, ignore_charges, nr_best_spectrum);
1269  }
1270  }
1271 
1275  static void annotateBestPerPeptide(std::vector<PeptideIdentification>& pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
1276  {
1277  SequenceToChargeToPepHitP best_pep;
1278  for (auto& pep : pep_ids)
1279  {
1280  annotateBestPerPeptideWithData(best_pep, pep, ignore_mods, ignore_charges, nr_best_spectrum);
1281  }
1282  }
1283 
1288  static void annotateBestPerPeptideWithData(SequenceToChargeToPepHitP& best_pep, PeptideIdentification& pep, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
1289  {
1290  bool higher_score_better = pep.isHigherScoreBetter();
1291  //make sure that first = best hit
1292  pep.sort();
1293 
1294  auto pepIt = pep.getHits().begin();
1295  auto pepItEnd = nr_best_spectrum == 0 || pep.getHits().size() <= nr_best_spectrum ? pep.getHits().end() : pep.getHits().begin() + nr_best_spectrum;
1296  for (; pepIt != pepItEnd; ++pepIt)
1297  {
1298  PeptideHit &hit = *pepIt;
1299 
1300  String lookup_seq;
1301  if (ignore_mods)
1302  {
1303  lookup_seq = hit.getSequence().toUnmodifiedString();
1304  }
1305  else
1306  {
1307  lookup_seq = hit.getSequence().toString();
1308  }
1309 
1310  int lookup_charge = 0;
1311  if (!ignore_charges)
1312  {
1313  lookup_charge = hit.getCharge();
1314  }
1315 
1316  // try to insert
1317  auto it_inserted = best_pep.emplace(std::move(lookup_seq), ChargeToPepHitP());
1318  auto it_inserted_chg = it_inserted.first->second.emplace(lookup_charge, &hit);
1319 
1320  PeptideHit* &p = it_inserted_chg.first->second; //now this gets either the old one if already present, or this
1321  if (!it_inserted_chg.second) //was already present -> possibly update
1322  {
1323  if (
1324  (higher_score_better && (hit.getScore() > p->getScore())) ||
1325  (!higher_score_better && (hit.getScore() < p->getScore()))
1326  )
1327  {
1328  p->setMetaValue("best_per_peptide", 0);
1329  hit.setMetaValue("best_per_peptide", 1);
1330  p = &hit;
1331  }
1332  else //note that this was def. not the best
1333  {
1334  // TODO if it is only about filtering, we can omit writing this metavalue (absence = false)
1335  hit.setMetaValue("best_per_peptide", 0);
1336  }
1337  }
1338  else //newly inserted -> first for that sequence (and optionally charge)
1339  {
1340  hit.setMetaValue("best_per_peptide", 1);
1341  }
1342  }
1343  }
1344 
1347  PeakMap& experiment,
1348  const std::vector<FASTAFile::FASTAEntry>& proteins)
1349  {
1350  std::set<String> accessions;
1351  for (std::vector<FASTAFile::FASTAEntry>::const_iterator it =
1352  proteins.begin(); it != proteins.end(); ++it)
1353  {
1354  accessions.insert(it->identifier);
1355  }
1356 
1357  // filter protein hits:
1358  keepHitsMatchingProteins(experiment.getProteinIdentifications(),
1359  accessions);
1360  updateHitRanks(experiment.getProteinIdentifications());
1361 
1362  // filter peptide hits:
1363  for (PeakMap::Iterator exp_it = experiment.begin();
1364  exp_it != experiment.end(); ++exp_it)
1365  {
1366  if (exp_it->getMSLevel() == 2)
1367  {
1368  keepHitsMatchingProteins(exp_it->getPeptideIdentifications(),
1369  accessions);
1370  removeEmptyIdentifications(exp_it->getPeptideIdentifications());
1371  updateHitRanks(exp_it->getPeptideIdentifications());
1372  }
1373  }
1374  }
1375 
1377 
1378 
1381 
1391  template <typename PredicateType>
1393  IdentificationData& id_data, PredicateType&& func, bool cleanup_affected = false)
1394  {
1395  id_data.removeFromSetIf_(id_data.observation_matches_, func);
1396  if (cleanup_affected) id_data.cleanup();
1397  }
1398 
1409  static void keepBestMatchPerObservation(
1410  IdentificationData& id_data,
1412 
1424  static void filterObservationMatchesByScore(
1425  IdentificationData& id_data,
1426  IdentificationData::ScoreTypeRef score_ref, double cutoff);
1427 
1433  static void removeDecoys(IdentificationData& id_data);
1435 
1436  };
1437 
1438 } // namespace OpenMS
LogStream.h
OpenMS::FileTypes::IDXML
OpenMS identification format (.idXML)
Definition: FileTypes.h:64
OpenMS::StringUtils::split
static bool split(const String &this_s, const char splitter, std::vector< String > &substrings, bool quote_protect)
Definition: StringUtilsSimple.h:360
OpenMS::PeptideHit::getCharge
Int getCharge() const
returns the charge of the peptide
OpenMS::IDFilter::HasGoodScore::HasGoodScore
HasGoodScore(double score_, bool higher_score_better_)
Definition: IDFilter.h:109
ConsensusXMLFile.h
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:147
OpenMS::MzIdentMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &poid, const std::vector< PeptideIdentification > &peid) const
Stores the identifications in a MzIdentML file.
OpenMS::ProtXMLFile
Used to load (storing not supported, yet) ProtXML files.
Definition: ProtXMLFile.h:70
OpenMS::IDFilter::removeMatchingItems
static void removeMatchingItems(Container &items, const Predicate &pred)
Remove items that satisfy a condition from a container (e.g. vector)
Definition: IDFilter.h:533
OpenMS::SequestOutfile
Representation of a Sequest output file.
Definition: SequestOutfile.h:61
OpenMS::TextFile::end
ConstIterator end() const
Gives access to the underlying text buffer.
OpenMS::DataValue::INT_LIST
integer list
Definition: DataValue.h:73
OpenMS::XTandemXMLFile::load
void load(const String &filename, ProteinIdentification &protein_identification, std::vector< PeptideIdentification > &id_data, ModificationDefinitionsSet &mod_def_set)
loads data from an X! Tandem XML file
FileHandler.h
OpenMS::MascotXMLFile
Used to load Mascot XML files.
Definition: MascotXMLFile.h:57
FileTypes.h
TextFile.h
OpenMS::EnzymaticDigestion::NamesOfSpecificity
static const std::string NamesOfSpecificity[SIZE_OF_SPECIFICITY]
Names of the Specificity.
Definition: EnzymaticDigestion.h:81
OpenMS::SpectrumMetaDataLookup::addMissingSpectrumReferences
static bool addMissingSpectrumReferences(std::vector< PeptideIdentification > &peptides, const String &filename, bool stop_on_error=false, bool override_spectra_data=false, bool override_spectra_references=false, std::vector< ProteinIdentification > proteins=std::vector< ProteinIdentification >())
Add missing "spectrum_reference"s to peptide identifications based on raw data.
IDRipper.h
Size
OpenMS::PercolatorOutfile::SIZE_OF_SCORETYPE
Definition: PercolatorOutfile.h:58
OpenMS::IDFilter::keepUniquePeptidesPerProtein
static void keepUniquePeptidesPerProtein(std::vector< PeptideIdentification > &peptides)
Removes all peptides that are not annotated as unique for a protein (by PeptideIndexer)
OpenMS::IDFilter::keepBestPerPeptidePerRun
static void keepBestPerPeptidePerRun(MapType &prot_and_pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
Definition: IDFilter.h:1241
OpenMS::IDFilter::keepNBestSpectra
static void keepNBestSpectra(std::vector< PeptideIdentification > &peptides, Size n)
XQuestResultXMLFile.h
OpenMS::OMSFile
This class supports reading and writing of OMS files.
Definition: OMSFile.h:48
double
OpenMS::ProtXMLFile::load
void load(const String &filename, ProteinIdentification &protein_ids, PeptideIdentification &peptide_ids)
Loads the identifications of an ProtXML file without identifier.
OpenMS::ConsensusXMLFile::store
void store(const String &filename, const ConsensusMap &consensus_map)
Stores a consensus map to file.
OpenMS::toString
const std::string & toString(const DriftTimeUnit value)
IdentificationDataConverter.h
OpenMS::IDFilter::PeptideDigestionFilter::digestion_
EnzymaticDigestion & digestion_
Definition: IDFilter.h:391
OpenMS::Param::setValue
void setValue(const std::string &key, const ParamValue &value, const std::string &description="", const std::vector< std::string > &tags=std::vector< std::string >())
Sets a value.
OpenMS::IDFilter::keepNBestHits
static void keepNBestHits(std::vector< IdentificationType > &ids, Size n)
Filters peptide or protein identifications according to the score of the hits, keeping the n best hit...
Definition: IDFilter.h:881
OpenMS::Exception::IllegalArgument
A method or algorithm argument contains illegal values.
Definition: Exception.h:648
OpenMS::Math::RandomShuffler
Definition: MathFunctions.h:363
OpenMS::DataValue::STRING_VALUE
string value
Definition: DataValue.h:69
OpenMS::IdXMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &protein_ids, const std::vector< PeptideIdentification > &peptide_ids, const String &document_id="")
Stores the data in an idXML file.
OpenMS::PercolatorOutfile::score_type_names
static const std::string score_type_names[SIZE_OF_SCORETYPE]
Names of Percolator scores (to match ScoreType)
Definition: PercolatorOutfile.h:61
ProtXMLFile.h
OpenMS::PeptideHit::getSequence
const AASequence & getSequence() const
returns the peptide sequence without trailing or following spaces
OpenMS::IDFilter::HasMaxRank::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:145
OpenMS::ProteaseDigestion::setEnzyme
void setEnzyme(const String &name)
Sets the enzyme for the digestion (by name)
OpenMS::IDFilter::moveMatchingItems
static void moveMatchingItems(Container &items, const Predicate &pred, Container &target)
Move items that satisfy a condition to a container (e.g. vector)
Definition: IDFilter.h:549
EnzymaticDigestion.h
OpenMS::IDFilter::HasGoodScore::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:114
OpenMS::IDFilter::HasNoHits::argument_type
IdentificationType argument_type
Definition: IDFilter.h:501
MascotXMLFile.h
OpenMS::IDFilter::keepHitsMatchingProteins
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:977
OpenMS::IDFilter::HasMaxMetaValue::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:197
OpenMS::IDFilter::HasGoodScore::score
double score
Definition: IDFilter.h:106
OpenMS::FASTAFile::FASTAEntry::identifier
String identifier
Definition: FASTAFile.h:73
OpenMS::DigestionEnzymeDB::getInstance
static InstanceType * getInstance()
this member function serves as a replacement of the constructor
Definition: DigestionEnzymeDB.h:69
OpenMS::Exception::InvalidSize
Invalid UInt exception.
Definition: Exception.h:295
OpenMS::ModificationDefinitionsSet
Representation of a set of modification definitions.
Definition: ModificationDefinitionsSet.h:58
OpenMS::IDFilter::removeHitsMatchingProteins
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:959
OpenMS::IDFilter::GetMatchingItems::getHitKey
const String & getHitKey(const PeptideEvidence &p) const
Definition: IDFilter.h:331
OpenMS::Exception::InvalidValue
Invalid value exception.
Definition: Exception.h:327
OpenMS::IDFilter::PeptideDigestionFilter::operator()
bool operator()(PeptideHit &p) const
Definition: IDFilter.h:405
OpenMS::FASTAFile
This class serves for reading in and writing FASTA files If the protein/gene sequence contains unusua...
Definition: FASTAFile.h:60
OpenMS::FileHandler::getTypeByFileName
static FileTypes::Type getTypeByFileName(const String &filename)
Determines the file type from a file name.
OpenMS::MzMLFile::store
void store(const String &filename, const PeakMap &map) const
Stores a map in an MzML file.
OpenMS::IDFilter::filterPeptidesByMZ
static void filterPeptidesByMZ(std::vector< PeptideIdentification > &peptides, double min_mz, double max_mz)
Filters peptide identifications by precursor m/z, keeping only IDs in the given range.
OpenMS::String::toDouble
double toDouble() const
Conversion to double.
OpenMS::Constants::k
const double k
Definition: Constants.h:153
OpenMS::FileTypes::MZML
MzML file (.mzML)
Definition: FileTypes.h:70
OpenMS::FASTAFile::FASTAEntry::sequence
String sequence
Definition: FASTAFile.h:75
OpenMS::FileTypes::PEPXML
TPP pepXML file (.pepXML)
Definition: FileTypes.h:73
OpenMS::DataValue::STRING_LIST
string list
Definition: DataValue.h:72
OpenMS::ProteinIdentification::setSearchEngineVersion
void setSearchEngineVersion(const String &search_engine_version)
Sets the search engine version.
OpenMS::XQuestResultXMLFile::load
void load(const String &filename, std::vector< PeptideIdentification > &pep_ids, std::vector< ProteinIdentification > &prot_ids)
Load the content of the xquest.xml file into the provided data structures.
OpenMS::MzMLFile
File adapter for MzML files.
Definition: MzMLFile.h:57
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::MSExperiment::begin
Iterator begin()
Definition: MSExperiment.h:150
OpenMS::IDFilter::PeptideDigestionFilter::argument_type
PeptideHit argument_type
Definition: IDFilter.h:396
OpenMS::IDFilter::RunToSequenceToChargeToPepHitP
std::map< std::string, SequenceToChargeToPepHitP > RunToSequenceToChargeToPepHitP
Definition: IDFilter.h:91
OpenMS::IDFilter::HasMaxMetaValue
Does a meta value of this hit have at most the given value?
Definition: IDFilter.h:185
OpenMS::IDFilter::GetMatchingItems::exists
bool exists(const HitType &hit) const
Definition: IDFilter.h:326
OpenMS::EnzymaticDigestion
Class for the enzymatic digestion of sequences.
Definition: EnzymaticDigestion.h:66
OpenMS::String::trim
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
OpenMS::DataValue::isEmpty
bool isEmpty() const
Test if the value is empty.
Definition: DataValue.h:388
MzMLFile.h
OpenMS::OMSSAXMLFile
Used to load OMSSAXML files.
Definition: OMSSAXMLFile.h:59
Int
OpenMS::IDFilter::HasMetaValue::HasMetaValue
HasMetaValue(const String &key_, const DataValue &value_)
Definition: IDFilter.h:169
PeptideEvidence.h
ConsensusMap.h
OpenMS::IDFilter::HasMatchingAccession::HasMatchingAccession
HasMatchingAccession(const std::set< String > &accessions_)
Definition: IDFilter.h:274
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
OpenMS::FileTypes::CONSENSUSXML
OpenMS consensus map format (.consensusXML)
Definition: FileTypes.h:65
OpenMS::Exception::ConversionError
Invalid conversion exception.
Definition: Exception.h:354
OpenMS::IDFilter::updateProteinReferences
static void updateProteinReferences(std::vector< PeptideIdentification > &peptides, const std::vector< ProteinIdentification > &proteins, bool remove_peptides_without_reference=false)
Removes references to missing proteins.
OpenMS::TextFile
This class provides some basic file handling methods for text files.
Definition: TextFile.h:46
OpenMS::IDFilter::DigestionFilter::operator()
bool operator()(const PeptideEvidence &evidence) const
Definition: IDFilter.h:455
OpenMS::FASTAFile::FASTAEntry::description
String description
Definition: FASTAFile.h:74
OpenMS::PeakFileOptions::addMSLevel
void addMSLevel(int level)
adds a desired MS level for peaks to load
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
IdXMLFile.h
OpenMS::ProteinHit
Representation of a protein hit.
Definition: ProteinHit.h:58
OpenMS::IDFilter::HasMaxRank::rank
Size rank
Definition: IDFilter.h:134
OpenMS::PercolatorOutfile::load
void load(const String &filename, ProteinIdentification &proteins, std::vector< PeptideIdentification > &peptides, SpectrumMetaDataLookup &lookup, enum ScoreType output_score=QVALUE)
Loads a Percolator output file.
OpenMS::IDFilter::HasMatchingAccession::operator()
bool operator()(const ProteinHit &hit) const
Definition: IDFilter.h:287
OpenMS::IDFilter::updateProteinGroups
static bool updateProteinGroups(std::vector< ProteinIdentification::ProteinGroup > &groups, const std::vector< ProteinHit > &hits)
Update protein groups after protein hits were filtered.
OpenMS::FileTypes::TSV
any TSV file, for example msInspect file or OpenSWATH transition file (see TransitionTSVFile)
Definition: FileTypes.h:86
OpenMS::DataValue::EMPTY_VALUE
empty
Definition: DataValue.h:75
OpenMS::IDFilter::GetMatchingItems::GetMatchingItems
GetMatchingItems()
Definition: IDFilter.h:319
OpenMS::Internal::ClassTest::exception
int exception
(Used by various macros. Indicates a rough category of the exception being caught....
OpenMS::PercolatorOutfile::ScoreType
ScoreType
Types of Percolator scores.
Definition: PercolatorOutfile.h:58
OpenMS::AASequence::toString
String toString() const
returns the peptide as string with modifications embedded in brackets
XTandemXMLFile.h
OpenMS::FileTypes::MZIDENTML
mzIdentML (HUPO PSI AnalysisXML followup format) (.mzid)
Definition: FileTypes.h:75
OpenMS::ProgressLogger::startProgress
void startProgress(SignedSize begin, SignedSize end, const String &label) const
Initializes the progress display.
OpenMS::IDFilter::HasMetaValue::argument_type
HitType argument_type
Definition: IDFilter.h:164
OpenMS::IDFilter::PeptideDigestionFilter::disabledValue
static Int disabledValue()
Definition: IDFilter.h:401
OpenMS::IDFilter::HasMaxMetaValue::value
double value
Definition: IDFilter.h:190
OpenMS::AASequence::toUnmodifiedString
String toUnmodifiedString() const
returns the peptide as string without any modifications or (e.g., "PEPTIDER")
OpenMS::IDFilter::GetMatchingItems::GetMatchingItems
GetMatchingItems(std::vector< Entry > &records)
Definition: IDFilter.h:310
OPENMS_PRECONDITION
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:120
OpenMS::FileHandler::getOptions
PeakFileOptions & getOptions()
Mutable access to the options for loading/storing.
OpenMS::PercolatorOutfile
Class for reading Percolator tab-delimited output files.
Definition: PercolatorOutfile.h:52
OpenMS::IDFilter::DigestionFilter::argument_type
PeptideEvidence argument_type
Definition: IDFilter.h:437
OpenMS::FileTypes::UNKNOWN
Unknown file extension.
Definition: FileTypes.h:58
OPENMS_LOG_WARN
#define OPENMS_LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged.
Definition: LogStream.h:460
OpenMS::EnzymaticDigestion::getSpecificityByName
static Specificity getSpecificityByName(const String &name)
OpenMS::FileTypes::FASTA
FASTA file (.fasta)
Definition: FileTypes.h:91
OpenMS::ProteinIdentification
Representation of a protein identification run.
Definition: ProteinIdentification.h:70
OpenMS::ProgressLogger::endProgress
void endProgress() const
Ends the progress display.
OpenMS::IDFilter::keepPeptidesWithMatchingModifications
static void keepPeptidesWithMatchingModifications(std::vector< PeptideIdentification > &peptides, const std::set< String > &modifications)
Keeps only peptide hits that have at least one of the given modifications.
Constants.h
OpenMS::FASTAFile::FASTAEntry
FASTA entry type (identifier, description and sequence) The first String corresponds to the identifie...
Definition: FASTAFile.h:71
OpenMS::IDFilter::HasMatchingAccessionUnordered::operator()
bool operator()(const PeptideEvidence &evidence) const
Definition: IDFilter.h:256
OpenMS::IDFilter::filterHitsByRank
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:906
OpenMS::IDFilter::removePeptidesWithMatchingRegEx
static void removePeptidesWithMatchingRegEx(std::vector< PeptideIdentification > &peptides, const String &regex)
OpenMS::EnzymaticDigestion::filterByMissedCleavages
bool filterByMissedCleavages(const String &sequence, const std::function< bool(const Int)> &filter) const
Filter based on the number of missed cleavages.
OpenMS::EnzymaticDigestion::setMissedCleavages
void setMissedCleavages(Size missed_cleavages)
Sets the number of missed cleavages for the digestion (default is 0). This setting is ignored when lo...
OpenMS::IDFilter::removeMatchingItemsUnroll
static void removeMatchingItemsUnroll(IDContainer &items, const Predicate &pred)
Remove Hit items that satisfy a condition in one of our ID containers (e.g. vector of Peptide or Prot...
Definition: IDFilter.h:558
OpenMS::IDFilter::HasMatchingAccessionUnordered::HasMatchingAccessionUnordered
HasMatchingAccessionUnordered(const std::unordered_set< String > &accessions_)
Definition: IDFilter.h:238
OpenMS::MSExperiment::size
Size size() const
Definition: MSExperiment.h:120
OpenMS::ExperimentalSettings::getProteinIdentifications
const std::vector< ProteinIdentification > & getProteinIdentifications() const
returns a const reference to the protein ProteinIdentification vector
OpenMS::PeptideIdentification::setHits
void setHits(const std::vector< PeptideHit > &hits)
Sets the peptide hits.
OpenMS::EnzymaticDigestion::SPEC_FULL
fully enzyme specific, e.g., tryptic (ends with KR, AA-before is KR), or peptide is at protein termin...
Definition: EnzymaticDigestion.h:74
OpenMS::PeptideIdentification::getHits
const std::vector< PeptideHit > & getHits() const
returns the peptide hits as const
OpenMS::IDFilter::HasMatchingAccession
Given a list of protein accessions, do any occur in the annotation(s) of this hit?
Definition: IDFilter.h:268
OpenMS::IDFilter::GetMatchingItems::ItemMap
std::map< String, Entry * > ItemMap
Definition: IDFilter.h:307
OpenMS::IdXMLFile::load
void load(const String &filename, std::vector< ProteinIdentification > &protein_ids, std::vector< PeptideIdentification > &peptide_ids)
Loads the identifications of an idXML file without identifier.
OpenMS::SequestOutfile::load
void load(const String &result_filename, std::vector< PeptideIdentification > &peptide_identifications, ProteinIdentification &protein_identification, const double p_value_threshold, std::vector< double > &pvalues, const String &database="", const bool ignore_proteins_per_peptide=false)
loads data from a Sequest outfile
OpenMS::Exception::InvalidParameter
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition: Exception.h:339
OpenMS::ListUtils::concatenate
static String concatenate(const std::vector< T > &container, const String &glue="")
Concatenates all elements of the container and puts the glue string between elements.
Definition: ListUtils.h:209
OpenMS::IDFilter::keepMatchingItems
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:541
OpenMS::IDFilter::HasDecoyAnnotation::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:217
OpenMS::ModificationsDB::getInstance
static ModificationsDB * getInstance()
Returns a pointer to the modifications DB (singleton)
SpectrumAnnotator.h
OpenMS::IDFilter::HasMatchingAccessionUnordered::operator()
bool operator()(const ProteinHit &hit) const
Definition: IDFilter.h:251
OpenMS::SpectrumAlignment
Aligns the peaks of two sorted spectra Method 1: Using a banded (width via 'tolerance' parameter) ali...
Definition: SpectrumAlignment.h:67
OpenMS::IDFilter::HasMatchingAccession::accessions
const std::set< String > & accessions
Definition: IDFilter.h:272
OpenMS::PercolatorOutfile::getScoreType
static enum ScoreType getScoreType(String score_type_name)
Return a score type given its name.
UInt64
OpenMS::IDFilter::DigestionFilter::methionine_cleavage_
bool methionine_cleavage_
Definition: IDFilter.h:443
OpenMS::MzIdentMLFile
File adapter for MzIdentML files.
Definition: MzIdentMLFile.h:67
OpenMS::Int
int Int
Signed integer type.
Definition: Types.h:102
OpenMS::IDFilter::removeDuplicatePeptideHits
static void removeDuplicatePeptideHits(std::vector< PeptideIdentification > &peptides, bool seq_only=false)
Removes duplicate peptide hits from each peptide identification, keeping only unique hits (per ID).
OpenMS::ProteinHit::getAccession
const String & getAccession() const
returns the accession of the protein
OMSFile.h
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::MSExperiment::Iterator
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:104
OpenMS::IDFilter::filterPeptidesByLength
static void filterPeptidesByLength(std::vector< PeptideIdentification > &peptides, Size min_length, Size max_length=UINT_MAX)
Filters peptide identifications according to peptide sequence length.
OpenMS::IDFilter::PeptideDigestionFilter::filterPeptideSequences
void filterPeptideSequences(std::vector< PeptideHit > &hits)
Definition: IDFilter.h:421
OpenMS::MSExperiment::addSpectrum
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
OpenMS::IDFilter::HasMatchingAccession::argument_type
HitType argument_type
Definition: IDFilter.h:270
OpenMS::XQuestResultXMLFile
Used to load and store xQuest result files.
Definition: XQuestResultXMLFile.h:55
OpenMS::MetaInfoInterface::removeMetaValue
void removeMetaValue(const String &name)
Removes the DataValue corresponding to name if it exists.
ProteaseDigestion.h
OpenMS::IDFilter::removeUnreferencedProteins
static void removeUnreferencedProteins(ConsensusMap &cmap, bool include_unassigned)
OpenMS::IDFilter::HasMaxRank::HasMaxRank
HasMaxRank(Size rank_)
Definition: IDFilter.h:136
OpenMS::DataValue::INT_VALUE
integer value
Definition: DataValue.h:70
OpenMS::ProteinIdentification::SearchParameters::variable_modifications
std::vector< String > variable_modifications
Allowed variable modifications.
Definition: ProteinIdentification.h:267
OpenMS::Constants::UserParam::CONCAT_PEPTIDE
const std::string CONCAT_PEPTIDE
Definition: Constants.h:261
OpenMS::IDFilter::SequenceToChargeToPepHitP
std::unordered_map< std::string, ChargeToPepHitP > SequenceToChargeToPepHitP
Definition: IDFilter.h:90
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
ProteaseDB.h
OpenMS::MascotXMLFile::load
void load(const String &filename, ProteinIdentification &protein_identification, std::vector< PeptideIdentification > &id_data, const SpectrumMetaDataLookup &lookup)
Loads data from a Mascot XML file.
OpenMS::PeptideIdentification::sort
void sort()
Sorts the hits by score.
OpenMS::MetaInfoInterface::setMetaValue
void setMetaValue(const String &name, const DataValue &value)
Sets the DataValue corresponding to a name.
OpenMS::DataValue
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:58
OpenMS::SpectrumLookup::findByNativeID
Size findByNativeID(const String &native_id) const
Look up spectrum by native ID.
OpenMS::IDFilter::annotateBestPerPeptide
static void annotateBestPerPeptide(std::vector< PeptideIdentification > &pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
Definition: IDFilter.h:1275
FASTAFile.h
OpenMS::IdentificationData::removeFromSetIf_
static void removeFromSetIf_(ContainerType &container, PredicateType predicate)
Remove elements from a set (or ordered multi_index_container) if they fulfill a predicate.
Definition: IdentificationData.h:837
OpenMS::IDFilter::GetMatchingItems::getKey
const String & getKey(const FASTAFile::FASTAEntry &entry) const
Definition: IDFilter.h:321
OpenMS::IDFilter::filterPeptidesByRTPredictPValue
static void filterPeptidesByRTPredictPValue(std::vector< PeptideIdentification > &peptides, const String &metavalue_key, double threshold=0.05)
Filters peptide identifications according to p-values from RTPredict.
OpenMS::PeptideEvidence::hasValidLimits
bool hasValidLimits() const
start and end numbers in evidence represent actual numeric indices
OpenMS::IDFilter::HasMaxMetaValue::argument_type
HitType argument_type
Definition: IDFilter.h:187
OpenMS::SpectrumMetaDataLookup::readSpectra
void readSpectra(const SpectrumContainer &spectra, const String &scan_regexp=default_scan_regexp, bool get_precursor_rt=false)
Read spectra and store their meta data.
Definition: SpectrumMetaDataLookup.h:212
OpenMS::IDFilter::HasMatchingAccessionUnordered::argument_type
HitType argument_type
Definition: IDFilter.h:234
OpenMS::IDFilter::annotateBestPerPeptideWithData
static void annotateBestPerPeptideWithData(SequenceToChargeToPepHitP &best_pep, PeptideIdentification &pep, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
Definition: IDFilter.h:1288
OpenMS::IDFilter::keepNBestHits
static void keepNBestHits(PeakMap &experiment, Size n)
Filters an MS/MS experiment by keeping the N best peptide hits for every spectrum.
Definition: IDFilter.h:1157
OpenMS::File::isDirectory
static bool isDirectory(const String &path)
Return true if the given path specifies a directory.
OpenMS::FileHandler
Facilitates file handling by file type recognition.
Definition: FileHandler.h:66
OpenMS::SpectrumLookup
Helper class for looking up spectra based on different attributes.
Definition: SpectrumLookup.h:67
OpenMS::SpectrumAnnotator::addIonMatchStatistics
void addIonMatchStatistics(PeptideIdentification &pi, MSSpectrum &spec, const TheoreticalSpectrumGenerator &tg, const SpectrumAlignment &sa) const
Adds ion match statistics to pi PeptideIdentifcation.
OpenMS::IDFilter::keepBestPeptideHits
static void keepBestPeptideHits(std::vector< PeptideIdentification > &peptides, bool strict=false)
Filters peptide identifications keeping only the single best-scoring hit per ID.
OpenMS::IDFilter
Collection of functions for filtering peptide and protein identifications.
Definition: IDFilter.h:78
OpenMS::IdentificationDataInternal::IteratorWrapper
Wrapper that adds operator< to iterators, so they can be used as (part of) keys in maps/sets or multi...
Definition: MetaData.h:45
OpenMS::FileHandler::loadExperiment
bool loadExperiment(const String &filename, MSExperiment &exp, FileTypes::Type force_type=FileTypes::UNKNOWN, ProgressLogger::LogType log=ProgressLogger::NONE, const bool rewrite_source_file=true, const bool compute_hash=true)
Loads a file into an MSExperiment.
ProteinIdentification.h
OpenMS::IDFilter::GetMatchingItems::argument_type
HitType argument_type
Definition: IDFilter.h:306
OpenMS::FileTypes::Type
Type
Actual file types enum.
Definition: FileTypes.h:56
OpenMS::PeptideEvidence
Representation of a peptide evidence.
Definition: PeptideEvidence.h:50
MathFunctions.h
OpenMS::FileTypes::XQUESTXML
xQuest XML file format for protein-protein cross-link identifications (.xquest.xml)
Definition: FileTypes.h:110
OpenMS::IDFilter::filterPeptidesByCharge
static void filterPeptidesByCharge(std::vector< PeptideIdentification > &peptides, Int min_charge, Int max_charge)
Filters peptide identifications according to charge state.
OpenMS::SpectrumLookup::readSpectra
void readSpectra(const SpectrumContainer &spectra, const String &scan_regexp=default_scan_regexp)
Read and index spectra for later look-up.
Definition: SpectrumLookup.h:103
OpenMS::IDFilter::HasDecoyAnnotation::argument_type
HitType argument_type
Definition: IDFilter.h:209
OpenMS::IDFilter::filterPeptidesByRT
static void filterPeptidesByRT(std::vector< PeptideIdentification > &peptides, double min_rt, double max_rt)
Filters peptide identifications by precursor RT, keeping only IDs in the given range.
OpenMS::SpectrumLookup::addReferenceFormat
void addReferenceFormat(const String &regexp)
Register a possible format for a spectrum reference.
OpenMS::IDFilter::DigestionFilter::filterPeptideEvidences
void filterPeptideEvidences(std::vector< PeptideIdentification > &peptides)
Definition: IDFilter.h:484
OpenMS::PepXMLFile::store
void store(const String &filename, std::vector< ProteinIdentification > &protein_ids, std::vector< PeptideIdentification > &peptide_ids, const String &mz_file="", const String &mz_name="", bool peptideprophet_analyzed=false, double rt_tolerance=0.01)
Stores idXML as PepXML file.
OpenMS::FileHandler::getConsistentOutputfileType
static FileTypes::Type getConsistentOutputfileType(const String &output_filename, const String &requested_type)
Useful function for TOPP tools which have an 'out_type' parameter and want to know what output format...
OpenMS::FileHandler::getType
static FileTypes::Type getType(const String &filename)
Tries to determine the file type (by name or content)
OpenMS::IDFilter::updateHitRanks
static void updateHitRanks(std::vector< IdentificationType > &ids)
Updates the hit ranks on all peptide or protein IDs.
Definition: IDFilter.h:742
OpenMS::OMSFile::store
void store(const String &filename, const IdentificationData &id_data)
Write out an IdentificationData object to SQL-based OMS file.
OpenMS::IDFilter::GetMatchingItems::getValue
const Entry & getValue(const PeptideEvidence &evidence) const
Definition: IDFilter.h:336
OpenMS::IDFilter::HasMaxMetaValue::HasMaxMetaValue
HasMaxMetaValue(const String &key_, const double &value_)
Definition: IDFilter.h:192
OMSSAXMLFile.h
OpenMS::ProteaseDigestion::digest
Size digest(const AASequence &protein, std::vector< AASequence > &output, Size min_length=1, Size max_length=0) const
: Performs the enzymatic digestion of a protein.
PepXMLFile.h
OpenMS::IdentificationDataConverter::importIDs
static void importIDs(IdentificationData &id_data, const std::vector< ProteinIdentification > &proteins, const std::vector< PeptideIdentification > &peptides)
Import from legacy peptide/protein identifications.
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::IDFilter::keepPeptidesWithMatchingSequences
static void keepPeptidesWithMatchingSequences(std::vector< PeptideIdentification > &peptides, const std::vector< PeptideIdentification > &good_peptides, bool ignore_mods=false)
Removes all peptide hits with a sequence that does not match one in good_peptides.
OpenMS::IDFilter::HasMatchingAccession::operator()
bool operator()(const PeptideEvidence &evidence) const
Definition: IDFilter.h:292
OpenMS::FASTAFile::writeNext
void writeNext(const FASTAEntry &protein)
Stores the data given by protein. Call writeStart() once before calling writeNext()....
OpenMS::DefaultParamHandler::getDefaults
const Param & getDefaults() const
Non-mutable access to the default parameters.
OpenMS::IDFilter::HasDecoyAnnotation::HasDecoyAnnotation
HasDecoyAnnotation()
Definition: IDFilter.h:213
OpenMS::TextFile::Iterator
std::vector< String >::iterator Iterator
Mutable iterator.
Definition: TextFile.h:54
OpenMS::FileTypes::MASCOTXML
Mascot XML file format for peptide identifications (.xml)
Definition: FileTypes.h:83
OpenMS::IDFilter::HasMaxRank::argument_type
HitType argument_type
Definition: IDFilter.h:132
OpenMS::TheoreticalSpectrumGenerator::getSpectrum
virtual void getSpectrum(PeakSpectrum &spec, const AASequence &peptide, Int min_charge, Int max_charge, Int precursor_charge=0) const
OpenMS::PeptideHit::extractProteinAccessionsSet
std::set< String > extractProteinAccessionsSet() const
extracts the set of non-empty protein accessions from peptide evidences
OpenMS::DataValue::valueType
DataType valueType() const
returns the type of value stored
Definition: DataValue.h:378
OpenMS::IDFilter::countHits
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:614
OpenMS::FileTypes::OMSSAXML
OMSSA XML file format for peptide identifications (.xml)
Definition: FileTypes.h:82
OpenMS::ConsensusMap
A container for consensus elements.
Definition: ConsensusMap.h:82
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::IDFilter::HasGoodScore::higher_score_better
bool higher_score_better
Definition: IDFilter.h:107
OpenMS::ConsensusXMLFile::load
void load(const String &filename, ConsensusMap &map)
Loads a consensus map from file and calls updateRanges.
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::DataValue::EMPTY
static const DataValue EMPTY
Empty data value for comparisons.
Definition: DataValue.h:64
SequestOutfile.h
OpenMS::FASTAFile::writeStart
void writeStart(const String &filename)
Prepares a FASTA file given by 'filename' for streamed writing using writeNext().
OpenMS::PeptideHit::setSequence
void setSequence(const AASequence &sequence)
sets the peptide sequence
OpenMS::DataValue::DOUBLE_VALUE
double value
Definition: DataValue.h:71
ModificationsDB.h
OpenMS::MzIdentMLFile::load
void load(const String &filename, std::vector< ProteinIdentification > &poid, std::vector< PeptideIdentification > &peid)
Loads the identifications from a MzIdentML file.
OpenMS::FileTypes::PROTXML
TPP protXML file (.protXML)
Definition: FileTypes.h:74
OpenMS::ProteaseDigestion::isValidProduct
bool isValidProduct(const String &protein, int pep_pos, int pep_length, bool ignore_missed_cleavages=true, bool allow_nterm_protein_cleavage=false, bool allow_random_asp_pro_cleavage=false) const
Variant of EnzymaticDigestion::isValidProduct() with support for n-term protein cleavage and random D...
OpenMS::IDFilter::annotateBestPerPeptidePerRun
static void annotateBestPerPeptidePerRun(const std::vector< ProteinIdentification > &prot_ids, std::vector< PeptideIdentification > &pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
Definition: IDFilter.h:1250
OpenMS::IDFilter::annotateBestPerPeptidePerRun
static void annotateBestPerPeptidePerRun(MapType &prot_and_pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
Definition: IDFilter.h:1222
OpenMS::IDFilter::GetMatchingItems
Builds a map index of data that have a String index to find matches and return the objects.
Definition: IDFilter.h:304
OpenMS::ParamValue::toString
std::string toString(bool full_precision=true) const
Convert ParamValue to string.
OpenMS::IDFilter::keepMatchingPeptideHits
static void keepMatchingPeptideHits(MapType &prot_and_pep_ids, Predicate &pred)
Definition: IDFilter.h:577
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:71
OpenMS::MascotXMLFile::initializeLookup
static void initializeLookup(SpectrumMetaDataLookup &lookup, const PeakMap &experiment, const String &scan_regex="")
Initializes a helper object for looking up spectrum meta data (RT, m/z)
OpenMS::IDFilter::DigestionFilter::ignore_missed_cleavages_
bool ignore_missed_cleavages_
Definition: IDFilter.h:442
OpenMS::ProteinIdentification::setSearchEngine
void setSearchEngine(const String &search_engine)
Sets the search engine type.
MSExperiment.h
OpenMS::IDFilter::DigestionFilter
Is peptide evidence digestion product of some protein.
Definition: IDFilter.h:435
OpenMS::TextFile::begin
ConstIterator begin() const
Gives access to the underlying text buffer.
OpenMS::SpectrumMetaDataLookup
Helper class for looking up spectrum meta data.
Definition: SpectrumMetaDataLookup.h:142
OpenMS::SignedSize
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
OpenMS::TheoreticalSpectrumGenerator
Generates theoretical spectra for peptides with various options.
Definition: TheoreticalSpectrumGenerator.h:68
OpenMS::IdentificationDataConverter::exportIDs
static void exportIDs(const IdentificationData &id_data, std::vector< ProteinIdentification > &proteins, std::vector< PeptideIdentification > &peptides, bool export_ids_wo_scores=false)
Export to legacy peptide/protein identifications.
OpenMS::IDFilter::GetMatchingItems::items
ItemMap items
Definition: IDFilter.h:308
OpenMS::IdentificationData
Representation of spectrum identification results and associated data.
Definition: IdentificationData.h:94
OpenMS::PeptideEvidence::getStart
Int getStart() const
get the position in the protein (starting at 0 for the N-terminus). If not available UNKNOWN_POSITION...
OpenMS::EnzymaticDigestion::getEnzymeName
String getEnzymeName() const
Returns the enzyme for the digestion.
OpenMS::IDFilter::keepMatchingItemsUnroll
static void keepMatchingItemsUnroll(IDContainer &items, const Predicate &pred)
Keep Hit items that satisfy a condition in one of our ID containers (e.g. vector of Peptide or Protei...
Definition: IDFilter.h:568
OPENMS_LOG_ERROR
#define OPENMS_LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:455
OpenMS::File::absolutePath
static String absolutePath(const String &file)
Replaces the relative path in the argument with the absolute path.
OpenMS::IDFilter::keepBestPerPeptide
static void keepBestPerPeptide(std::vector< PeptideIdentification > &pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
Filters PeptideHits from PeptideIdentification by keeping only the best peptide hits for every peptid...
Definition: IDFilter.h:1206
OpenMS::PeptideIdentification
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:63
OpenMS::Exception::ParseError
Parse Error exception.
Definition: Exception.h:622
AASequence.h
OpenMS::IDFilter::removeMatchingPeptideIdentifications
static void removeMatchingPeptideIdentifications(MapType &prot_and_pep_ids, Predicate &pred)
Definition: IDFilter.h:597
OpenMS::Param::copy
Param copy(const std::string &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
OpenMS::IDFilter::HasNoHits
Is the list of hits of this peptide/protein ID empty?
Definition: IDFilter.h:499
OpenMS::ProteaseDigestion
Class for the enzymatic digestion of proteins.
Definition: ProteaseDigestion.h:59
OpenMS::PeptideIdentification::getReferencingHits
static std::vector< PeptideHit > getReferencingHits(const std::vector< PeptideHit > &, const std::set< String > &accession)
returns all peptide hits which reference to a given protein accession (i.e. filter by protein accessi...
OpenMS::FASTAFile::readNext
bool readNext(FASTAEntry &protein)
Reads the next FASTA entry from file. If you want to read all entries in one go, use load().
OpenMS::MSExperiment::end
Iterator end()
Definition: MSExperiment.h:160
OpenMS::IdentificationData::cleanup
void cleanup(bool require_observation_match=true, bool require_identified_sequence=true, bool require_parent_match=true, bool require_parent_group=false, bool require_match_group=false)
Clean up the data structure after filtering parts of it.
OpenMS::IDFilter::filterPeptidesByMZError
static void filterPeptidesByMZError(std::vector< PeptideIdentification > &peptides, double mass_error, bool unit_ppm)
Filter peptide identifications according to mass deviation.
OpenMS::MSExperiment::getSpectra
const std::vector< MSSpectrum > & getSpectra() const
returns the spectrum list
OpenMS::PeptideHit::getScore
double getScore() const
returns the PSM score
OpenMS::IDFilter::HasMetaValue::value
DataValue value
Definition: IDFilter.h:167
OpenMS::IDFilter::HasMetaValue::key
String key
Definition: IDFilter.h:166
OpenMS::FASTAFile::readStart
void readStart(const String &filename)
Prepares a FASTA file given by 'filename' for streamed reading using readNext().
OpenMS::IdentificationData::observation_matches_
ObservationMatches observation_matches_
Definition: IdentificationData.h:656
OpenMS::FASTAFile::load
void load(const String &filename, std::vector< FASTAEntry > &data) const
loads a FASTA file given by 'filename' and stores the information in 'data' This uses more RAM than r...
OpenMS::IDFilter::PeptideDigestionFilter::max_cleavages_
Int max_cleavages_
Definition: IDFilter.h:393
OpenMS::PepXMLFile::load
void load(const String &filename, std::vector< ProteinIdentification > &proteins, std::vector< PeptideIdentification > &peptides, const String &experiment_name, const SpectrumMetaDataLookup &lookup)
Loads peptide sequences with modifications out of a PepXML file.
OpenMS::IDFilter::HasMatchingAccession::operator()
bool operator()(const PeptideHit &hit) const
Definition: IDFilter.h:278
OpenMS::IDFilter::HasMatchingAccessionUnordered
Given a list of protein accessions, do any occur in the annotation(s) of this hit?
Definition: IDFilter.h:232
OpenMS::IDFilter::HasMatchingAccessionUnordered::operator()
bool operator()(const PeptideHit &hit) const
Definition: IDFilter.h:242
OpenMS::IDFilter::removeEmptyIdentifications
static void removeEmptyIdentifications(std::vector< IdentificationType > &ids)
Removes peptide or protein identifications that have no hits in them.
Definition: IDFilter.h:828
OpenMS::IDFilter::removePeptidesWithMatchingModifications
static void removePeptidesWithMatchingModifications(std::vector< PeptideIdentification > &peptides, const std::set< String > &modifications)
Removes all peptide hits that have at least one of the given modifications.
OpenMS::IDFilter::DigestionFilter::digestion_
ProteaseDigestion & digestion_
Definition: IDFilter.h:441
OpenMS::IDFilter::HasGoodScore
Is the score of this hit at least as good as the given value?
Definition: IDFilter.h:102
OpenMS::IDFilter::HasGoodScore::argument_type
HitType argument_type
Definition: IDFilter.h:104
OpenMS::IDFilter::ChargeToPepHitP
std::map< Int, PeptideHit * > ChargeToPepHitP
Typedefs.
Definition: IDFilter.h:89
OpenMS::XTandemXMLFile
Used to load XTandemXML files.
Definition: XTandemXMLFile.h:56
OpenMS::ModificationsDB::getAllSearchModifications
void getAllSearchModifications(std::vector< String > &modifications) const
Collects all modifications that can be used for identification searches.
OpenMS::IDFilter::filterObservationMatchesByFunctor
static void filterObservationMatchesByFunctor(IdentificationData &id_data, PredicateType &&func, bool cleanup_affected=false)
Helper function for filtering observation matches (e.g. PSMs) in IdentificationData.
Definition: IDFilter.h:1392
OpenMS::IDFilter::DigestionFilter::DigestionFilter
DigestionFilter(std::vector< FASTAFile::FASTAEntry > &entries, ProteaseDigestion &digestion, bool ignore_missed_cleavages, bool methionine_cleavage)
Definition: IDFilter.h:445
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OpenMS::IDFilter::getBestHit
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:639
OpenMS::IDFilter::removePeptidesWithMatchingSequences
static void removePeptidesWithMatchingSequences(std::vector< PeptideIdentification > &peptides, const std::vector< PeptideIdentification > &bad_peptides, bool ignore_mods=false)
Removes all peptide hits with a sequence that matches one in bad_peptides.
IdentificationData.h
OpenMS::IDFilter::PeptideDigestionFilter
Filter Peptide Hit by its digestion product.
Definition: IDFilter.h:388
OpenMS::DataValue::DOUBLE_LIST
double list
Definition: DataValue.h:74
OpenMS::IDFilter::keepHitsMatchingProteins
static void keepHitsMatchingProteins(PeakMap &experiment, const std::vector< FASTAFile::FASTAEntry > &proteins)
Filters an MS/MS experiment according to the given proteins.
Definition: IDFilter.h:1346
OpenMS::IDFilter::keepNBestPeptideHits
static void keepNBestPeptideHits(MapType &map, Size n)
Filters a Consensus/FeatureMap by keeping the N best peptide hits for every spectrum.
Definition: IDFilter.h:1187
OpenMS::IDFilter::DigestionFilter::accession_resolver_
GetMatchingItems< PeptideEvidence, FASTAFile::FASTAEntry > accession_resolver_
Definition: IDFilter.h:440
OpenMS::AASequence
Representation of a peptide/protein sequence.
Definition: AASequence.h:111
IDFilter.h
OpenMS::PepXMLFile
Used to load and store PepXML files.
Definition: PepXMLFile.h:63
OpenMS::String::ensureLastChar
String & ensureLastChar(char end)
Makes sure the string ends with the character end.
OpenMS::AASequence::fromString
static AASequence fromString(const String &s, bool permissive=true)
create AASequence object by parsing an OpenMS string
OpenMS::IDFilter::filterHitsByScore
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:840
OpenMS::IDFilter::PeptideDigestionFilter::min_cleavages_
Int min_cleavages_
Definition: IDFilter.h:392
OpenMS::IDFilter::HasMetaValue::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:174
OpenMS::Exception::MissingInformation
Not all required information provided.
Definition: Exception.h:186
OpenMS::PeptideEvidence::getProteinAccession
const String & getProteinAccession() const
get the protein accession the peptide matches to. If not available the empty string is returned.
OPENMS_LOG_INFO
#define OPENMS_LOG_INFO
Macro if a information, e.g. a status should be reported.
Definition: LogStream.h:465
OpenMS::EnzymaticDigestion::setSpecificity
void setSpecificity(Specificity spec)
Sets the specificity for the digestion (default is SPEC_FULL).
OpenMS::IDFilter::removeUngroupedProteins
static void removeUngroupedProteins(const std::vector< ProteinIdentification::ProteinGroup > &groups, std::vector< ProteinHit > &hits)
Update protein hits after protein groups were filtered.
OpenMS::ProteinIdentification::setIdentifier
void setIdentifier(const String &id)
Sets the identifier.
OpenMS::IDFilter::HasMatchingAccessionUnordered::accessions
const std::unordered_set< String > & accessions
Definition: IDFilter.h:236
OpenMS::File::fileList
static bool fileList(const String &dir, const String &file_pattern, StringList &output, bool full_path=false)
Retrieves a list of files matching file_pattern in directory dir (returns filenames without paths unl...
OpenMS::EnzymaticDigestion::getSpecificity
Specificity getSpecificity() const
Returns the specificity for the digestion.
OpenMS::Exception::ElementNotFound
Element could not be found exception.
Definition: Exception.h:674
OpenMS::IDFilter::removeDecoyHits
static void removeDecoyHits(std::vector< IdentificationType > &ids)
Removes hits annotated as decoys from peptide or protein identifications.
Definition: IDFilter.h:940
OpenMS::XQuestResultXMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &poid, const std::vector< PeptideIdentification > &peid) const
Stores the identifications in a xQuest XML file.
OpenMS::IDFilter::filterHitsByScore
static void filterHitsByScore(PeakMap &experiment, double peptide_threshold_score, double protein_threshold_score)
Filters an MS/MS experiment according to score thresholds.
Definition: IDFilter.h:1133
PeptideIdentification.h
OpenMS::MSSpectrum
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
OpenMS::ProteinIdentification::SearchParameters
Search parameters of the DB search.
Definition: ProteinIdentification.h:258
OpenMS::Param::getValue
const ParamValue & getValue(const std::string &key) const
Returns a value of a parameter.
OpenMS::OMSSAXMLFile::load
void load(const String &filename, ProteinIdentification &protein_identification, std::vector< PeptideIdentification > &id_data, bool load_proteins=true, bool load_empty_hits=true)
loads data from a OMSSAXML file
OpenMS::IDFilter::annotateBestPerPeptidePerRunWithData
static void annotateBestPerPeptidePerRunWithData(RunToSequenceToChargeToPepHitP &best_peps_per_run, std::vector< PeptideIdentification > &pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
Definition: IDFilter.h:1263
OpenMS::IDFilter::HasMetaValue
Is a meta value with given key and value set on this hit?
Definition: IDFilter.h:162
OpenMS::PeptideIdentification::isHigherScoreBetter
bool isHigherScoreBetter() const
returns the peptide score orientation
OpenMS::Param::remove
void remove(const std::string &key)
Remove the entry key or a section key (when suffix is ':')
OpenMS::IDFilter::HasDecoyAnnotation
Is this a decoy hit?
Definition: IDFilter.h:207
OpenMS::TextFile::load
void load(const String &filename, bool trim_lines=false, Int first_n=-1, bool skip_empty_lines=false)
Loads data from a text file.
PercolatorOutfile.h
StandardTypes.h
OpenMS::FileTypes::XML
any XML format
Definition: FileTypes.h:116
OpenMS::String::toInt
Int toInt() const
Conversion to int.
File.h
MzIdentMLFile.h
OpenMS::OMSFile::load
void load(const String &filename, IdentificationData &id_data)
Read in a OMS file and construct an IdentificationData object.
OpenMS::PeptideEvidence::getEnd
Int getEnd() const
get the position of the last AA of the peptide in protein coordinates (starting at 0 for the N-termin...
OpenMS::ProgressLogger::setLogType
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
OpenMS::IDFilter::filterGroupsByScore
static void filterGroupsByScore(std::vector< ProteinIdentification::ProteinGroup > &grps, double threshold_score, bool higher_better)
Filters protein groups according to the score of the groups.
OpenMS::SpectrumAnnotator
Annotates spectra from identifications and theoretical spectra or identifications from spectra and th...
Definition: SpectrumAnnotator.h:60
OpenMS::IDFilter::removeEmptyIdentifications
static void removeEmptyIdentifications(MapType &prot_and_pep_ids)
Definition: IDFilter.h:1199
TOPPBase.h
OpenMS::IDFilter::removeMatchingPeptideHits
static void removeMatchingPeptideHits(MapType &prot_and_pep_ids, Predicate &pred)
Definition: IDFilter.h:587
OpenMS::ConsensusXMLFile
This class provides Input functionality for ConsensusMaps and Output functionality for alignments and...
Definition: ConsensusXMLFile.h:58
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:68
OpenMS::SpectrumMetaDataLookup::addMissingRTsToPeptideIDs
static bool addMissingRTsToPeptideIDs(std::vector< PeptideIdentification > &peptides, const String &filename, bool stop_on_error=false)
Add missing retention time values to peptide identifications based on raw data.
OpenMS::FileTypes::OMS
OpenMS database file.
Definition: FileTypes.h:114
OpenMS::FileTypes::PSMS
Percolator tab-delimited output (PSM level)
Definition: FileTypes.h:105
OpenMS::IDFilter::HasMaxRank
Is the rank of this hit below or at the given cut-off?
Definition: IDFilter.h:130
OpenMS::IDFilter::FilterPeptideEvidences
static void FilterPeptideEvidences(EvidenceFilter &filter, std::vector< PeptideIdentification > &peptides)
remove peptide evidences based on a filter
Definition: IDFilter.h:714
OpenMS::IDFilter::PeptideDigestionFilter::PeptideDigestionFilter
PeptideDigestionFilter(EnzymaticDigestion &digestion, Int min, Int max)
Definition: IDFilter.h:397
OpenMS::IDFilter::HasMaxMetaValue::key
String key
Definition: IDFilter.h:189
OpenMS::ProgressLogger::CMD
Command line progress.
Definition: ProgressLogger.h:70
OpenMS::IDFilter::HasNoHits::operator()
bool operator()(const IdentificationType &id) const
Definition: IDFilter.h:503
OpenMS::PeptideHit
Representation of a peptide hit.
Definition: PeptideHit.h:55
OpenMS::IDFilter::keepBestPerPeptidePerRun
static void keepBestPerPeptidePerRun(std::vector< ProteinIdentification > &prot_ids, std::vector< PeptideIdentification > &pep_ids, bool ignore_mods, bool ignore_charges, Size nr_best_spectrum)
Definition: IDFilter.h:1213