GenOO
view release on metacpan or search on metacpan
lib/GenOO/Data/File/GFF.pm view on Meta::CPAN
# POD documentation - main docs before the code
=head1 NAME
GenOO::Data::File::GFF - Object implementing methods for accessing GFF formatted files (http://www.sanger.ac.uk/resources/software/gff/spec.html)
=head1 SYNOPSIS
# Object that manages a gff file.
# To initialize
my $gff_file = GenOO::Data::File::GFF->new(
file => undef,
);
=head1 DESCRIPTION
This object offers methods to read a gff file line by line.
=head1 EXAMPLES
# Create object
my $gff_file = GenOO::Data::File::GFF->new(
file => 't/sample_data/sample.gff.gz'
);
# Read one record at a time
my $record = $gff_file->next_record();
=cut
# Let the code begin...
package GenOO::Data::File::GFF;
$GenOO::Data::File::GFF::VERSION = '1.5.2';
#######################################################################
####################### Load External modules #####################
#######################################################################
use Modern::Perl;
use autodie;
use Moose;
use namespace::autoclean;
#######################################################################
######################### Load GenOO modules ######################
#######################################################################
use GenOO::Data::File::GFF::Record;
#######################################################################
####################### Interface attributes ######################
#######################################################################
has 'file' => (
isa => 'Maybe[Str]',
is => 'rw',
required => 1
);
has 'records_read_count' => (
traits => ['Counter'],
is => 'ro',
isa => 'Num',
default => 0,
handles => {
_inc_records_read_count => 'inc',
_reset_records_read_count => 'reset',
},
);
#######################################################################
######################## Private attributes #######################
#######################################################################
has '_filehandle' => (
is => 'ro',
builder => '_open_filehandle',
init_arg => undef,
lazy => 1,
);
has '_eof_reached' => (
is => 'rw',
default => 0,
init_arg => undef,
lazy => 1,
);
has '_header' => (
is => 'ro',
default => sub {{}},
init_arg => undef,
lazy => 1,
);
has '_cached_records' => (
traits => ['Array'],
is => 'ro',
isa => 'ArrayRef[GenOO::Data::File::GFF::Record]',
( run in 0.566 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )