NAME

Bio::FeatureIO::gff - read/write GFF feature files

SYNOPSIS

my $feature; #get a Bio::SeqFeature::Annotated somehow
my $featureOut = Bio::FeatureIO->new(
  -format => 'gff',
  -version => 3,
  -fh => \*STDOUT,
  -validate_terms => 1, #boolean. validate ontology terms online?  default 0 (false).
);
$featureOut->write_feature($feature);

DESCRIPTION

Currently implemented:

version         read?   write?
------------------------------
GFF 1             N       N
GFF 2             N       N
GFF 2.5 (GTF)     N       Y
GFF 3             Y       Y

FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.

bioperl-l@bioperl.org                 - General discussion
http://bioperl.org/wiki/Mailing_list  - About the mailing lists

Support

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:

http://bugzilla.open-bio.org/

AUTHOR

Allen Day, <allenday@ucla.edu>

CONTRIBUTORS

Steffen Grossmann, <grossman@molgen.mpg.de>
Scott Cain, <cain@cshl.edu>
Rob Edwards <rob@salmonella.org>

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

next_feature()

Usage   : my $feature = $featureio->next_feature();
Function: reads a feature record from a GFF stream and returns it as an object.
Returns : a Bio::SeqFeature::Annotated object
Args    : N/A

next_feature_group

Title   : next_feature_group
Usage   : @feature_group = $stream->next_feature_group
Function: Reads the next feature_group from $stream and returns it.

          Feature groups in GFF3 files are separated by '###' directives. The
          features in a group might form a hierarchical structure. The
          complete hierarchy of features is returned, i.e. the returned array
          represents only the top-level features.  Lower-level features can
          be accessed using the 'get_SeqFeatures' method recursively.

Example : # getting the complete hierarchy of features in a GFF3 file
          my @toplevel_features;
          while (my @fg = $stream->next_feature_group) {
              push(@toplevel_features, @fg);
          }
Returns : an array of Bio::SeqFeature::Annotated objects
Args    : none

next_seq()

access the FASTA section (if any) at the end of the GFF stream. note that this method will return undef if not all features in the stream have been handled

write_feature()

Usage   : $featureio->write_feature( Bio::SeqFeature::Annotated->new(...) );
Function: writes a feature in GFF format.  the GFF version used is governed by the
          '-version' argument passed to Bio::FeatureIO->new(), and defaults to GFF
          version 3.
Returns : ###FIXME
Args    : a Bio::SeqFeature::Annotated object.

ACCESSORS

fasta_mode()

Usage   : $obj->fasta_mode($newval)
Function: 
Example : 
Returns : value of fasta_mode (a scalar)
Args    : on set, new value (a scalar or undef, optional)

Side effect when setting: rewind the file handle a little bit to get the last carriage return that was swallowed when the previous line was processed.

seqio()

Usage   : $obj->seqio($newval)
Function: holds a Bio::SeqIO instance for handling the GFF3 ##FASTA section.
Returns : value of seqio (a scalar)
Args    : on set, new value (a scalar or undef, optional)

sequence_region()

Usage   :
Function: ###FIXME
Returns : 
Args    :

so()

Usage   : $obj->so($newval)
Function: holds a Sequence Ontology instance
Returns : value of so (a scalar)
Args    : on set, new value (a scalar or undef, optional)

validate()

Usage   : $obj->validate($newval)
Function: true if encountered ontology terms in next_feature()
          mode should be validated.
Returns : value of validate (a scalar)
Args    : on set, new value (a scalar or undef, optional)

version()

Usage   : $obj->version($newval)
Function: version of GFF to read/write.  valid values are 1, 2, 2.5, and 3.
Returns : value of version (a scalar)
Args    : on set, new value (a scalar or undef, optional)

INTERNAL METHODS

_buffer_feature()

Usage   :
Function: ###FIXME
Returns : 
Args    :

_handle_directive()

this method is called for lines beginning with '##'.

_handle_feature()

this method is called for each line not beginning with '#'. it parses the line and returns a Bio::SeqFeature::Annotated object.

_handle_non_reserved_tag()

Usage   : $self->_handle_non_reserved_tag($feature,$tag,$value)
Function: Deal with non-reserved word tags in the ninth column
Returns : An updated Bio::SeqFeature::Annotated object
Args    : A Bio::SeqFeature::Annotated and a tag/value pair

Note that this method can be overridden in a subclass to provide special handling of non-reserved word tags.

organism

Gets/sets the organims from the organism directive

_write_feature_1()

write a feature in GFF v1 format. currently not implemented.

_write_feature_2()

write a feature in GFF v2 format. currently not implemented.

_write_feature_25()

write a feature in GFF v2.5 (aka GTF) format.

_write_feature_3()

write a feature in GFF v3 format.