ProteoWizard
MzidPredicates.hpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Origional author: Robert Burke <robert.burke@proteowizard.org>
6//
7// Copyright 2010 Spielberg Family Center for Applied Proteomics
8// University of Southern California, Los Angeles, California 90033
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14// http://www.apache.org/licenses/LICENSE-2.0
15//
16
17// Unless required by applicable law or agreed to in writing, software
18// distributed under the License is distributed on an "AS IS" BASIS,
19// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20// See the License for the specific language governing permissions and
21// limitations under the License.
22//
23
24#ifndef MZID_MZIDPREDICATE_HPP
25#define MZID_MZIDPREDICATE_HPP
26
27
28#include "IdentData.hpp"
29#include <string>
30#include <boost/shared_ptr.hpp>
31#include <boost/algorithm/string/predicate.hpp>
32
33namespace pwiz {
34namespace identdata {
35
36template<typename T>
37struct id_p
38{
39 const std::string id;
40
41 id_p(const std::string id) : id(id) {}
42
43 bool operator()(const boost::shared_ptr<T>& t) const
44 {
45 return t->id == id;
46 }
47};
48
50{
51 CVID id;
52
53 software_p(const CVID id) : id(id) {}
54
55 bool operator()(const AnalysisSoftwarePtr p)
56 {
57 bool result = false;
58
59 if (p.get())
60 result = p->softwareName.hasCVParam(id);
61
62 return result;
63 }
64};
65
67{
68 const std::string seq;
69
70 sequence_p(const std::string& seq) : seq(seq) {}
71
72 bool operator()(const PeptidePtr& p) const
73 {
74 return (p->peptideSequence == seq);
75 }
76};
77
78struct seq_p
79{
80 const std::string seq;
81
82 seq_p(const std::string& seq) : seq(seq) {}
83
84 bool operator()(const DBSequencePtr& dbs) const
85 {
86 return (dbs->seq == seq);
87 }
88};
89
91{
92 const std::string seq;
93 const std::string accession;
94
95 dbsequence_p(const std::string& seq,
96 const std::string accession)
98
99 bool operator()(const DBSequencePtr& p) const
100 {
101 return boost::iequals(p->seq, seq) &&
102 boost::iequals(p->accession, accession);
103 }
104};
105
107{
108 bool operator()(ContactPtr contact)
109 {
110 return typeid(contact.get()).name() == typeid(Organization*).name();
111 }
112};
113
115{
116 bool operator()(ContactPtr contact)
117 {
118 return typeid(contact.get()).name() == typeid(Person*).name();
119 }
120};
121
122} // namespace pwiz
123} // namespace identdata
124
125#endif // MZID_MZIDPREDICATE_HPP
126
Implementation of AbstractOrganizationType from the mzIdentML schema.
Implementation of PersonType from the mzIdentML schema.
bool operator()(const DBSequencePtr &p) const
dbsequence_p(const std::string &seq, const std::string accession)
const std::string id
id_p(const std::string id)
bool operator()(const boost::shared_ptr< T > &t) const
bool operator()(ContactPtr contact)
bool operator()(ContactPtr contact)
const std::string seq
seq_p(const std::string &seq)
bool operator()(const DBSequencePtr &dbs) const
sequence_p(const std::string &seq)
bool operator()(const PeptidePtr &p) const
bool operator()(const AnalysisSoftwarePtr p)