ProteoWizard
obo.hpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Darren Kessner <darren@proteowizard.org>
6//
7// Copyright 2007 Spielberg Family Center for Applied Proteomics
8// Cedars-Sinai Medical Center, Los Angeles, California 90048
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// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21//
22
23
24#ifndef _OBO_HPP_
25#define _OBO_HPP_
26
27
29#include <vector>
30#include <set>
31#include <map>
32#include <string>
33#include <limits>
34
35
36namespace pwiz {
37namespace data {
38
39
40/// a single controlled vocabulary term
42{
43 typedef unsigned int id_type;
44 typedef std::vector<id_type> id_list;
45 typedef std::multimap<std::string, std::pair<std::string, id_type> > relation_map;
46 const static id_type MAX_ID;
47
48 std::string prefix;
50 std::string name;
51 std::string def;
54 relation_map relations; // other than is_a and part_of
55 std::multimap<std::string, std::string> propertyValues;
56 std::vector<std::string> exactSynonyms;
58
59 Term(id_type id = MAX_ID)
60 : id(id), isObsolete(false)
61 {}
62
63 bool operator< (const Term& rhs) const {return id < rhs.id;}
64};
65
66
67///
68/// Represents a selectively parsed OBO file.
69///
70/// Note that the following are currently ignored during parsing:
71/// - comments
72/// - dbxrefs
73/// - synonym tags other than exact_synonym
74/// - non-Term stanzas
75///
77{
78 std::string filename;
79 std::vector<std::string> header;
80 std::set<std::string> prefixes; // e.g. "MS", "UO"
81 std::set<Term> terms;
82
83 OBO(){}
84 OBO(const std::string& filename);
85};
86
87
88PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const Term& term);
89PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const OBO& obo);
90
91
92} // namespace data
93} // namespace pwiz
94
95
96#endif // _OBO_HPP_
97
98
#define PWIZ_API_DECL
Definition Export.hpp:32
std::ostream & operator<<(std::ostream &os, const Diff< object_type, config_type > &diff)
stream insertion of Diff results
Definition diff_std.hpp:200
Represents a selectively parsed OBO file.
Definition obo.hpp:77
std::vector< std::string > header
Definition obo.hpp:79
OBO(const std::string &filename)
std::set< std::string > prefixes
Definition obo.hpp:80
std::string filename
Definition obo.hpp:78
std::set< Term > terms
Definition obo.hpp:81
a single controlled vocabulary term
Definition obo.hpp:42
id_type id
Definition obo.hpp:49
id_list parentsPartOf
Definition obo.hpp:53
std::string prefix
Definition obo.hpp:48
std::multimap< std::string, std::pair< std::string, id_type > > relation_map
Definition obo.hpp:45
static const id_type MAX_ID
Definition obo.hpp:46
bool isObsolete
Definition obo.hpp:57
std::string def
Definition obo.hpp:51
std::vector< std::string > exactSynonyms
Definition obo.hpp:56
relation_map relations
Definition obo.hpp:54
std::multimap< std::string, std::string > propertyValues
Definition obo.hpp:55
std::string name
Definition obo.hpp:50
id_list parentsIsA
Definition obo.hpp:52
unsigned int id_type
Definition obo.hpp:43
std::vector< id_type > id_list
Definition obo.hpp:44
Term(id_type id=MAX_ID)
Definition obo.hpp:59