OpenMS  2.4.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-2018.
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>
46 
47 #include <algorithm>
48 #include <climits>
49 #include <vector>
50 #include <set>
51 #include <map>
52 
53 namespace OpenMS
54 {
75  class OPENMS_DLLAPI IDFilter
76  {
77 public:
78 
80  IDFilter();
81 
83  virtual ~IDFilter();
84 
85 
91 
94  template <class HitType>
95  struct HasGoodScore
96  {
97  typedef HitType argument_type; // for use as a predicate
98 
99  double score;
101 
102  HasGoodScore(double score_, bool higher_score_better_) :
103  score(score_),
104  higher_score_better(higher_score_better_)
105  {}
106 
107  bool operator()(const HitType& hit) const
108  {
109  if (higher_score_better)
110  {
111  return hit.getScore() >= score;
112  }
113  return hit.getScore() <= score;
114  }
115  };
116 
122  template <class HitType>
123  struct HasMaxRank
124  {
125  typedef HitType argument_type; // for use as a predicate
126 
128 
129  HasMaxRank(Size rank_):
130  rank(rank_)
131  {
132  if (rank_ == 0)
133  {
134  throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "The cut-off value for rank filtering must not be zero!");
135  }
136  }
137 
138  bool operator()(const HitType& hit) const
139  {
140  Size hit_rank = hit.getRank();
141  if (hit_rank == 0)
142  {
143  throw Exception::MissingInformation(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "No rank assigned to peptide or protein hit");
144  }
145  return hit_rank <= rank;
146  }
147  };
148 
154  template <class HitType>
156  {
157  typedef HitType argument_type; // for use as a predicate
158 
161 
162  HasMetaValue(const String& key_, const DataValue& value_):
163  key(key_),
164  value(value_)
165  {}
166 
167  bool operator()(const HitType& hit) const
168  {
169  DataValue found = hit.getMetaValue(key);
170  if (found.isEmpty()) return false; // meta value "key" not set
171  if (value.isEmpty()) return true; // "key" is set, value doesn't matter
172  return found == value;
173  }
174  };
175 
177  template <class HitType>
179  {
180  typedef HitType argument_type; // for use as a predicate
181 
183  double value;
184 
185  HasMaxMetaValue(const String& key_, const double& value_):
186  key(key_),
187  value(value_)
188  {}
189 
190  bool operator()(const HitType& hit) const
191  {
192  DataValue found = hit.getMetaValue(key);
193  if (found.isEmpty()) return false; // meta value "key" not set
194  return double(found) <= value;
195  }
196  };
197 
199  template <class HitType>
201  {
202  typedef HitType argument_type; // for use as a predicate
203 
204  struct HasMetaValue<HitType> target_decoy, is_decoy;
205 
207  target_decoy("target_decoy", "decoy"), is_decoy("isDecoy", "true")
208  {}
209 
210  bool operator()(const HitType& hit) const
211  {
212  // @TODO: this could be done slightly more efficiently by returning
213  // false if the "target_decoy" meta value is "target" or "target+decoy",
214  // without checking for an "isDecoy" meta value in that case
215  return target_decoy(hit) || is_decoy(hit);
216  }
217  };
218 
224  template <class HitType>
226  {
227  typedef HitType argument_type; // for use as a predicate
228 
229  const std::set<String>& accessions;
230 
231  HasMatchingAccession(const std::set<String>& accessions_):
232  accessions(accessions_)
233  {}
234 
235  bool operator()(const PeptideHit& hit) const
236  {
237  std::set<String> present_accessions = hit.extractProteinAccessionsSet();
238  for (std::set<String>::iterator it = present_accessions.begin();
239  it != present_accessions.end(); ++it)
240  {
241  if (accessions.count(*it) > 0) return true;
242  }
243  return false;
244  }
245 
246  bool operator()(const ProteinHit& hit) const
247  {
248  return (accessions.count(hit.getAccession()) > 0);
249  }
250 
251  bool operator()(const PeptideEvidence& evidence) const
252  {
253  return (accessions.count(evidence.getProteinAccession()) > 0);
254  }
255  };
256 
262  template <class HitType, class Entry>
264  {
265  typedef HitType argument_type; // for use as a predicate
266  typedef std::map<String, Entry*> ItemMap;//Store pointers to avoid copying data
268 
269  GetMatchingItems(std::vector<Entry>& records)
270  {
271  for(typename std::vector<Entry>::iterator rec_it = records.begin();
272  rec_it != records.end(); ++rec_it)
273  {
274  items[getKey(*rec_it)] = &(*rec_it);
275  }
276  }
277 
279 
280  const String& getKey(const FASTAFile::FASTAEntry& entry) const
281  {
282  return entry.identifier;
283  }
284 
285  bool exists(const HitType& hit) const
286  {
287  return items.count(getHitKey(hit)) > 0;
288  }
289 
290  const String& getHitKey(const PeptideEvidence& p) const
291  {
292  return p.getProteinAccession();
293  }
294 
295  const Entry& getValue(const PeptideEvidence& evidence) const
296  {
297  if(!exists(evidence)){
298  throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Accession: '"+ getHitKey(evidence) + "'. peptide evidence accession not in data");
299  }
300  return *(items.find(getHitKey(evidence))->second);
301  }
302 
303  };
304 
305 
307 
308 
314 
317  struct HasMinPeptideLength;
318 
320  struct HasMinCharge;
321 
323  struct HasLowMZError;
324 
330  struct HasMatchingModification;
331 
337  struct HasMatchingSequence;
338 
340  struct HasNoEvidence;
341 
342 
349  {
350  private:
354 
355  public:
358  digestion_(digestion), min_cleavages_(min), max_cleavages_(max)
359  {}
360 
361  static inline Int disabledValue(){ return -1; }
362 
366  {
367  return digestion_.filterByMissedCleavages(
369  [&](const Int missed_cleavages)
370  {
371 
372  bool max_filter = max_cleavages_ != disabledValue() ?
373  missed_cleavages > max_cleavages_ : false;
374  bool min_filter = min_cleavages_ != disabledValue() ?
375  missed_cleavages < min_cleavages_ : false;
376  return max_filter || min_filter;
377  });
378  }
379 
380  void filterPeptideSequences(std::vector<PeptideHit>& hits)
381  {
382  hits.erase(std::remove_if(hits.begin(), hits.end(), (*this)), hits.end());
383  }
384 
385  };
386 
387 
394  {
396 
397  // Build an accession index to avoid the linear search cost
402 
403  DigestionFilter(std::vector<FASTAFile::FASTAEntry>& entries,
404  ProteaseDigestion& digestion,
405  bool ignore_missed_cleavages,
406  bool methionine_cleavage) :
407  accession_resolver_(entries),
408  digestion_(digestion),
409  ignore_missed_cleavages_(ignore_missed_cleavages),
410  methionine_cleavage_(methionine_cleavage)
411  {}
412 
413  bool operator()(const PeptideEvidence& evidence) const
414  {
415  if(!evidence.hasValidLimits())
416  {
417  LOG_WARN << "Invalid limits! Peptide '" << evidence.getProteinAccession() << "' not filtered" << std::endl;
418  return true;
419  }
420 
421  if (accession_resolver_.exists(evidence))
422  {
423  return digestion_.isValidProduct(
424  AASequence::fromString(accession_resolver_.getValue(evidence).sequence),
425  evidence.getStart(), evidence.getEnd() - evidence.getStart(), ignore_missed_cleavages_, methionine_cleavage_);
426  }
427  else
428  {
429  if (evidence.getProteinAccession().empty())
430  {
431  LOG_WARN << "Peptide accession not available! Skipping Evidence." << std::endl;
432  }
433  else
434  {
435  LOG_WARN << "Peptide accession '" << evidence.getProteinAccession()
436  << "' not found in fasta file!" << std::endl;
437  }
438  return true;
439  }
440  }
441 
442  void filterPeptideEvidences(std::vector<PeptideIdentification>& peptides)
443  {
444  IDFilter::FilterPeptideEvidences<IDFilter::DigestionFilter>(*this,peptides);
445  }
446 
447  };
448 
449 
451 
452 
455 
457  template <class IdentificationType>
458  struct HasNoHits
459  {
460  typedef IdentificationType argument_type; // for use as a predicate
461 
462  bool operator()(const IdentificationType& id) const
463  {
464  return id.getHits().empty();
465  }
466  };
467 
469 
470 
473 
475  struct HasRTInRange;
476 
478  struct HasMZInRange;
479 
481 
482 
488 
491  template <class Container, class Predicate>
492  static void removeMatchingItems(Container& items, const Predicate& pred)
493  {
494  items.erase(std::remove_if(items.begin(), items.end(), pred),
495  items.end());
496  }
497 
499  template <class Container, class Predicate>
500  static void keepMatchingItems(Container& items, const Predicate& pred)
501  {
502  items.erase(std::remove_if(items.begin(), items.end(), std::not1(pred)),
503  items.end());
504  }
505 
507 
508 
511 
513  template <class IdentificationType>
514  static Size countHits(const std::vector<IdentificationType>& ids)
515  {
516  Size counter = 0;
517  for (typename std::vector<IdentificationType>::const_iterator id_it =
518  ids.begin(); id_it != ids.end(); ++id_it)
519  {
520  counter += id_it->getHits().size();
521  }
522  return counter;
523  }
524 
537  template <class IdentificationType>
538  static bool getBestHit(
539  const std::vector<IdentificationType>& identifications,
540  bool assume_sorted, typename IdentificationType::HitType& best_hit)
541  {
542  if (identifications.empty()) return false;
543 
544  typename std::vector<IdentificationType>::const_iterator best_id_it =
545  identifications.end();
546  typename std::vector<typename IdentificationType::HitType>::const_iterator
547  best_hit_it;
548 
549  for (typename std::vector<IdentificationType>::const_iterator id_it =
550  identifications.begin(); id_it != identifications.end(); ++id_it)
551  {
552  if (id_it->getHits().empty()) continue;
553 
554  if (best_id_it == identifications.end()) // no previous "best" hit
555  {
556  best_id_it = id_it;
557  best_hit_it = id_it->getHits().begin();
558  }
559  else if (best_id_it->getScoreType() != id_it->getScoreType())
560  {
561  throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Can't compare scores of different types", best_id_it->getScoreType() + "/" + id_it->getScoreType());
562  }
563 
564  bool higher_better = best_id_it->isHigherScoreBetter();
565  for (typename std::vector<typename IdentificationType::HitType>::
566  const_iterator hit_it = id_it->getHits().begin(); hit_it !=
567  id_it->getHits().end(); ++hit_it)
568  {
569  if ((higher_better && (hit_it->getScore() >
570  best_hit_it->getScore())) ||
571  (!higher_better && (hit_it->getScore() <
572  best_hit_it->getScore())))
573  {
574  best_hit_it = hit_it;
575  }
576  if (assume_sorted) break; // only consider the first hit
577  }
578  }
579 
580  if (best_id_it == identifications.end())
581  {
582  return false; // no hits in any IDs
583  }
584 
585  best_hit = *best_hit_it;
586  return true;
587  }
588 
596  static void extractPeptideSequences(
597  const std::vector<PeptideIdentification>& peptides,
598  std::set<String>& sequences, bool ignore_mods = false);
599 
606  template<class EvidenceFilter>
608  EvidenceFilter& filter,
609  std::vector<PeptideIdentification>& peptides)
610  {
611  for(std::vector<PeptideIdentification>::iterator pep_it = peptides.begin();
612  pep_it != peptides.end(); ++pep_it)
613  {
614  for(std::vector<PeptideHit>::iterator hit_it = pep_it->getHits().begin();
615  hit_it != pep_it->getHits().end(); ++hit_it )
616  {
617  std::vector<PeptideEvidence> evidences;
618  remove_copy_if(hit_it->getPeptideEvidences().begin(),
619  hit_it->getPeptideEvidences().end(),
620  back_inserter(evidences),
621  std::not1(filter));
622  hit_it->setPeptideEvidences(evidences);
623  }
624  }
625  }
626 
627 
629 
630 
633 
635  template <class IdentificationType>
636  static void updateHitRanks(std::vector<IdentificationType>& ids)
637  {
638  for (typename std::vector<IdentificationType>::iterator it = ids.begin();
639  it != ids.end(); ++it)
640  {
641  it->assignRanks();
642  }
643  }
644 
646  static void removeUnreferencedProteins(
647  std::vector<ProteinIdentification>& proteins,
648  const std::vector<PeptideIdentification>& peptides);
649 
657  static void updateProteinReferences(
658  std::vector<PeptideIdentification>& peptides,
659  const std::vector<ProteinIdentification>& proteins,
660  bool remove_peptides_without_reference = false);
661 
670  static bool updateProteinGroups(
671  std::vector<ProteinIdentification::ProteinGroup>& groups,
672  const std::vector<ProteinHit>& hits);
673 
675 
676 
679 
681  template <class IdentificationType>
682  static void removeEmptyIdentifications(std::vector<IdentificationType>& ids)
683  {
684  struct HasNoHits<IdentificationType> empty_filter;
685  removeMatchingItems(ids, empty_filter);
686  }
687 
693  template <class IdentificationType>
694  static void filterHitsByScore(std::vector<IdentificationType>& ids,
695  double threshold_score)
696  {
697  for (typename std::vector<IdentificationType>::iterator id_it =
698  ids.begin(); id_it != ids.end(); ++id_it)
699  {
700  struct HasGoodScore<typename IdentificationType::HitType> score_filter(
701  threshold_score, id_it->isHigherScoreBetter());
702  keepMatchingItems(id_it->getHits(), score_filter);
703  }
704  }
705 
711  template <class IdentificationType>
712  static void filterHitsBySignificance(std::vector<IdentificationType>& ids,
713  double threshold_fraction = 1.0)
714  {
715  for (typename std::vector<IdentificationType>::iterator id_it =
716  ids.begin(); id_it != ids.end(); ++id_it)
717  {
718  double threshold_score = (threshold_fraction *
719  id_it->getSignificanceThreshold());
720  struct HasGoodScore<typename IdentificationType::HitType> score_filter(
721  threshold_score, id_it->isHigherScoreBetter());
722  keepMatchingItems(id_it->getHits(), score_filter);
723  }
724  }
725 
731  template <class IdentificationType>
732  static void keepNBestHits(std::vector<IdentificationType>& ids, Size n)
733  {
734  for (typename std::vector<IdentificationType>::iterator id_it =
735  ids.begin(); id_it != ids.end(); ++id_it)
736  {
737  id_it->sort();
738  if (n < id_it->getHits().size()) id_it->getHits().resize(n);
739  }
740  }
741 
756  template <class IdentificationType>
757  static void filterHitsByRank(std::vector<IdentificationType>& ids,
758  Size min_rank, Size max_rank)
759  {
760  updateHitRanks(ids);
761  if (min_rank > 1)
762  {
763  struct HasMaxRank<typename IdentificationType::HitType>
764  rank_filter(min_rank - 1);
765  for (typename std::vector<IdentificationType>::iterator id_it =
766  ids.begin(); id_it != ids.end(); ++id_it)
767  {
768  removeMatchingItems(id_it->getHits(), rank_filter);
769  }
770  }
771  if (max_rank >= min_rank)
772  {
773  struct HasMaxRank<typename IdentificationType::HitType>
774  rank_filter(max_rank);
775  for (typename std::vector<IdentificationType>::iterator id_it =
776  ids.begin(); id_it != ids.end(); ++id_it)
777  {
778  keepMatchingItems(id_it->getHits(), rank_filter);
779  }
780  }
781  }
782 
790  template <class IdentificationType>
791  static void removeDecoyHits(std::vector<IdentificationType>& ids)
792  {
793  struct HasDecoyAnnotation<typename IdentificationType::HitType>
794  decoy_filter;
795  for (typename std::vector<IdentificationType>::iterator id_it =
796  ids.begin(); id_it != ids.end(); ++id_it)
797  {
798  removeMatchingItems(id_it->getHits(), decoy_filter);
799  }
800  }
801 
809  template <class IdentificationType>
810  static void removeHitsMatchingProteins(std::vector<IdentificationType>& ids,
811  const std::set<String> accessions)
812  {
813  struct HasMatchingAccession<typename IdentificationType::HitType>
814  acc_filter(accessions);
815  for (typename std::vector<IdentificationType>::iterator id_it =
816  ids.begin(); id_it != ids.end(); ++id_it)
817  {
818  removeMatchingItems(id_it->getHits(), acc_filter);
819  }
820  }
821 
829  template <class IdentificationType>
830  static void keepHitsMatchingProteins(std::vector<IdentificationType>& ids,
831  const std::set<String> accessions)
832  {
833  struct HasMatchingAccession<typename IdentificationType::HitType>
834  acc_filter(accessions);
835  for (typename std::vector<IdentificationType>::iterator id_it =
836  ids.begin(); id_it != ids.end(); ++id_it)
837  {
838  keepMatchingItems(id_it->getHits(), acc_filter);
839  }
840  }
841 
842 
843 
845 
846 
849 
856  static void keepBestPeptideHits(
857  std::vector<PeptideIdentification>& peptides, bool strict = false);
858 
867  static void filterPeptidesByLength(
868  std::vector<PeptideIdentification>& peptides, Size min_length,
869  Size max_length = UINT_MAX);
870 
879  static void filterPeptidesByCharge(
880  std::vector<PeptideIdentification>& peptides, Int min_charge,
881  Int max_charge);
882 
884  static void filterPeptidesByRT(std::vector<PeptideIdentification>& peptides,
885  double min_rt, double max_rt);
886 
888  static void filterPeptidesByMZ(std::vector<PeptideIdentification>& peptides,
889  double min_mz, double max_mz);
890 
902  static void filterPeptidesByMZError(
903  std::vector<PeptideIdentification>& peptides, double mass_error,
904  bool unit_ppm);
905 
906 
913  template <class Filter>
914  static void filterPeptideEvidences(
915  Filter& filter,
916  std::vector<PeptideIdentification>& peptides);
917 
929  static void filterPeptidesByRTPredictPValue(
930  std::vector<PeptideIdentification>& peptides,
931  const String& metavalue_key, double threshold = 0.05);
932 
934  static void removePeptidesWithMatchingModifications(
935  std::vector<PeptideIdentification>& peptides,
936  const std::set<String>& modifications);
937 
939  static void keepPeptidesWithMatchingModifications(
940  std::vector<PeptideIdentification>& peptides,
941  const std::set<String>& modifications);
942 
950  static void removePeptidesWithMatchingSequences(
951  std::vector<PeptideIdentification>& peptides,
952  const std::vector<PeptideIdentification>& bad_peptides,
953  bool ignore_mods = false);
954 
962  static void keepPeptidesWithMatchingSequences(
963  std::vector<PeptideIdentification>& peptides,
964  const std::vector<PeptideIdentification>& good_peptides,
965  bool ignore_mods = false);
966 
968  static void keepUniquePeptidesPerProtein(std::vector<PeptideIdentification>&
969  peptides);
970 
976  static void removeDuplicatePeptideHits(std::vector<PeptideIdentification>&
977  peptides, bool seq_only = false);
978 
980 
981 
984 
986  static void filterHitsByScore(PeakMap& experiment,
987  double peptide_threshold_score,
988  double protein_threshold_score)
989  {
990  // filter protein hits:
991  filterHitsByScore(experiment.getProteinIdentifications(),
992  protein_threshold_score);
993  // don't remove empty protein IDs - they contain search meta data and may
994  // be referenced by peptide IDs (via run ID)
995 
996  // filter peptide hits:
997  for (PeakMap::Iterator exp_it = experiment.begin();
998  exp_it != experiment.end(); ++exp_it)
999  {
1000  filterHitsByScore(exp_it->getPeptideIdentifications(),
1001  peptide_threshold_score);
1002  removeEmptyIdentifications(exp_it->getPeptideIdentifications());
1003  updateProteinReferences(exp_it->getPeptideIdentifications(),
1004  experiment.getProteinIdentifications());
1005  }
1006  // @TODO: remove proteins that aren't referenced by peptides any more?
1007  }
1008 
1010  static void filterHitsBySignificance(PeakMap& experiment,
1011  double peptide_threshold_fraction,
1012  double protein_threshold_fraction)
1013  {
1014  // filter protein hits:
1015  filterHitsBySignificance(experiment.getProteinIdentifications(),
1016  protein_threshold_fraction);
1017  // don't remove empty protein IDs - they contain search meta data and may
1018  // be referenced by peptide IDs (via run ID)
1019 
1020  // filter peptide hits:
1021  for (PeakMap::Iterator exp_it = experiment.begin();
1022  exp_it != experiment.end(); ++exp_it)
1023  {
1024  filterHitsBySignificance(exp_it->getPeptideIdentifications(),
1025  peptide_threshold_fraction);
1026  removeEmptyIdentifications(exp_it->getPeptideIdentifications());
1027  updateProteinReferences(exp_it->getPeptideIdentifications(),
1028  experiment.getProteinIdentifications());
1029  }
1030  // @TODO: remove proteins that aren't referenced by peptides any more?
1031  }
1032 
1034  static void keepNBestHits(PeakMap& experiment, Size n)
1035  {
1036  // don't filter the protein hits by "N best" here - filter the peptides
1037  // and update the protein hits!
1038  std::vector<PeptideIdentification> all_peptides; // IDs from all spectra
1039 
1040  // filter peptide hits:
1041  for (PeakMap::Iterator exp_it = experiment.begin();
1042  exp_it != experiment.end(); ++exp_it)
1043  {
1044  std::vector<PeptideIdentification>& peptides =
1045  exp_it->getPeptideIdentifications();
1046  keepNBestHits(peptides, n);
1047  removeEmptyIdentifications(peptides);
1048  updateProteinReferences(peptides,
1049  experiment.getProteinIdentifications());
1050  all_peptides.insert(all_peptides.end(), peptides.begin(),
1051  peptides.end());
1052  }
1053  // update protein hits:
1054  removeUnreferencedProteins(experiment.getProteinIdentifications(),
1055  all_peptides);
1056  }
1057 
1060  PeakMap& experiment,
1061  const std::vector<FASTAFile::FASTAEntry>& proteins)
1062  {
1063  std::set<String> accessions;
1064  for (std::vector<FASTAFile::FASTAEntry>::const_iterator it =
1065  proteins.begin(); it != proteins.end(); ++it)
1066  {
1067  accessions.insert(it->identifier);
1068  }
1069 
1070  // filter protein hits:
1071  keepHitsMatchingProteins(experiment.getProteinIdentifications(),
1072  accessions);
1073  updateHitRanks(experiment.getProteinIdentifications());
1074 
1075  // filter peptide hits:
1076  for (PeakMap::Iterator exp_it = experiment.begin();
1077  exp_it != experiment.end(); ++exp_it)
1078  {
1079  if (exp_it->getMSLevel() == 2)
1080  {
1081  keepHitsMatchingProteins(exp_it->getPeptideIdentifications(),
1082  accessions);
1083  removeEmptyIdentifications(exp_it->getPeptideIdentifications());
1084  updateHitRanks(exp_it->getPeptideIdentifications());
1085  }
1086  }
1087  }
1088 
1090 
1091 
1092  };
1093 
1094 } // namespace OpenMS
1095 
LogStream.h
OpenMS::FileTypes::IDXML
OpenMS identification format (.idXML)
Definition: FileTypes.h:66
OpenMS::IDFilter::HasGoodScore::HasGoodScore
HasGoodScore(double score_, bool higher_score_better_)
Definition: IDFilter.h:102
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:150
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:492
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::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:74
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::SpectrumMetaDataLookup::addMissingSpectrumReferences
static bool addMissingSpectrumReferences(std::vector< PeptideIdentification > &peptides, const String &filename, bool stop_on_error=false, bool override_spectra_data=false, std::vector< ProteinIdentification > proteins=std::vector< ProteinIdentification >())
Add missing "spectrum_reference"s to peptide identifications based on raw data.
XQuestResultXMLFile.h
OpenMS::ProtXMLFile::load
void load(const String &filename, ProteinIdentification &protein_ids, PeptideIdentification &peptide_ids)
Loads the identifications of an ProtXML file without identifier.
OpenMS::IDFilter::PeptideDigestionFilter::digestion_
EnzymaticDigestion & digestion_
Definition: IDFilter.h:351
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:732
OpenMS::Exception::IllegalArgument
A method or algorithm argument contains illegal values.
Definition: Exception.h:648
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:138
OpenMS::ProteaseDigestion::setEnzyme
void setEnzyme(const String &name)
Sets the enzyme for the digestion (by name)
OpenMS::IDFilter::filterHitsBySignificance
static void filterHitsBySignificance(std::vector< IdentificationType > &ids, double threshold_fraction=1.0)
Filters peptide or protein identifications according to the significance threshold of the hits.
Definition: IDFilter.h:712
EnzymaticDigestion.h
OpenMS::IDFilter::HasGoodScore::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:107
OpenMS::IDFilter::HasNoHits::argument_type
IdentificationType argument_type
Definition: IDFilter.h:460
MascotXMLFile.h
OpenMS::IDFilter::HasMaxMetaValue::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:190
OpenMS::IDFilter::HasGoodScore::score
double score
Definition: IDFilter.h:99
OpenMS::FASTAFile::FASTAEntry::identifier
String identifier
Definition: FASTAFile.h:78
OpenMS::DigestionEnzymeDB< DigestionEnzymeProtein, ProteaseDB >::getInstance
static ProteaseDB * getInstance()
this member function serves as a replacement of the constructor
Definition: DigestionEnzymeDB.h:70
Int
OpenMS::ModificationDefinitionsSet
Representation of a set of modification definitions.
Definition: ModificationDefinitionsSet.h:58
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:830
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:810
OpenMS::IDFilter::GetMatchingItems::getHitKey
const String & getHitKey(const PeptideEvidence &p) const
Definition: IDFilter.h:290
OpenMS::Exception::InvalidValue
Invalid value exception.
Definition: Exception.h:335
OpenMS::FASTAFile
This class serves for reading in and writing FASTA files.
Definition: FASTAFile.h:64
OpenMS::FileHandler::getTypeByFileName
static FileTypes::Type getTypeByFileName(const String &filename)
Determines the file type from a file name.
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::Constants::k
const double k
OpenMS::FileTypes::MZML
MzML file (.mzML)
Definition: FileTypes.h:72
OpenMS::Param::setValue
void setValue(const String &key, const DataValue &value, const String &description="", const StringList &tags=StringList())
Sets a value.
OpenMS::FileTypes::PEPXML
TPP pepXML file (.pepXML)
Definition: FileTypes.h:75
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::String
A more convenient string class.
Definition: String.h:57
OpenMS::MSExperiment::begin
Iterator begin()
Definition: MSExperiment.h:157
OpenMS::IDFilter::PeptideDigestionFilter::argument_type
PeptideHit argument_type
Definition: IDFilter.h:356
OpenMS::IDFilter::HasMaxMetaValue
Does a meta value of this hit have at most the given value?
Definition: IDFilter.h:178
OpenMS::IDFilter::GetMatchingItems::exists
bool exists(const HitType &hit) const
Definition: IDFilter.h:285
OpenMS::ModificationsDB::getInstance
static ModificationsDB * getInstance(OpenMS::String unimod_file="CHEMISTRY/unimod.xml", OpenMS::String psimod_file="CHEMISTRY/PSI-MOD.obo", OpenMS::String xlmod_file="CHEMISTRY/XLMOD.obo")
Returns a pointer to the modifications DB (singleton)
Definition: ModificationsDB.h:77
OpenMS::EnzymaticDigestion
Class for the enzymatic digestion of sequences.
Definition: EnzymaticDigestion.h:62
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:363
OpenMS::OMSSAXMLFile
Used to load OMSSAXML files.
Definition: OMSSAXMLFile.h:60
OpenMS::IDFilter::HasMetaValue::HasMetaValue
HasMetaValue(const String &key_, const DataValue &value_)
Definition: IDFilter.h:162
PeptideEvidence.h
OpenMS::IDFilter::HasMatchingAccession::HasMatchingAccession
HasMatchingAccession(const std::set< String > &accessions_)
Definition: IDFilter.h:231
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::Exception::ConversionError
Invalid conversion exception.
Definition: Exception.h:362
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::DigestionEnzymeDB::getAllNames
void getAllNames(std::vector< String > &all_names) const
returns all the enzyme names (does NOT include synonym names)
Definition: DigestionEnzymeDB.h:122
OpenMS::TextFile
This class provides some basic file handling methods for text files.
Definition: TextFile.h:46
LOG_ERROR
#define LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:446
OpenMS::IDFilter::DigestionFilter::operator()
bool operator()(const PeptideEvidence &evidence) const
Definition: IDFilter.h:413
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:53
OpenMS::IDFilter::HasMaxRank::rank
Size rank
Definition: IDFilter.h:127
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.
LOG_INFO
#define LOG_INFO
Macro if a information, e.g. a status should be reported.
Definition: LogStream.h:454
OpenMS::IDFilter::HasMatchingAccession::operator()
bool operator()(const ProteinHit &hit) const
Definition: IDFilter.h:246
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
msInspect file (.tsv)
Definition: FileTypes.h:87
OpenMS::IDFilter::GetMatchingItems::GetMatchingItems
GetMatchingItems()
Definition: IDFilter.h:278
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:77
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:157
OpenMS::IDFilter::PeptideDigestionFilter::disabledValue
static Int disabledValue()
Definition: IDFilter.h:361
OpenMS::IDFilter::HasMaxMetaValue::value
double value
Definition: IDFilter.h:183
OpenMS::AASequence::toUnmodifiedString
String toUnmodifiedString() const
returns the peptide as string without any modifications
OpenMS::IDFilter::GetMatchingItems::GetMatchingItems
GetMatchingItems(std::vector< Entry > &records)
Definition: IDFilter.h:269
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:395
OpenMS::FileTypes::UNKNOWN
Unknown file extension.
Definition: FileTypes.h:60
OpenMS::EnzymaticDigestion::getSpecificityByName
static Specificity getSpecificityByName(const String &name)
OpenMS::FileTypes::FASTA
FASTA file (.fasta)
Definition: FileTypes.h:92
OpenMS::ProteinIdentification
Representation of a protein identification run.
Definition: ProteinIdentification.h:61
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.
OpenMS::FASTAFile::FASTAEntry
FASTA entry type (identifier, description and sequence)
Definition: FASTAFile.h:76
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:757
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::MSExperiment::size
Size size() const
Definition: MSExperiment.h:127
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:68
OpenMS::IDFilter::HasMatchingAccession
Given a list of protein accessions, do any occur in the annotation(s) of this hit?
Definition: IDFilter.h:225
OpenMS::IDFilter::GetMatchingItems::ItemMap
std::map< String, Entry * > ItemMap
Definition: IDFilter.h:266
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:347
OpenMS::IDFilter::removeUnreferencedProteins
static void removeUnreferencedProteins(std::vector< ProteinIdentification > &proteins, const std::vector< PeptideIdentification > &peptides)
Removes protein hits from proteins that are not referenced by a peptide in peptides.
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:175
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:500
OpenMS::IDFilter::HasDecoyAnnotation::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:210
SpectrumAnnotator.h
OpenMS::SpectrumAlignment
Aligns the peaks of two sorted spectra Method 1: Using a banded (width via 'tolerance' parameter) ali...
Definition: SpectrumAlignment.h:65
OpenMS::IDFilter::HasMatchingAccession::accessions
const std::set< String > & accessions
Definition: IDFilter.h:229
OpenMS::PercolatorOutfile::getScoreType
static enum ScoreType getScoreType(String score_type_name)
Return a score type given its name.
OpenMS::IDFilter::DigestionFilter::methionine_cleavage_
bool methionine_cleavage_
Definition: IDFilter.h:401
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
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::MSExperiment::Iterator
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:111
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:380
OpenMS::IDFilter::HasMatchingAccession::argument_type
HitType argument_type
Definition: IDFilter.h:227
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::HasMaxRank::HasMaxRank
HasMaxRank(Size rank_)
Definition: IDFilter.h:129
OpenMS::ProteinIdentification::SearchParameters::variable_modifications
std::vector< String > variable_modifications
Allowed variable modifications.
Definition: ProteinIdentification.h:112
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
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.
LOG_WARN
#define LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged.
Definition: LogStream.h:450
OpenMS::DataValue
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:56
OpenMS::SpectrumLookup::findByNativeID
Size findByNativeID(const String &native_id) const
Look up spectrum by native ID.
double
FASTAFile.h
OpenMS::IDFilter::GetMatchingItems::getKey
const String & getKey(const FASTAFile::FASTAEntry &entry) const
Definition: IDFilter.h:280
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:180
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:200
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:1034
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:62
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:75
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:265
OpenMS::FileTypes::Type
Type
Actual file types enum.
Definition: FileTypes.h:58
OpenMS::PeptideEvidence
Representation of a peptide evidence.
Definition: PeptideEvidence.h:50
OpenMS::FileTypes::XQUESTXML
xQuest XML file format for protein-protein cross-link identifications (.xquest.xml)
Definition: FileTypes.h:111
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:202
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:442
OpenMS::EnzymaticDigestion::filterByMissedCleavages
bool filterByMissedCleavages(const String &sequence, std::function< bool(const Int)> filter) const
Filter based on the number of missed cleavages.
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:636
OpenMS::IDFilter::GetMatchingItems::getValue
const Entry & getValue(const PeptideEvidence &evidence) const
Definition: IDFilter.h:295
OpenMS::IDFilter::HasMaxMetaValue::HasMaxMetaValue
HasMaxMetaValue(const String &key_, const double &value_)
Definition: IDFilter.h:185
OpenMS::IDFilter::filterHitsBySignificance
static void filterHitsBySignificance(PeakMap &experiment, double peptide_threshold_fraction, double protein_threshold_fraction)
Filters an MS/MS experiment according to fractions of the significance thresholds.
Definition: IDFilter.h:1010
OMSSAXMLFile.h
PepXMLFile.h
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:251
OpenMS::DefaultParamHandler::getDefaults
const Param & getDefaults() const
Non-mutable access to the default parameters.
OpenMS::IDFilter::HasDecoyAnnotation::HasDecoyAnnotation
HasDecoyAnnotation()
Definition: IDFilter.h:206
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:84
OpenMS::IDFilter::HasMaxRank::argument_type
HitType argument_type
Definition: IDFilter.h:125
OpenMS::PeptideHit::extractProteinAccessionsSet
std::set< String > extractProteinAccessionsSet() const
extracts the set of non-empty protein accessions from peptide evidences
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:514
seqan::find
bool find(TFinder &finder, const Pattern< TNeedle, FuzzyAC > &me, PatternAuxData< TNeedle > &dh)
Definition: AhoCorasickAmbiguous.h:884
OpenMS::FileTypes::OMSSAXML
OMSSA XML file format for peptide identifications (.xml)
Definition: FileTypes.h:83
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:73
OpenMS::IDFilter::HasGoodScore::higher_score_better
bool higher_score_better
Definition: IDFilter.h:100
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
SequestOutfile.h
OpenMS::PeptideHit::setSequence
void setSequence(const AASequence &sequence)
sets the peptide sequence
OpenMS::IDFilter::PeptideDigestionFilter::operator()
bool operator()(PeptideHit &p)
Definition: IDFilter.h:365
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:76
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::GetMatchingItems
Builds a map index of data that have a String index to find matches and return the objects.
Definition: IDFilter.h:263
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:73
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:400
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:393
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:141
OpenMS::IdXMLFile::store
void store(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::SignedSize
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
OpenMS::TheoreticalSpectrumGenerator
Generates theoretical spectra with various options.
Definition: TheoreticalSpectrumGenerator.h:63
OpenMS::IDFilter::GetMatchingItems::items
ItemMap items
Definition: IDFilter.h:267
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::File::absolutePath
static String absolutePath(const String &file)
Replaces the relative path in the argument with the absolute path.
OpenMS::PeptideIdentification
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:62
OpenMS::Exception::ParseError
Parse Error exception.
Definition: Exception.h:622
AASequence.h
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)
Stores idXML as PepXML file.
OpenMS::String::substr
String substr(size_t pos=0, size_t n=npos) const
Wrapper for the STL substr() method. Returns a String object with its contents initialized to a subst...
OpenMS::FASTAFile::load
static void load(const String &filename, std::vector< FASTAEntry > &data)
loads a FASTA file given by 'filename' and stores the information in 'data'
OpenMS::IDFilter::HasNoHits
Is the list of hits of this peptide/protein ID empty?
Definition: IDFilter.h:458
OpenMS::ProteaseDigestion
Class for the enzymatic digestion of proteins.
Definition: ProteaseDigestion.h:60
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::MSExperiment::end
Iterator end()
Definition: MSExperiment.h:167
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::IDFilter::HasMetaValue::value
DataValue value
Definition: IDFilter.h:160
OpenMS::IDFilter::HasMetaValue::key
String key
Definition: IDFilter.h:159
OpenMS::EnzymaticDigestion::SIZE_OF_SPECIFICITY
Definition: EnzymaticDigestion.h:71
OpenMS::IDFilter::PeptideDigestionFilter::max_cleavages_
Int max_cleavages_
Definition: IDFilter.h:353
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:235
OpenMS::IDFilter::removeEmptyIdentifications
static void removeEmptyIdentifications(std::vector< IdentificationType > &ids)
Removes peptide or protein identifications that have no hits in them.
Definition: IDFilter.h:682
OpenMS::FileTypes::nameToType
static Type nameToType(const String &name)
Converts a file type name into a Type.
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::Exception::BaseException::getMessage
const char * getMessage() const noexcept
Returns the message.
OpenMS::IDFilter::DigestionFilter::digestion_
ProteaseDigestion & digestion_
Definition: IDFilter.h:399
OpenMS::IDFilter::HasGoodScore
Is the score of this hit at least as good as the given value?
Definition: IDFilter.h:95
OpenMS::IDFilter::HasGoodScore::argument_type
HitType argument_type
Definition: IDFilter.h:97
OpenMS::XTandemXMLFile
Used to load XTandemXML files.
Definition: XTandemXMLFile.h:55
OpenMS::ModificationsDB::getAllSearchModifications
void getAllSearchModifications(std::vector< String > &modifications) const
Collects all modifications that can be used for identification searches.
OpenMS::IDFilter::DigestionFilter::DigestionFilter
DigestionFilter(std::vector< FASTAFile::FASTAEntry > &entries, ProteaseDigestion &digestion, bool ignore_missed_cleavages, bool methionine_cleavage)
Definition: IDFilter.h:403
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:74
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:538
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.
OpenMS::IDFilter::PeptideDigestionFilter
Filter Peptide Hit by its digestion product.
Definition: IDFilter.h:348
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:1059
OpenMS::IDFilter::DigestionFilter::accession_resolver_
GetMatchingItems< PeptideEvidence, FASTAFile::FASTAEntry > accession_resolver_
Definition: IDFilter.h:398
IDFilter.h
OpenMS::PepXMLFile
Used to load and store PepXML files.
Definition: PepXMLFile.h:62
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:694
OpenMS::IDFilter::PeptideDigestionFilter::min_cleavages_
Int min_cleavages_
Definition: IDFilter.h:352
OpenMS::IDFilter::HasMetaValue::operator()
bool operator()(const HitType &hit) const
Definition: IDFilter.h:167
OpenMS::Exception::MissingInformation
Not all required information provided.
Definition: Exception.h:195
OpenMS::PeptideEvidence::getProteinAccession
const String & getProteinAccession() const
get the protein accession the peptide matches to. If not available the empty string is returned.
OpenMS::EnzymaticDigestion::setSpecificity
void setSpecificity(Specificity spec)
Sets the specificity for the digestion (default is SPEC_FULL).
OpenMS::ProteinIdentification::setIdentifier
void setIdentifier(const String &id)
Sets the identifier.
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:662
OpenMS::IDFilter::removeDecoyHits
static void removeDecoyHits(std::vector< IdentificationType > &ids)
Removes hits annotated as decoys from peptide or protein identifications.
Definition: IDFilter.h:791
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:986
PeptideIdentification.h
OpenMS::ProteinIdentification::SearchParameters
Search parameters of the DB search.
Definition: ProteinIdentification.h:103
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::HasMetaValue
Is a meta value with given key and value set on this hit?
Definition: IDFilter.h:155
OpenMS::IDFilter::HasDecoyAnnotation
Is this a decoy hit?
Definition: IDFilter.h:200
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::StringConversions::toString
String toString(T i)
toString functions (single argument)
Definition: StringUtils.h:68
OpenMS::FileTypes::XML
any XML format
Definition: FileTypes.h:98
File.h
MzIdentMLFile.h
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::SpectrumAnnotator
Annotates spectra from identifications and theoretical spectra or identifications from spectra and th...
Definition: SpectrumAnnotator.h:60
TOPPBase.h
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:63
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::PSMS
Percolator tab-delimited output (PSM level)
Definition: FileTypes.h:106
OpenMS::IDFilter::HasMaxRank
Is the rank of this hit below or at the given cut-off?
Definition: IDFilter.h:123
OpenMS::IDFilter::FilterPeptideEvidences
static void FilterPeptideEvidences(EvidenceFilter &filter, std::vector< PeptideIdentification > &peptides)
remove peptide evidences based on a filter
Definition: IDFilter.h:607
OpenMS::IDFilter::PeptideDigestionFilter::PeptideDigestionFilter
PeptideDigestionFilter(EnzymaticDigestion &digestion, Int min, Int max)
Definition: IDFilter.h:357
OpenMS::IDFilter::HasMaxMetaValue::key
String key
Definition: IDFilter.h:182
OpenMS::ProgressLogger::CMD
Command line progress.
Definition: ProgressLogger.h:72
OpenMS::IDFilter::HasNoHits::operator()
bool operator()(const IdentificationType &id) const
Definition: IDFilter.h:462
OpenMS::PeptideHit
Representation of a peptide hit.
Definition: PeptideHit.h:54