blib/lib/Bio/Graphics/FeatureFile/Iterator.pm untested

filter: Statementstmt 0.0% 0 / 8 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 16 CC 2 SCAR 13.9
CC
2
Cov
0%
next_seq
6.0
new
2.0
rewind
2.0
CRAP 4.0
1 package Bio::Graphics::FeatureFile::Iterator;
2  
3 =head1 NAME
4  
5 Bio::Graphics::FeatureFile::Iterator -- Iterator across a Bio::Graphics::FeatureFile
6  
7 =head1 SYNOPSIS
8  
9 use Bio::Graphics::FeatureFile;
10 my $data = Bio::Graphics::FeatureFile->new(-file => 'features.txt');
11 my $iterator = $data->get_seq_stream;
12 while (my $feature = $iterator->next_seq) {
13 print $feature->display_id,"\t",$feature->start,"\t",$feature->end,"\n";
14 }
15  
16 =head1 DESCRIPTION
17  
18 This is a Bio::SeqIO-like object that recognizes the next_seq() and
19 next_feature() methods. The two methods are synonymous.
20  
21 There is also a rewind() method which will start iterating from the
22 beginning again.
23  
24 =head1 SEE ALSO
25  
26 L<Bio::Graphics::Panel>,
27 L<Bio::Graphics::Glyph>,
28 L<Bio::Graphics::Feature>,
29 L<Bio::Graphics::FeatureFile>
30  
31 =head1 AUTHOR
32  
33 Lincoln Stein E<lt>lstein@cshl.orgE<gt>.
34  
35 Copyright (c) 2001 Cold Spring Harbor Laboratory
36  
37 This library is free software; you can redistribute it and/or modify
38 it under the same terms as Perl itself. See DISCLAIMER.txt for
39 disclaimers of warranty.
40  
41 =cut
42  
43 sub new {
44 my $package = shift;
45 return bless {features => shift,
46 index => 0},$package;
47 }
48  
49 sub next_seq {
50 my $self = shift;
51 return unless $self->{features};
52 return $self->{features}[$self->{index}++];
53 }
54  
55 *next_features = \&next_seq;
56  
57 sub rewind {
58 my $self = shift;
59 $self->{index} = 0;
60 }
61  
62 1;