| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::Das::Request::Stylesheet; |
|
2
|
|
|
|
|
|
|
# $Id: Stylesheet.pm,v 1.4 2004/01/03 00:23:40 lstein Exp $ |
|
3
|
|
|
|
|
|
|
# this module issues and parses the stylesheet command, with arguments -dsn |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Bio::Das::Request::Stylesheet - The DAS "stylesheet" request |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @stylesheets = $request->results; |
|
12
|
|
|
|
|
|
|
my $das_command = $request->command; |
|
13
|
|
|
|
|
|
|
my $successful = $request->is_success; |
|
14
|
|
|
|
|
|
|
my $error_msg = $request->error; |
|
15
|
|
|
|
|
|
|
my ($username,$password) = $request->auth; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This is a subclass of L<Bio::Das::Request> specialized for the |
|
20
|
|
|
|
|
|
|
"stylesheet" command. The results() method returns a series of |
|
21
|
|
|
|
|
|
|
L<Bio::Das::Stylesheet> objects. All other methods are as described |
|
22
|
|
|
|
|
|
|
in L<Bio::Das::Request>. . |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 AUTHOR |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Lincoln Stein <lstein@cshl.org>. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Copyright (c) 2003 Cold Spring Harbor Laboratory |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
31
|
|
|
|
|
|
|
it under the same terms as Perl itself. See DISCLAIMER.txt for |
|
32
|
|
|
|
|
|
|
disclaimers of warranty. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
L<Bio::Das::Request>, L<Bio::Das::HTTP::Fetch>, L<Bio::Das::Segment>, |
|
37
|
|
|
|
|
|
|
L<Bio::Das::Type>, L<Bio::Das::Stylesheet>, L<Bio::Das::Source>, |
|
38
|
|
|
|
|
|
|
L<Bio::RangeI> |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
43
|
1
|
|
|
1
|
|
5
|
use Bio::Das::Request; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
18
|
|
|
44
|
1
|
|
|
1
|
|
448
|
use Bio::Das::Stylesheet; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
33
|
|
|
45
|
1
|
|
|
1
|
|
8
|
use Bio::Das::Util 'rearrange'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
51
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
5
|
use vars '@ISA'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
681
|
|
|
48
|
|
|
|
|
|
|
@ISA = 'Bio::Das::Request'; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# callback invoked every time a <type> section is ready |
|
51
|
|
|
|
|
|
|
# it will be called with the following arguments: |
|
52
|
|
|
|
|
|
|
# $category,$type,$zoom,$glyph,$attributes |
|
53
|
|
|
|
|
|
|
# All arguments are strings with exception of $attributes, which is a |
|
54
|
|
|
|
|
|
|
# hashref of attribute=>value pairs |
|
55
|
|
|
|
|
|
|
#sub new { |
|
56
|
|
|
|
|
|
|
# my $pack = shift; |
|
57
|
|
|
|
|
|
|
# my ($dsn,$callback) = rearrange([['dsn','dsns'],'callback'],@_); |
|
58
|
|
|
|
|
|
|
# my $self = $pack->SUPER::new(-dsn => $dsn, |
|
59
|
|
|
|
|
|
|
# -callback => $callback, |
|
60
|
|
|
|
|
|
|
# -args => { } ); |
|
61
|
|
|
|
|
|
|
# $self; |
|
62
|
|
|
|
|
|
|
#} |
|
63
|
|
|
|
|
|
|
|
|
64
|
179
|
|
|
179
|
1
|
351
|
sub command { 'stylesheet' } |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub t_DASSTYLE { |
|
67
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
|
68
|
2
|
|
|
|
|
3
|
my $attrs = shift; |
|
69
|
2
|
100
|
|
|
|
8
|
if ($attrs) { |
|
70
|
1
|
|
|
|
|
8
|
$self->clear_results; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
2
|
|
|
|
|
16
|
delete $self->{tmp}; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub t_STYLESHEET { |
|
76
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
|
77
|
2
|
|
|
|
|
3
|
my $attrs = shift; |
|
78
|
2
|
100
|
|
|
|
8
|
if ($attrs) { |
|
|
|
50
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
11
|
my $stylesheet = Bio::Das::Stylesheet->new; |
|
80
|
1
|
|
|
|
|
9
|
$self->{tmp}{stylesheet} = $stylesheet; |
|
81
|
|
|
|
|
|
|
} elsif (!$self->callback) { |
|
82
|
1
|
|
|
|
|
10
|
$self->add_object($self->{tmp}{stylesheet}); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub t_CATEGORY { |
|
87
|
376
|
|
|
376
|
0
|
424
|
my $self = shift; |
|
88
|
376
|
|
|
|
|
466
|
my $attrs = shift; |
|
89
|
376
|
100
|
|
|
|
600
|
if ($attrs) { # segment section is starting |
|
90
|
188
|
|
|
|
|
1194
|
$self->{tmp}{category} = $attrs->{id}; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
else { # reached the end of the category |
|
93
|
188
|
|
|
|
|
1002
|
delete $self->{tmp}{category}; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub t_TYPE { |
|
98
|
2584
|
|
|
2584
|
0
|
2863
|
my $self = shift; |
|
99
|
2584
|
|
|
|
|
2599
|
my $attrs = shift; |
|
100
|
|
|
|
|
|
|
|
|
101
|
2584
|
100
|
|
|
|
3473
|
if ($attrs) { # start of tag |
|
102
|
1292
|
|
|
|
|
7542
|
$self->{tmp}{type} = $attrs->{id}; |
|
103
|
|
|
|
|
|
|
} else { |
|
104
|
1292
|
|
|
|
|
1875
|
my $t = $self->{tmp}; |
|
105
|
1292
|
|
|
|
|
1362
|
delete @{$t}{qw(type zoom glyph attributes)}; |
|
|
1292
|
|
|
|
|
9506
|
|
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub t_GLYPH { |
|
110
|
2584
|
|
|
2584
|
0
|
2875
|
my $self = shift; |
|
111
|
2584
|
|
|
|
|
2476
|
my $attrs = shift; |
|
112
|
2584
|
|
|
|
|
3346
|
my $t = $self->{tmp}; |
|
113
|
|
|
|
|
|
|
|
|
114
|
2584
|
100
|
|
|
|
4203
|
if ($attrs) { # start of tag |
|
115
|
1292
|
|
|
|
|
2122
|
$t->{zoom} = $attrs->{zoom}; |
|
116
|
1292
|
|
|
|
|
13177
|
$t->{glyph} = 'pending'; |
|
117
|
|
|
|
|
|
|
} else { |
|
118
|
1292
|
100
|
|
|
|
2452
|
my %attributes = $t->{attributes} ? %{$t->{attributes}} : (); # copy |
|
|
1290
|
|
|
|
|
8957
|
|
|
119
|
1292
|
|
|
|
|
2566
|
$t->{stylesheet}->add_type(@{$t}{qw(category type zoom glyph)},\%attributes); |
|
|
1292
|
|
|
|
|
4669
|
|
|
120
|
1292
|
50
|
|
|
|
3505
|
if (my $cb = $self->callback) { |
|
121
|
0
|
|
|
|
|
0
|
eval {$cb->(@{$t}{qw(category type zoom glyph)},\%attributes)}; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
122
|
0
|
0
|
|
|
|
0
|
warn $@ if $@; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# handle other tags |
|
128
|
|
|
|
|
|
|
sub do_tag { |
|
129
|
15124
|
|
|
15124
|
1
|
15700
|
my $self = shift; |
|
130
|
15124
|
|
|
|
|
17396
|
my ($tag,$attrs) = @_; |
|
131
|
15124
|
50
|
|
|
|
36656
|
if (exists $self->{tmp}{glyph}) { # in a glyph section |
|
132
|
15124
|
100
|
100
|
|
|
92896
|
if ($self->{tmp}{glyph} eq 'pending') { # must be a glyph name tag |
|
|
|
100
|
|
|
|
|
|
|
133
|
1292
|
|
|
|
|
7065
|
$self->{tmp}{glyph} = lc $tag; |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
elsif (!$attrs && lc $tag ne $self->{tmp}{glyph}) { # attribute |
|
136
|
6270
|
|
|
|
|
16067
|
$self->{tmp}{attributes}{lc $tag} = $self->char_data; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |