Bio::Tools::GFF(3pm)
π Bio::Tools::GFF π
okay bestie, welcome to Bio::Tools::GFF(3pm) β a Bio::SeqAnalysisParserI compliant GFF format parser, straight out of the User Contributed Perl Documentation. yes it's Perl. yes it's bioinformatics. yes it's iconic. sit down, hydrate, let's go π§
β¨ NAME β¨
Bio::Tools::GFF β a Bio::SeqAnalysisParserI compliant GFF format parser. that's the whole vibe. π
πΈ SYNOPSIS πΈ
use Bio::Tools::GFF;
# specify input via -fh or -file
my $gffio = Bio::Tools::GFF->new(-fh => \*STDIN, -gff_version => 2);
my $feature;
# loop over the input stream
while($feature = $gffio->next_feature()) {
# do something with feature
}
$gffio->close();
# you can also obtain a GFF parser as a SeqAnalasisParserI in
# HT analysis pipelines (see Bio::SeqAnalysisParserI and
# Bio::Factory::SeqAnalysisParserFactory)
my $factory = Bio::Factory::SeqAnalysisParserFactory->new();
my $parser = $factory->get_parser(-input => \*STDIN, -method => "gff");
while($feature = $parser->next_feature()) {
# do something with feature
}
two whole ways to eat your GFF, bestie. pick your fighter. π«Ά
π¦ DESCRIPTION π¦
this class is your simple GFF parser and writer. in the SeqAnalysisParser sense, it takes an input file or stream and turns it into SeqFeatureI objects β but it's not in any way specific to one particular analysis program or the output that program produces. it's giving β¨versatilityβ¨.
so basically: if you can get your analysis program to spit out GFF, here is your result parser. no cap. π
π GFF3 AND SEQUENCE DATA π
GFF3 supports sequence data; see
http://www.sequenceontology.org/gff3.shtml
there are a number of ways to deal with this β
if you call
$gffio->ignore_sequence(1)
pior to parsing the sequence data is ignored. this is useful if you just want the features. it avoids the memory overhead of building and caching sequences. lowkey the frugal option. π
alternatively, you can call either
$gffio->get_seqs()
or
$gffio->seq_id_by_h()
at the end of parsing to get either a list or a hashref of Bio::Seq objects (see the documentation for each of these methods, bestie, i'm not gonna retype it all).
note that these objects will not have the features attached β you have to do this yourself, OR call
$gffio->features_attached_to_seqs(1)
prior to parsing. this will ensure that the Seqs have the features attached; i.e. you will then be able to call
$seq->get_SeqFeatures();
and use Bio::SeqIO methods. π₯
β οΈ note that auto-attaching the features to seqs will incur a higher memory overhead, because the features must be cached until the sequence data is found. your RAM has been warned. π
π TODO π
make a Bio::SeqIO class specifically for GFF3 with sequence data. it's on the list. it's been on the list. someday. π―οΈ
π 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 one of the Bioperl mailing lists. your participation is much appreciated, fr fr. π«Ά
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - 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. receipts help everybody. π
π Reporting Bugs π
report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. bug reports can be submitted the web:
https://github.com/bioperl/bioperl-live/issues
β AUTHOR - Matthew Pocock β
email mrp-at-sanger.ac.uk
πΈ CONTRIBUTORS πΈ
Jason Stajich, jason-at-biperl-dot-org β Chris Mungall, cjm-at-fruitfly-dot-org β Steffen Grossmann [SG], grossman at molgen.mpg.de β Malcolm Cook, mec-at-stowers-institute.org
the whole squad showed up. πβ¨
π§ APPENDIX π§
the rest of the documentation details each of the object methods. internal methods are usually preceded with a _ β that underscore is like the VIP rope, don't touch unless you know. π
π« new π«
- Title β
new - Usage β
my $parser = Bio::Tools::GFF->new(-gff_version => 2,
-file => "filename.gff");
or
my $writer = Bio::Tools::GFF->new(-gff_version => 3,
-file => ">filename.gff3");
- Function β creates a new instance. recognized named parameters are
-file,-fh, and-gff_version. - Returns β a new object
- Args β named parameters,
-gff_version => [1,2,3]
π« _parse_header π«
- Title β
_parse_header - Usage β
$gffio->_parse_header() - Function β used to turn parse GFF header lines. currently produces
Bio::LocatableSeqobjects from##sequence-regionlines - Returns β 1 on success
- Args β none
π« next_segment π«
- Title β
next_segment - Usage β
my $seq = $gffio->next_segment; - Function β returns a
Bio::LocatableSeqobject corresponding to a GFF##sequence-regionheader line. - Example β (none given)
- Returns β a
Bio::LocatableSeqobject, orundefif there are no more sequences. - Args β none
π« next_feature π«
- Title β
next_feature - Usage β
$seqfeature = $gffio->next_feature(); - Function β returns the next feature available in the input file or stream, or
undefif there are no more features. - Example β (none given)
- Returns β a
Bio::SeqFeatureIimplementing object, orundefif there are no more features. - Args β none
π« from_gff_string π«
- Title β
from_gff_string - Usage β
$gff->from_gff_string($feature, $gff_string); - Function β sets properties of a
SeqFeatureIobject from a GFF-formatted string. interpretation of the string depends on the version that has been specified at initialization.
this method is used by next_feature(). it actually dispatches to one of the version-specific (private) methods.
- Example β (none given)
- Returns β void
- Args β a
Bio::SeqFeatureIimplementing object to be initialized; the GFF-formatted string to initialize it from
π« _from_gff1_string π«
- Title β
_from_gff1_string - Usage β (blank)
- Function β (blank)
- Example β (blank)
- Returns β void
- Args β a
Bio::SeqFeatureIimplementing object to be initialized; the GFF-formatted string to initialize it from
π« _from_gff2_string π«
- Title β
_from_gff2_string - Usage β (blank)
- Function β (blank)
- Example β (blank)
- Returns β void
- Args β a
Bio::SeqFeatureIimplementing object to be initialized; the GFF2-formatted string to initialize it from
π« write_feature π«
- Title β
write_feature - Usage β
$gffio->write_feature($feature); - Function β writes the specified
SeqFeatureIobject in GFF format to the stream associated with this instance. - Returns β none
- Args β an array of
Bio::SeqFeatureIimplementing objects to be serialized
π« gff_string π«
- Title β
gff_string - Usage β
$gffstr = $gffio->gff_string($feature); - Function β obtain the GFF-formatted representation of a
SeqFeatureIobject. the formatting depends on the version specified at initialization.
this method is used by write_feature(). it actually dispatches to one of the version-specific (private) methods.
- Example β (none given)
- Returns β a GFF-formatted string representation of the SeqFeature
- Args β a
Bio::SeqFeatureIimplementing object to be GFF-stringified
π« _gff1_string π«
- Title β
_gff1_string - Usage β
$gffstr = $gffio->_gff1_string - Function β (blank)
- Example β (blank)
- Returns β a GFF1-formatted string representation of the SeqFeature
- Args β a
Bio::SeqFeatureIimplementing object to be GFF-stringified
π« _gff2_string π«
- Title β
_gff2_string - Usage β
$gffstr = $gffio->_gff2_string - Function β (blank)
- Example β (blank)
- Returns β a GFF2-formatted string representation of the SeqFeature
- Args β a
Bio::SeqFeatureIimplementing object to be GFF2-stringified
π« _gff25_string π«
- Title β
_gff25_string - Usage β
$gffstr = $gffio->_gff2_string - Function β to get a format of GFF that is peculiar to Gbrowse/
Bio::DB::GFF - Example β (blank)
- Returns β a GFF2.5-formatted string representation of the SeqFeature
- Args β a
Bio::SeqFeatureIimplementing object to be GFF2.5-stringified
π« _gff3_string π«
- Title β
_gff3_string - Usage β
$gffstr = $gffio->_gff3_string - Function β (blank)
- Example β (blank)
- Returns β a GFF3-formatted string representation of the SeqFeature
- Args β a
Bio::SeqFeatureIimplementing object to be GFF3-stringified
π« gff_version π«
- Title β
_gff_version - Usage β
$gffversion = $gffio->gff_version - Function β (blank)
- Example β (blank)
- Returns β the GFF version this parser will accept and emit.
- Args β none
π« newFh π«
- Title β
newFh - Usage β
$fh = Bio::Tools::GFF->newFh(-file=>$filename,-format=>'Format') - Function β does a
new()followed by anfh() - Example β
$fh = Bio::Tools::GFF->newFh(-file=>$filename,-format=>'Format')
$feature = <$fh>; # read a feature object
print $fh $feature; # write a feature object
- Returns β filehandle tied to the
Bio::Tools::GFFclass - Args β (blank)
π« fh π«
- Title β
fh - Usage β
$obj->fh - Function β (blank)
- Example β
$fh = $obj->fh; # make a tied filehandle
$feature = <$fh>; # read a feature object
print $fh $feature; # write a feature object
- Returns β filehandle tied to
Bio::Tools::GFFclass - Args β none
π« get_seqs π«
- Title β
get_seqs - Usage β (blank)
- Function β returns all
Bio::Seqobjects populated by GFF3 file - Example β (blank)
- Returns β (blank)
- Args β (blank)
π« features_attached_to_seqs π«
- Title β
features_attached_to_seqs - Usage β
$obj->features_attached_to_seqs(1); - Function β for use with GFF3 containing sequence only
setting this before parsing ensures that all Bio::Seq object created will have the appropriate features added to them
defaults to false (off)
note that this mode will incur higher memory usage because features will have to be cached until the relevant feature comes along. π
- Example β (blank)
- Returns β value of
features_attached_to_seqs(a boolean) - Args β on set, new value (a boolean, optional)
π« ignore_sequence π«
- Title β
ignore_sequence - Usage β
$obj->ignore_sequence(1); - Function β for use with GFF3 containing sequence only
setting this before parsing means that all sequence data will be ignored
- Example β (blank)
- Returns β value of
ignore_sequence(a boolean) - Args β on set, new value (a boolean, optional)
and that's the whole page, bestie. mwah. π«Άβ¨
this little number came to you courtesy of perl v5.32.1, dated 2021-08-15 β go forth, parse some GFF, and stay hydrated. πππ¦
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms