| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::Das::Type; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
4
|
|
|
|
|
|
|
use overload |
|
5
|
1
|
|
|
|
|
10
|
'""' => 'toString', |
|
6
|
1
|
|
|
1
|
|
5
|
cmp => '_cmp'; |
|
|
1
|
|
|
|
|
2
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
230
|
|
|
230
|
1
|
294
|
my $class = shift; |
|
10
|
230
|
|
|
|
|
6060
|
my ($id,$method,$category) = @_; |
|
11
|
230
|
|
|
|
|
1466
|
return bless {id=>$id, |
|
12
|
|
|
|
|
|
|
method=>$method, |
|
13
|
|
|
|
|
|
|
category=>$category |
|
14
|
|
|
|
|
|
|
},$class; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
sub id { |
|
17
|
3030
|
|
|
3030
|
1
|
3278
|
my $self = shift; |
|
18
|
3030
|
|
|
|
|
4323
|
my $d = $self->{id}; |
|
19
|
3030
|
100
|
|
|
|
6304
|
$self->{id} = shift if @_; |
|
20
|
3030
|
|
|
|
|
11714
|
$d; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
sub method { |
|
23
|
417
|
|
|
417
|
1
|
481
|
my $self = shift; |
|
24
|
417
|
|
|
|
|
634
|
my $d = $self->{method}; |
|
25
|
417
|
100
|
|
|
|
855
|
if (@_) { |
|
26
|
204
|
|
|
|
|
295
|
$self->{method} = $_[0]; |
|
27
|
|
|
|
|
|
|
# hack to allow to work with Bio::DB::GFF aggregators. |
|
28
|
|
|
|
|
|
|
# There is a workaround here to correct for broken ensembl |
|
29
|
|
|
|
|
|
|
# das implementation, which lists all methods as "ensembl" |
|
30
|
|
|
|
|
|
|
# This is actually the source, not the method |
|
31
|
204
|
50
|
33
|
|
|
1931
|
$self->{method} =~ s/^[^:]+/$_[0]/ if $_[0] && $_[0] ne 'ensembl'; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
417
|
|
|
|
|
1890
|
$d; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
sub method_label { |
|
36
|
204
|
|
|
204
|
1
|
232
|
my $self = shift; |
|
37
|
204
|
|
|
|
|
286
|
my $d = $self->{method_label}; |
|
38
|
204
|
50
|
|
|
|
520
|
$self->{method_label} = shift if @_; |
|
39
|
204
|
|
|
|
|
448
|
$d; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
sub category { |
|
42
|
216
|
|
|
216
|
1
|
251
|
my $self = shift; |
|
43
|
216
|
|
|
|
|
312
|
my $d = $self->{category}; |
|
44
|
216
|
100
|
|
|
|
469
|
$self->{category} = shift if @_; |
|
45
|
216
|
|
|
|
|
430
|
$d; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
sub count { |
|
48
|
21
|
|
|
21
|
0
|
21
|
my $self = shift; |
|
49
|
21
|
|
|
|
|
28
|
my $d = $self->{count}; |
|
50
|
21
|
50
|
|
|
|
47
|
$self->{count} = shift if @_; |
|
51
|
21
|
|
|
|
|
32
|
$d; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
sub reference { |
|
54
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
55
|
0
|
|
|
|
|
0
|
my $d = $self->{reference}; |
|
56
|
0
|
0
|
|
|
|
0
|
$self->{reference} = shift if @_; |
|
57
|
0
|
|
|
|
|
0
|
$d; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
sub has_subparts { |
|
60
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
61
|
0
|
|
|
|
|
0
|
my $d = $self->{has_subparts}; |
|
62
|
0
|
0
|
|
|
|
0
|
$self->{has_subparts} = shift if @_; |
|
63
|
0
|
|
|
|
|
0
|
$d; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
sub has_superparts { |
|
66
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
67
|
0
|
|
|
|
|
0
|
my $d = $self->{has_superparts}; |
|
68
|
0
|
0
|
|
|
|
0
|
$self->{has_superparts} = shift if @_; |
|
69
|
0
|
|
|
|
|
0
|
$d; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
sub source { |
|
72
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
73
|
0
|
|
|
|
|
0
|
my $d = $self->{source}; |
|
74
|
0
|
0
|
|
|
|
0
|
$self->{source} = shift if @_; |
|
75
|
0
|
|
|
|
|
0
|
$d; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
sub label { |
|
78
|
204
|
|
|
204
|
1
|
245
|
my $self = shift; |
|
79
|
204
|
|
|
|
|
279
|
my $d = $self->{label}; |
|
80
|
204
|
50
|
|
|
|
390
|
$self->{label} = shift if @_; |
|
81
|
204
|
|
|
|
|
899
|
$d; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
sub toString { |
|
84
|
2826
|
|
|
2826
|
0
|
3468
|
my $self = shift; |
|
85
|
2826
|
100
|
|
|
|
4916
|
$self->id || $self->label; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub type { |
|
89
|
0
|
|
|
0
|
0
|
0
|
shift->toString; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub complete { |
|
93
|
408
|
|
|
408
|
0
|
431
|
my $self = shift; |
|
94
|
408
|
|
33
|
|
|
2375
|
return defined $self->{id} && defined $self->{method}; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# return a key that is a unique combination of |
|
98
|
|
|
|
|
|
|
# type and method |
|
99
|
|
|
|
|
|
|
sub _key { |
|
100
|
408
|
|
|
408
|
|
410
|
my $self = shift; |
|
101
|
408
|
|
|
|
|
1224
|
local $^W=0; |
|
102
|
408
|
|
|
|
|
881
|
my @k = $self->{id}; |
|
103
|
408
|
50
|
|
|
|
1200
|
push @k,$self->{method} if exists $self->{method}; |
|
104
|
408
|
50
|
|
|
|
890
|
push @k,$self->{reference} if exists $self->{reference}; |
|
105
|
408
|
50
|
|
|
|
1072
|
push @k,$self->{category} if exists $self->{category}; |
|
106
|
408
|
50
|
|
|
|
806
|
push @k,$self->{has_subparts} if exists $self->{has_subparts}; |
|
107
|
408
|
50
|
|
|
|
760
|
push @k,$self->{has_superparts} if exists $self->{has_subparts}; |
|
108
|
408
|
100
|
|
|
|
889
|
push @k,$self->{method_label} if exists $self->{method_label}; |
|
109
|
408
|
50
|
|
|
|
822
|
push @k,$self->{count} if exists $self->{count}; |
|
110
|
408
|
|
|
|
|
2114
|
join ':',@k; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub _cmp { |
|
114
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
115
|
0
|
|
|
|
|
|
my ($b,$reversed) = @_; |
|
116
|
0
|
|
|
|
|
|
my $a = $self->toString; |
|
117
|
0
|
0
|
|
|
|
|
($a,$b) = ($b,$a) if $reversed; |
|
118
|
0
|
|
|
|
|
|
$a cmp $b; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 NAME |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Bio::Das::Type - A sequence annotation type |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
use Bio::Das; |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# contact a DAS server using the "elegans" data source |
|
134
|
|
|
|
|
|
|
my $das = Bio::Das->new('http://www.wormbase.org/db/das' => 'elegans'); |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# find out what feature types are available |
|
137
|
|
|
|
|
|
|
my @types = $db->types; |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# get information on each one |
|
140
|
|
|
|
|
|
|
for my $t (@types) { |
|
141
|
|
|
|
|
|
|
my $id = $t->id; |
|
142
|
|
|
|
|
|
|
my $method = $t->method; |
|
143
|
|
|
|
|
|
|
my $category = $t->category; |
|
144
|
|
|
|
|
|
|
my $isreference = $t->reference; |
|
145
|
|
|
|
|
|
|
my $label = $t->label; |
|
146
|
|
|
|
|
|
|
my $method_label = $t->method_label; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
The Bio::Das::Type class provides information about the type of an |
|
152
|
|
|
|
|
|
|
annotation. Each type has a category, which is a general description |
|
153
|
|
|
|
|
|
|
of the type, a unique ID, which names the type, and an optional |
|
154
|
|
|
|
|
|
|
method, which describes how the type was derived. A type may also be |
|
155
|
|
|
|
|
|
|
marked as being a landmark that can be used as a reference sequence. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Optionally, types can have human readable labels. There is one label |
|
158
|
|
|
|
|
|
|
for the type itself, and another for the type's method. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 OBJECT CREATION |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Bio::Das::Type objects are created by calling the types() method of a |
|
163
|
|
|
|
|
|
|
Bio::Das or Bio::Das::Segment object. They are also created implicity |
|
164
|
|
|
|
|
|
|
when a Bio::Das::Segment::Feature is created. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
If needed, there is a simple constructor which can be called directly: |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=over 4 |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item $type = Bio::Das::Type->new($id,$method,$category) |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Create and return a Bio::Das::Type object with the indicated typeID, |
|
173
|
|
|
|
|
|
|
method and category. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=back |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 OBJECT METHODS |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
The following methods are public. Most of them use an accessor |
|
180
|
|
|
|
|
|
|
calling style. Called without an argument, they return the current |
|
181
|
|
|
|
|
|
|
value of the attribute. Called with an argument, they change the |
|
182
|
|
|
|
|
|
|
attribute and return its previous value. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=over 4 |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item $id = $type->id([$newid]) |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Get or set the ID for the type; |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item $label = $type->label([$newlabel]) |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Get or set the label for the type; |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item $method = $type->method([$newmethod]) |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Get or set the method ID for the type. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item $label = $type->method_label([$newlabel]) |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Get or set the method label for the type. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item $category = $type->category([$newcategory]) |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Get or set the category for the type. |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item $reference = $type->reference([$newreference]) |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Get or set the value of the reference attribute. If the attribute is |
|
209
|
|
|
|
|
|
|
true, then features of this type can be used as reference sequences. |
|
210
|
|
|
|
|
|
|
However, see LIMITATIONSbelow. |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=back |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 LIMITATIONS |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Due to the requirements of the DAS spec, the reference() method will |
|
217
|
|
|
|
|
|
|
always return false for types returned by the Bio::Das->types() or |
|
218
|
|
|
|
|
|
|
Bio::Das::Segment->types() methods. As currently specified, the |
|
219
|
|
|
|
|
|
|
reference attribute is an attribute of an individual feature, and not |
|
220
|
|
|
|
|
|
|
of a generic type. |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 AUTHOR |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Lincoln Stein <lstein@cshl.org>. |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Copyright (c) 2001 Cold Spring Harbor Laboratory |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
229
|
|
|
|
|
|
|
it under the same terms as Perl itself. See DISCLAIMER.txt for |
|
230
|
|
|
|
|
|
|
disclaimers of warranty. |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
L<Bio::Das>, L<Bio::Das::Segment>, |
|
235
|
|
|
|
|
|
|
L<Bio::Das::Segment::Feature> |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=cut |
|
238
|
|
|
|
|
|
|
|