File: ReadIterator.pm

package info (click to toggle)
libbio-samtools-perl 1.43-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 736 kB
  • sloc: perl: 2,210; ansic: 74; makefile: 20
file content (21 lines) | stat: -rw-r--r-- 402 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package Bio::DB::Bam::ReadIterator;

use strict;

sub new {
    my $self = shift;
    my ($sam,$bam,$filter) = @_;
    return bless {sam   => $sam,
		  bam   => $bam,
		  filter=> $filter},ref $self || $self;
}
sub next_seq {
    my $self = shift;
    while (my $b = $self->{bam}->read1) {
	return Bio::DB::Bam::AlignWrapper->new($b,$self->{sam})
	    if $self->{filter}->($b);
    }
    return;
}

1;