Bio::GFF3::LowLevel::Parser - a fast, low-level gff3 parser
my $p = Bio::GFF3::LowLevel::Parser->new( $file_or_fh ); while( my $i = $p->next_item ) { if( exists $i->{seq_id} ) { ## $i is a feature in the same format as returned by ## Bio::GFF3::LowLevel::gff3_parse_feature. do something with ## it } elsif( $i->{directive} ) { if( $i->{directive} eq 'FASTA' ) { my $fasta_filehandle = $i->{filehandle}; ## parse the FASTA in the filehandle with BioPerl or ## however you want. or ignore it. } elsif( $i->{directive} eq 'gff-version' ) { print "it says it is GFF version $i->{value}\n"; } elsif( $i->{directive} eq 'sequence-region' ) { print( "found a sequence-region, sequence $i->{seq_id},", " from $i->{start} to $i->{end}\n" ); } } elsif( $i->{comment} ) { ## this is a comment in your GFF3 file, in case you want to do ## something with it. print "that comment said: '$i->{comment}'\n"; } else { die 'this should never happen!'; } }
This is a fast, low-level parser for Generic Feature Format, version 3 (GFF3). It is a low-level parser, it only returns dumb hashrefs. It does reconstruct feature hierarchies, however, using features' ID/Parent attributes.
Features are returned in the same format as "gff3_parse_feature" in Bio::GFF3::LowLevel, with an additional child_features key containing an arrayref of child features. Each of those features also have child_features arrayrefs.
child_features
For convenience, all features returned by this parser have child_features arrayrefs, which may be empty.
Directives are returned in the same format as "gff3_parse_directive" in Bio::GFF3::LowLevel.
Comments are parsed into a hashref of the form:
{ comment => 'text of the comment, not including the hash mark(s) and ending newline' }
Make a new parser object that will parse the GFF3 in all of the files or filehandles that you give it.
Iterate through all of the items (features, directives, and comments) in the file(s) given to the parser. Each item is a returned as a hashref.
Robert Buels <rmb32@cornell.edu>
This software is copyright (c) 2012 by Robert Buels.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Bio::GFF3::LowLevel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bio::GFF3::LowLevel
CPAN shell
perl -MCPAN -e shell install Bio::GFF3::LowLevel
For more information on module installation, please visit the detailed CPAN module installation guide.