line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Das::Request::Dnas; |
2
|
|
|
|
|
|
|
# $Id: Dnas.pm,v 1.4 2004/01/03 00:23:40 lstein Exp $ |
3
|
|
|
|
|
|
|
# this module issues and parses the types command, with arguments -dsn, -segment, -categories, -enumerate |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Bio::Das::Request::Dnas - The DAS "dna" request |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @dnas = $request->results; |
12
|
|
|
|
|
|
|
my $dnas = $request->results; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $dsn = $request->dsn; |
15
|
|
|
|
|
|
|
my $das_command = $request->command; |
16
|
|
|
|
|
|
|
my $successful = $request->is_success; |
17
|
|
|
|
|
|
|
my $error_msg = $request->error; |
18
|
|
|
|
|
|
|
my ($username,$password) = $request->auth; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This is a subclass of L<Bio::Das::Request> specialized for the "dna" |
23
|
|
|
|
|
|
|
command. It is used to retrieve the DNA corresponding to a set of |
24
|
|
|
|
|
|
|
segments on a set of DAS servers. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
All methods are the same as L<Bio::Das::Request> with the exception of |
29
|
|
|
|
|
|
|
results(), which has been overridden to produce specialized behavior. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over 4 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
36
|
1
|
|
|
1
|
|
5
|
use Bio::Das::Segment; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
37
|
1
|
|
|
1
|
|
6
|
use Bio::Das::Request; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
38
|
1
|
|
|
1
|
|
5
|
use Bio::Das::Util 'rearrange'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
60
|
|
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
1
|
|
6
|
use vars '@ISA'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
463
|
|
41
|
|
|
|
|
|
|
@ISA = 'Bio::Das::Request'; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub new { |
44
|
1
|
|
|
1
|
1
|
2
|
my $pack = shift; |
45
|
1
|
|
|
|
|
15
|
my ($dsn,$segments,$callback) = rearrange([['dsn','dsns'], |
46
|
|
|
|
|
|
|
['segment','segments'], |
47
|
|
|
|
|
|
|
'callback' |
48
|
|
|
|
|
|
|
],@_); |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
15
|
my $self = $pack->SUPER::new(-dsn => $dsn, |
51
|
|
|
|
|
|
|
-callback => $callback, |
52
|
|
|
|
|
|
|
-args => { |
53
|
|
|
|
|
|
|
segment => $segments, |
54
|
|
|
|
|
|
|
} ); |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
7
|
$self; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
13
|
|
|
13
|
1
|
27
|
sub command { 'dna' } |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub t_DASDNA { |
62
|
2
|
|
|
2
|
0
|
12
|
my $self = shift; |
63
|
2
|
|
|
|
|
5
|
my $attrs = shift; |
64
|
2
|
100
|
|
|
|
8
|
if ($attrs) { |
65
|
1
|
|
|
|
|
9
|
$self->clear_results; |
66
|
|
|
|
|
|
|
} |
67
|
2
|
|
|
|
|
17
|
delete $self->{tmp}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub t_SEQUENCE { |
71
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
72
|
2
|
|
|
|
|
2
|
my $attrs = shift; |
73
|
2
|
100
|
|
|
|
7
|
if ($attrs) { # segment section is starting |
74
|
1
|
|
|
|
|
15
|
$self->{tmp}{current_segment} = Bio::Das::Segment->new($attrs->{id},$attrs->{start},$attrs->{stop},$attrs->{version}); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
else { # reached the end of the segment, so push result |
78
|
1
|
|
|
|
|
134
|
$self->{tmp}{current_dna} =~ s/\s//g; |
79
|
1
|
|
|
|
|
12
|
$self->add_object($self->{tmp}{current_segment},$self->{tmp}{current_dna}); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub t_DNA { |
85
|
2
|
|
|
2
|
0
|
3
|
my $self = shift; |
86
|
2
|
|
|
|
|
3
|
my $attrs = shift; |
87
|
|
|
|
|
|
|
|
88
|
2
|
100
|
|
|
|
196
|
if ($attrs) { # start of tag |
89
|
1
|
|
|
|
|
29
|
$self->{tmp}{current_dna} = ''; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
else { |
93
|
1
|
|
|
|
|
4
|
my $dna = $self->char_data; |
94
|
1
|
|
|
|
|
19
|
$self->{tmp}{current_dna} .= $dna; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item $results = $request->results |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
In a scalar context, results() returns a hashref in which the keys are |
101
|
|
|
|
|
|
|
segment strings (in the form "ref:start,end") and the values are the |
102
|
|
|
|
|
|
|
DNAs corresponding to those segments. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item @results = $request->results |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
In a list context, results() returns a list of the DNAs in the order |
107
|
|
|
|
|
|
|
in which the segments were requested. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# override for "better" behavior |
112
|
|
|
|
|
|
|
sub results { |
113
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
114
|
1
|
50
|
|
|
|
8
|
my %r = $self->SUPER::results or return; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# in array context, return the list of dnas |
117
|
1
|
50
|
|
|
|
17
|
return values %r if wantarray; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# otherwise return ref to a hash in which the keys are segments and the values |
120
|
|
|
|
|
|
|
# are DNAs |
121
|
0
|
|
|
|
|
|
return \%r; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHOR |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Lincoln Stein <lstein@cshl.org>. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Copyright (c) 2001 Cold Spring Harbor Laboratory |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
131
|
|
|
|
|
|
|
it under the same terms as Perl itself. See DISCLAIMER.txt for |
132
|
|
|
|
|
|
|
disclaimers of warranty. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 SEE ALSO |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
L<Bio::Das::Request>, L<Bio::Das::HTTP::Fetch>, |
137
|
|
|
|
|
|
|
L<Bio::Das::Segment>, L<Bio::Das::Type>, L<Bio::Das::Stylesheet>, |
138
|
|
|
|
|
|
|
L<Bio::Das::Source>, L<Bio::RangeI> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |