Bio-MAGETAB
view release on metacpan or search on metacpan
lib/Bio/MAGETAB/Util/Reader/ADF.pm view on Meta::CPAN
seek( $adf_fh, 0, 0 ) or croak("Error seeking within ADF filehandle: $!\n");
my ( $larry, @rows );
FILE_LINE:
while ( $larry = $self->getline($adf_fh) ) {
# Skip empty lines, comments.
next FILE_LINE if $self->can_ignore( $larry );
# Strip surrounding whitespace from each element.
$larry = $self->strip_whitespace( $larry );
my ( $tag, @values ) = @$larry;
next FILE_LINE if ( $tag =~ /\A \[ [ ]* header [ ]* \] \z/ixms );
last FILE_LINE if ( $tag =~ /\A \[ [ ]* (?:main|mapping) [ ]* \] \z/ixms );
# Strip off empty trailing values.
my $end_value;
until ( defined($end_value) && $end_value !~ /\A \s* \z/xms ) {
$end_value = pop(@$larry);
}
push @$larry, $end_value;
# Reset empty strings to undefs.
foreach my $value ( @$larry ) {
undef($value) if ( defined($value) && $value eq q{} );
}
push @rows, $larry;
}
$self->confirm_full_parse( $larry );
return \@rows;
}
# Make the classes immutable. In theory this speeds up object
# instantiation for a small compilation time cost.
__PACKAGE__->meta->make_immutable();
no Moose;
=head1 NAME
Bio::MAGETAB::Util::Reader::ADF - ADF parser class.
=head1 SYNOPSIS
use Bio::MAGETAB::Util::Reader::ADF;
my $parser = Bio::MAGETAB::Util::Reader::ADF->new({
uri => $adf_filename,
});
my $array_design = $parser->parse();
=head1 DESCRIPTION
This class is used to parse ADF files. It can be used on its own, but
more often you will want to use the main Bio::MAGETAB::Util::Reader
class which handles extended parsing options more transparently.
=head1 ATTRIBUTES
See the L<TagValueFile|Bio::MAGETAB::Util::Reader::TagValueFile> class for superclass attributes.
=over 2
=item magetab_object
A Bio::MAGETAB::ArrayDesign object. This can either be set upon
instantiation, or a new object will be created for you. It can be
retrieved at any time using C<get_magetab_object>.
=back
=head1 METHODS
=over 2
=item parse
Parse the ADF pointed to by C<$self-E<gt>get_uri()>. Returns the
Bio::MAGETAB::ArrayDesign object updated with the ADF contents.
=back
=head1 SEE ALSO
L<Bio::MAGETAB::Util::Reader::TagValueFile>
L<Bio::MAGETAB::Util::Reader::Tabfile>
L<Bio::MAGETAB::Util::Reader>
L<Bio::MAGETAB::ArrayDesign>
=head1 AUTHOR
Tim F. Rayner <tfrayner@gmail.com>
=head1 LICENSE
This library is released under version 2 of the GNU General Public
License (GPL).
=cut
1;
( run in 3.852 seconds using v1.01-cache-2.11-cpan-7fcb06a456a )