1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
package Bio::GMOD::DB::Adapter::FeatureIterator;
=pod
=head1 NAME
Bio::GMOD::DB::Adaptor::FeatureIterator
=head1 SYNOPSYS
my $iterator = Bio::GMOD::DB::Adaptor::FeatureIterator->new(\@features);
while (my $feat = $iterator->next_feature() ) {
#do stuff with the feature
}
=head1 DESCRIPTION
This is a very simple feature iterator with only two methods: new and
next_feature. To use it, you pass in a reference to an array of
Bio::SeqFeatureI compliant feature objects, and subsequent invocations
of next_feature on the iterator object will give back one feature
object until there are no feature objects, when it will return nothing.
=head1 AUTHOR
=head1 AUTHOR - Scott Cain
Email cain@cshl.org
=cut
sub new {
my $package = shift;
my $features = ref $_[0] eq 'ARRAY' ? shift : [@_];
return bless $features,$package;
}
sub next_feature {
my $self = shift;
return unless @$self;
my $next_feature = shift @$self;
return $next_feature;
}
1;
|