| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::Das::FeatureIterator; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
37
|
|
|
4
|
|
|
|
|
|
|
require Exporter; |
|
5
|
1
|
|
|
1
|
|
6
|
use Carp 'croak'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
51
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
231
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.01'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Bio::Das::FeatureIterator - Iterate over a set of Bio::Das::Features |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $iterator = $das->features(-dsn => ['http://www.wormbase.org/db/das/elegans', |
|
17
|
|
|
|
|
|
|
'http://dev.wormbase.org/db/das/elegans' |
|
18
|
|
|
|
|
|
|
], |
|
19
|
|
|
|
|
|
|
-segment => ['I:1,10000','II:1,10000'], |
|
20
|
|
|
|
|
|
|
-category => 'transcription', |
|
21
|
|
|
|
|
|
|
-iterator => 1, |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
while (my $feature = $iterator=>next_seq) { |
|
24
|
|
|
|
|
|
|
print $feature,"\n"; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
When the Bio::Das->features() method is called with the B<-iterator> |
|
30
|
|
|
|
|
|
|
argument, the method will return an iterator over the features |
|
31
|
|
|
|
|
|
|
returned from the various data sources. Each feature can be returned |
|
32
|
|
|
|
|
|
|
by calling next_seq() iteratively until the method returns undef. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
This is not as neat as it seems, because it works by creating all the |
|
35
|
|
|
|
|
|
|
features in advance and storing them in memory. For true pipelined |
|
36
|
|
|
|
|
|
|
access to the features, call features() with a callback subroutine. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub new { |
|
41
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
42
|
0
|
0
|
|
|
|
|
$class = ref($class) if ref($class); |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $features = shift; |
|
45
|
0
|
|
|
|
|
|
return bless {responses=>$features},$class; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub next_seq { |
|
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return shift @{$self->{next_result}} |
|
|
0
|
|
|
|
|
|
|
|
52
|
0
|
0
|
0
|
|
|
|
if $self->{next_result} && @{$self->{next_result}}; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
while (1) { |
|
55
|
0
|
0
|
|
|
|
|
return unless @{$self->{responses}}; |
|
|
0
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $response = shift @{$self->{responses}}; |
|
|
0
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
if ($response->can('results')) { |
|
58
|
0
|
|
|
|
|
|
my @r = $response->results; |
|
59
|
0
|
|
|
|
|
|
$self->{next_result} = \@r; |
|
60
|
0
|
0
|
|
|
|
|
return shift @{$self->{next_result}} if @{$self->{next_result}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} else { |
|
62
|
0
|
|
|
|
|
|
return $response; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Lincoln Stein <lstein@cshl.org>. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Copyright (c) 2001 Cold Spring Harbor Laboratory |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
74
|
|
|
|
|
|
|
it under the same terms as Perl itself. See DISCLAIMER.txt for |
|
75
|
|
|
|
|
|
|
disclaimers of warranty. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L<Bio::Das::Request>, L<Bio::Das::HTTP::Fetch>, |
|
80
|
|
|
|
|
|
|
L<Bio::Das::Segment>, L<Bio::Das::Type>, L<Bio::Das::Stylesheet>, |
|
81
|
|
|
|
|
|
|
L<Bio::Das::Source>, L<Bio::RangeI> |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |