| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::Das::DSN; |
|
2
|
|
|
|
|
|
|
# $Id: DSN.pm,v 1.6 2004/01/03 00:23:40 lstein Exp $ |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Bio::Das::DSN - Object encapsulation of a DAS data source |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $base = $dsn->base; |
|
11
|
|
|
|
|
|
|
my $id = $dsn->id; |
|
12
|
|
|
|
|
|
|
my $host = $dsn->host; |
|
13
|
|
|
|
|
|
|
my $url = $dsn->url; |
|
14
|
|
|
|
|
|
|
my $name = $dsn->name; |
|
15
|
|
|
|
|
|
|
my $description = $dsn->description; |
|
16
|
|
|
|
|
|
|
my $mapmaster = $dsn->master; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
The Bio::Das::DSN object contains information pertaining to a Das data |
|
21
|
|
|
|
|
|
|
source. A set of these objects are returned by a call to |
|
22
|
|
|
|
|
|
|
Bio::Das->dsn(). |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 METHODS |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Following is a complete list of methods implemented by Bio::Das::DSN. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=over 4 |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
|
31
|
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
33
|
1
|
|
|
|
|
10
|
use overload '""' => 'url', |
|
34
|
1
|
|
|
1
|
|
23
|
'eq' => 'eq'; |
|
|
1
|
|
|
|
|
3
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item $dsn = Bio::Das::DSN->new($base,$id,$name,$master,$description) |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Create a new Bio::DAS::DSN object. Ordinarily this is called during |
|
39
|
|
|
|
|
|
|
the processing of a DAS dsn request and should not be invoked by |
|
40
|
|
|
|
|
|
|
application code. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new { |
|
45
|
22
|
|
|
22
|
1
|
27
|
my $package = shift; |
|
46
|
22
|
|
|
|
|
35
|
my ($base, $id,$name,$master,$description) = @_; |
|
47
|
22
|
100
|
66
|
|
|
199
|
if (!$id && $base =~ m!(.+/das)/([^/]+)!) { |
|
48
|
5
|
|
|
|
|
14
|
$base = $1; |
|
49
|
5
|
|
|
|
|
12
|
$id = $2; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
22
|
|
|
|
|
198
|
return bless { |
|
52
|
|
|
|
|
|
|
base => $base, |
|
53
|
|
|
|
|
|
|
id => $id, |
|
54
|
|
|
|
|
|
|
name => $name, |
|
55
|
|
|
|
|
|
|
master => $master, |
|
56
|
|
|
|
|
|
|
description => $description, |
|
57
|
|
|
|
|
|
|
},$package; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# I don't think this is used for anything, so it gets commented |
|
61
|
|
|
|
|
|
|
# out! |
|
62
|
|
|
|
|
|
|
# sub set_authentication{ |
|
63
|
|
|
|
|
|
|
# my ($self, $user, $pass) = @_; |
|
64
|
|
|
|
|
|
|
# my $base = $self->base; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# #Strip any old authentication from URI, and replace |
|
67
|
|
|
|
|
|
|
# $base =~ s#^(.+?://)(.*?@)?#$1$user:$pass@#; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# $self->base($base); |
|
70
|
|
|
|
|
|
|
# } |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item $base = $dsn->base |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Return the base of the DAS server, for example |
|
75
|
|
|
|
|
|
|
"http://www.wormbase.org/db/das." |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub base { |
|
80
|
22
|
|
|
22
|
1
|
34
|
my $self = shift; |
|
81
|
22
|
|
|
|
|
36
|
my $d = $self->{base}; |
|
82
|
22
|
50
|
|
|
|
137
|
$self->{base} = shift if @_; |
|
83
|
22
|
|
|
|
|
52
|
$d; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item $host = $dsn->host |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Return the hostname of the DAS server, for example "www.wormbase.org." |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub host { |
|
93
|
6
|
|
|
6
|
1
|
13
|
my $self = shift; |
|
94
|
6
|
|
|
|
|
30
|
my $base = $self->base; |
|
95
|
6
|
50
|
|
|
|
501
|
return unless $base =~ m!^\w+://(?:\w+:\w+@)?([^/:]+)!; |
|
96
|
6
|
|
|
|
|
46
|
$1; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item $id = $dsn->id |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Return the ID of the DAS data source, for example "elegans." |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub id { |
|
106
|
17
|
|
|
17
|
1
|
18
|
my $self = shift; |
|
107
|
17
|
|
|
|
|
20
|
my $d = $self->{id}; |
|
108
|
17
|
100
|
|
|
|
33
|
$self->{id} = shift if @_; |
|
109
|
17
|
|
|
|
|
72
|
$d; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item $url = $dsn->url |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Return the URL for the request, which will consist of the basename |
|
115
|
|
|
|
|
|
|
plus the DSN ID. For example |
|
116
|
|
|
|
|
|
|
"http://www.wormbase.org/db/das/elegans." |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The url() method is automatically invoked if the DSN is used in a |
|
119
|
|
|
|
|
|
|
string context. This makes it convenient to use as a hash key. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub url { |
|
124
|
479
|
|
|
479
|
1
|
950
|
my $self = shift; |
|
125
|
479
|
100
|
|
|
|
1990
|
return defined $self->{id} ? "$self->{base}/$self->{id}" : $self->{base}; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item $name = $dsn->name |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Return the human readable name for the DSN. This is usually, but not |
|
131
|
|
|
|
|
|
|
necessarily, identical to the ID. This field will B<only> be set if |
|
132
|
|
|
|
|
|
|
the DSN was generated via a Bio::Das->dsn() request. Otherwise it |
|
133
|
|
|
|
|
|
|
will be undef. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub name { |
|
138
|
17
|
|
|
17
|
1
|
15
|
my $self = shift; |
|
139
|
17
|
|
|
|
|
17
|
my $d = $self->{name}; |
|
140
|
17
|
100
|
|
|
|
32
|
$self->{name} = shift if @_; |
|
141
|
17
|
|
|
|
|
90
|
$d; |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item $description = $dsn->description |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Return the human readable description for the DSN. This field will |
|
147
|
|
|
|
|
|
|
B<only> be set if the DSN was generated via a Bio::Das->dsn() request. |
|
148
|
|
|
|
|
|
|
Otherwise it will be undef. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub description { |
|
153
|
17
|
|
|
17
|
1
|
16
|
my $self = shift; |
|
154
|
17
|
|
|
|
|
19
|
my $d = $self->{description}; |
|
155
|
17
|
100
|
|
|
|
36
|
$self->{description} = shift if @_; |
|
156
|
17
|
|
|
|
|
63
|
$d; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item $master = $dsn->master |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Return the URL of the DAS reference server associated with this DSN. |
|
162
|
|
|
|
|
|
|
This field will B<only> be set if the DSN was generated via a |
|
163
|
|
|
|
|
|
|
Bio::Das->dsn() request. Otherwise it will be undef. |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub master { |
|
168
|
16
|
|
|
16
|
1
|
14
|
my $self = shift; |
|
169
|
16
|
|
|
|
|
16
|
my $d = $self->{master}; |
|
170
|
16
|
50
|
|
|
|
33
|
$self->{master} = shift if @_; |
|
171
|
16
|
|
|
|
|
60
|
$d; |
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item $flag = $dsn->eq($other_dsn) |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This method will return true if two DSN objects are equivalent, false |
|
177
|
|
|
|
|
|
|
otherwise. This method overloads the eq operator, allowing you to |
|
178
|
|
|
|
|
|
|
compare to DSNs this way: |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
if ($dsn1 eq $dsn2) { .... } |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub eq { |
|
185
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
186
|
0
|
|
|
|
|
|
my $other = shift; |
|
187
|
0
|
|
|
|
|
|
return $self->url eq $other->url; |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=back |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 AUTHOR |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Lincoln Stein <lstein@cshl.org>. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Copyright (c) 2001 Cold Spring Harbor Laboratory |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
199
|
|
|
|
|
|
|
it under the same terms as Perl itself. See DISCLAIMER.txt for |
|
200
|
|
|
|
|
|
|
disclaimers of warranty. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
L<Bio::Das::Request>, L<Bio::Das::HTTP::Fetch>, |
|
205
|
|
|
|
|
|
|
L<Bio::Das::Segment>, L<Bio::Das::Type>, L<Bio::Das::Stylesheet>, |
|
206
|
|
|
|
|
|
|
L<Bio::Das::Source>, L<Bio::RangeI> |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
1; |
|
211
|
|
|
|
|
|
|
|