line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Das::Request::Feature2Segments; |
2
|
|
|
|
|
|
|
# $Id: Feature2Segments.pm,v 1.1 2004/01/03 21:12:36 lstein Exp $ |
3
|
|
|
|
|
|
|
# this module issues and parses the features command with the feature_id argument |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Bio::Das::Request::Feature2Segments - Translate feature names into segments |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @segments = $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
|
|
|
|
|
|
|
"features" command with specialized arguments that allow it to |
21
|
|
|
|
|
|
|
translate a feature name into a segment of the genome. It works by |
22
|
|
|
|
|
|
|
issuing the DAS features command using a type of NULL (which is an |
23
|
|
|
|
|
|
|
invalid feature type) and a feature_id argument. It is used to |
24
|
|
|
|
|
|
|
implement the Bio::Das->get_feature_by_name() method. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
The results() method returns a series of L<Bio::Das::Segment> objects. |
27
|
|
|
|
|
|
|
All other methods are as described in L<Bio::Das::Request>. . |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 AUTHOR |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Lincoln Stein <lstein@cshl.org>. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Copyright (c) 2003 Cold Spring Harbor Laboratory |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
36
|
|
|
|
|
|
|
it under the same terms as Perl itself. See DISCLAIMER.txt for |
37
|
|
|
|
|
|
|
disclaimers of warranty. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SEE ALSO |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
L<Bio::Das::Request::Features>, L<Bio::Das::Request>, |
42
|
|
|
|
|
|
|
L<Bio::Das::HTTP::Fetch>, L<Bio::Das::Segment>, L<Bio::Das::Type>, |
43
|
|
|
|
|
|
|
L<Bio::Das::Stylesheet>, L<Bio::Das::Source>, L<Bio::RangeI> |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
48
|
1
|
|
|
1
|
|
5
|
use Bio::Das::Type; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
49
|
1
|
|
|
1
|
|
4
|
use Bio::Das::Segment; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
73
|
|
50
|
1
|
|
|
1
|
|
5
|
use Bio::Das::Request; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
51
|
1
|
|
|
1
|
|
5
|
use Bio::Das::Util 'rearrange'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
48
|
|
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
1
|
|
5
|
use vars '@ISA'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
403
|
|
54
|
|
|
|
|
|
|
@ISA = 'Bio::Das::Request'; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub new { |
57
|
0
|
|
|
0
|
1
|
|
my $pack = shift; |
58
|
0
|
|
|
|
|
|
my ($dsn,$class,$features,$das,$callback) = rearrange([['dsn','dsns'], |
59
|
|
|
|
|
|
|
'class', |
60
|
|
|
|
|
|
|
['feature','features'], |
61
|
|
|
|
|
|
|
'das', |
62
|
|
|
|
|
|
|
'callback', |
63
|
|
|
|
|
|
|
],@_); |
64
|
0
|
|
|
|
|
|
my $qualified_features; |
65
|
0
|
0
|
0
|
|
|
|
if ($class && $das) { |
66
|
0
|
|
|
|
|
|
my $typehandler = Bio::Das::TypeHandler->new; |
67
|
0
|
|
|
|
|
|
my $types = $typehandler->parse_types($class); |
68
|
0
|
|
|
|
|
|
for my $a ($das->aggregators) { |
69
|
0
|
|
|
|
|
|
$a->disaggregate($types,$typehandler); |
70
|
|
|
|
|
|
|
} |
71
|
0
|
0
|
|
|
|
|
my $names = ref($features) ? $features : [$features]; |
72
|
0
|
|
|
|
|
|
for my $t (@$types) { |
73
|
0
|
|
|
|
|
|
for my $f (@$names) { |
74
|
0
|
|
|
|
|
|
push @$qualified_features,"$t->[0]:$f"; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} else { |
78
|
0
|
|
|
|
|
|
$qualified_features = $features; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my $self = $pack->SUPER::new(-dsn => $dsn, |
82
|
|
|
|
|
|
|
-callback => $callback, |
83
|
|
|
|
|
|
|
-args => { feature_id => $qualified_features, |
84
|
|
|
|
|
|
|
type => 'NULL', |
85
|
|
|
|
|
|
|
} ); |
86
|
0
|
0
|
|
|
|
|
$self->das($das) if defined $das; |
87
|
0
|
|
|
|
|
|
$self; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
0
|
1
|
|
sub command { 'features' } |
91
|
|
|
|
|
|
|
sub das { |
92
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
93
|
0
|
|
|
|
|
|
my $d = $self->{das}; |
94
|
0
|
0
|
|
|
|
|
$self->{das} = shift if @_; |
95
|
0
|
|
|
|
|
|
$d; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub t_DASGFF { |
99
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
100
|
0
|
|
|
|
|
|
my $attrs = shift; |
101
|
0
|
0
|
|
|
|
|
if ($attrs) { |
102
|
0
|
|
|
|
|
|
$self->clear_results; |
103
|
|
|
|
|
|
|
} |
104
|
0
|
|
|
|
|
|
delete $self->{tmp}; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
0
|
0
|
|
sub t_GFF { |
108
|
|
|
|
|
|
|
# nothing to do here |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub t_SEGMENT { |
112
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
113
|
0
|
|
|
|
|
|
my $attrs = shift; |
114
|
0
|
0
|
|
|
|
|
if ($attrs) { # segment section is starting |
115
|
0
|
|
|
|
|
|
$self->{tmp}{current_segment} = Bio::Das::Segment->new($attrs->{id},$attrs->{start}, |
116
|
|
|
|
|
|
|
$attrs->{stop},$attrs->{version}, |
117
|
|
|
|
|
|
|
$self->das,$self->dsn |
118
|
|
|
|
|
|
|
); |
119
|
|
|
|
|
|
|
} else { |
120
|
0
|
|
|
|
|
|
$self->add_object($self->{tmp}{current_segment}); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |