line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::Ontology::DocumentRegistry |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Cared for by Allen Day |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright Allen Day |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Bio::Ontology::DocumentRegistry - Keep track of where to find ontologies. |
17
|
|
|
|
|
|
|
Allows lookups by name. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $registry = Bio::Ontology::DocumentRegistry->get_instance(); |
22
|
|
|
|
|
|
|
my($ont,$def,$fmt) = $registry->documents('Sequence Ontology'); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $io = Bio::OntologyIO->new(-url => $ont, |
25
|
|
|
|
|
|
|
-defs_url => $def, |
26
|
|
|
|
|
|
|
-format => $fmt); |
27
|
|
|
|
|
|
|
my $so = $io->next_ontology(); |
28
|
|
|
|
|
|
|
#... |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Do not use this directly, use Bio::Ontology::OntologyStore instead. |
33
|
|
|
|
|
|
|
Bio::Ontology::OntologyStore uses Bio::Ontology::DocumentRegistry to |
34
|
|
|
|
|
|
|
load and cache ontologies as object graphs, you can just ask it for |
35
|
|
|
|
|
|
|
what you want by name. See L for |
36
|
|
|
|
|
|
|
details. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 FEEDBACK |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 Mailing Lists |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
43
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to |
44
|
|
|
|
|
|
|
the Bioperl mailing list. Your participation is much appreciated. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
47
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 Support |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
I |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
56
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
57
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
58
|
|
|
|
|
|
|
with code and data examples if at all possible. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 Reporting Bugs |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
63
|
|
|
|
|
|
|
of the bugs and their resolution. Bug reports can be submitted via |
64
|
|
|
|
|
|
|
the web: |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR - Allen Day |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Email allenday@ucla.edu |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 APPENDIX |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
The rest of the documentation details each of the object methods. |
75
|
|
|
|
|
|
|
Internal methods are usually preceded with a _ |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Let the code begin... |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
package Bio::Ontology::DocumentRegistry; |
83
|
10
|
|
|
10
|
|
35
|
use strict; |
|
10
|
|
|
|
|
12
|
|
|
10
|
|
|
|
|
269
|
|
84
|
10
|
|
|
10
|
|
29
|
use base qw(Bio::Root::Root); |
|
10
|
|
|
|
|
12
|
|
|
10
|
|
|
|
|
601
|
|
85
|
10
|
|
|
10
|
|
37
|
use Data::Dumper; |
|
10
|
|
|
|
|
13
|
|
|
10
|
|
|
|
|
1027
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $instance; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
BEGIN { |
90
|
10
|
|
|
10
|
|
80
|
$instance = { |
91
|
|
|
|
|
|
|
'Sequence Ontology' => { |
92
|
|
|
|
|
|
|
ontology => "http://song.cvs.sourceforge.net/*checkout*/song/ontology/so.ontology?rev=HEAD", |
93
|
|
|
|
|
|
|
definitions => "http://song.cvs.sourceforge.net/*checkout*/song/ontology/so.definition?rev=HEAD", |
94
|
|
|
|
|
|
|
format => 'soflat', |
95
|
|
|
|
|
|
|
}, |
96
|
|
|
|
|
|
|
'Sequence Ontology OBO' => { |
97
|
|
|
|
|
|
|
ontology => "http://song.cvs.sourceforge.net/*checkout*/song/ontology/so.obo?rev=HEAD", |
98
|
|
|
|
|
|
|
definitions => "http://song.cvs.sourceforge.net/*checkout*/song/ontology/so.definition?rev=HEAD", |
99
|
|
|
|
|
|
|
format => 'obo', |
100
|
|
|
|
|
|
|
}, |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
#### TODO Server http://umn.dl.sourceforge.net/ does not respond, are there |
103
|
|
|
|
|
|
|
#### alternative sources? |
104
|
|
|
|
|
|
|
'Sequence Ontology Feature Annotation' => { |
105
|
|
|
|
|
|
|
ontology => 'http://umn.dl.sourceforge.net/sourceforge/song/sofa.ontology', |
106
|
|
|
|
|
|
|
definitions =>'http://umn.dl.sourceforge.net/sourceforge/song/sofa.definition', |
107
|
|
|
|
|
|
|
format => 'soflat', |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
'Gene Ontology' => { |
110
|
|
|
|
|
|
|
ontology => [ |
111
|
|
|
|
|
|
|
'http://www.geneontology.org/ontology/function.ontology', |
112
|
|
|
|
|
|
|
'http://www.geneontology.org/ontology/process.ontology', |
113
|
|
|
|
|
|
|
'http://www.geneontology.org/ontology/component.ontology' |
114
|
|
|
|
|
|
|
], |
115
|
|
|
|
|
|
|
definitions => 'http://www.geneontology.org/ontology/GO.defs', |
116
|
|
|
|
|
|
|
format => 'soflat', |
117
|
|
|
|
|
|
|
}, |
118
|
|
|
|
|
|
|
}; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
#aliases |
121
|
10
|
|
|
|
|
17
|
$instance->{Gene_Ontology} = $instance->{'Gene Ontology'}; |
122
|
|
|
|
|
|
|
|
123
|
10
|
|
|
|
|
899
|
bless $instance, __PACKAGE__; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub new { |
128
|
0
|
|
|
0
|
1
|
|
return shift->get_instance(@_); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 get_instance |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Title : get_instance |
134
|
|
|
|
|
|
|
Usage : my $singleton = Bio::Ontology::DocumentRegistry->get_instance(); |
135
|
|
|
|
|
|
|
Function: constructor |
136
|
|
|
|
|
|
|
Returns : The Bio::Ontology::DocumentRegistry singleton. |
137
|
|
|
|
|
|
|
Args : None |
138
|
|
|
|
|
|
|
Usage |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub get_instance { |
143
|
0
|
|
|
0
|
1
|
|
return $instance; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 documents |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Title : documents |
149
|
|
|
|
|
|
|
Usage : my($ontology_url, $definitions_url, $format) = $obj->documents('Sequence Ontology'); |
150
|
|
|
|
|
|
|
Function: Maps an ontology name to a list of (local or) remote URIs where the |
151
|
|
|
|
|
|
|
files can be located. |
152
|
|
|
|
|
|
|
Returns : A 3-item list: |
153
|
|
|
|
|
|
|
(1) URI for the ontology file |
154
|
|
|
|
|
|
|
(2) URI for the ontology definitions file |
155
|
|
|
|
|
|
|
(3) format of the files (dagedit, obo, etc) |
156
|
|
|
|
|
|
|
Args : Name of an ontology, e.g. 'Sequence Ontology', or 'Cellular Component |
157
|
|
|
|
|
|
|
(Gene Ontology)' |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub documents { |
163
|
0
|
|
|
0
|
1
|
|
my($self,$name) = @_; |
164
|
|
|
|
|
|
|
|
165
|
0
|
0
|
|
|
|
|
if(defined($self->{$name})){ |
166
|
0
|
|
|
|
|
|
return ($self->{$name}{ontology} , $self->{$name}{definitions}, $self->{$name}{format}); |
167
|
|
|
|
|
|
|
} else { |
168
|
0
|
|
|
|
|
|
return (); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
1; |