bin/bp_biofetch_genbank_proxy: move to Bio-DB-NCBIHelper
[bioperl-live.git] / examples / tools / gb_to_gff.pl
blobeee2ec098520a68a4b933dd14bc42593e7e4d48f
1 #!/usr/bin/perl
2 use strict;
4 use Bio::Tools::GFF;
5 use Bio::SeqIO;
7 my ($seqfile) = @ARGV;
8 die("must define a valid seqfile to read") unless ( defined $seqfile && -r $seqfile);
10 my $seqio = new Bio::SeqIO(-format => 'genbank',
11 -file => $seqfile);
12 my $count = 0;
13 while( my $seq = $seqio->next_seq ) {
14 $count++;
15 # defined a default name
16 my $fname = sprintf("%s.gff", $seq->display_id || "seq-$count");
17 my $gffout = new Bio::Tools::GFF(-file => ">$fname" ,
18 -gff_version => 1);
20 foreach my $feature ( $seq->top_SeqFeatures() ) {
21 $gffout->write_feature($feature);