[Bioperl-l] Parsing features

Jonathon Greenwood jonathon at mgcheo3.med.uottawa.ca
Fri Mar 12 09:08:43 EST 2004

Hi all!

I'm wondering if it is possible to extract the features from a Genbank
file and print out the feature information within a text box (I'm dealing
with the text of the feature I don't want to display them as a glyph). I
tried this already using the Dumper method...but it spews out too much
information. I also get the errors when I run the code(which is for this
Bio::SeqFeature::Generic=HASH(0x654788) a bunch of times... and
(in cleanup) Undefined subroutine Fh:flush at
/usr/local/lib/perl5/site_perl/5.8.0/Bio/Root/IO.pm line 519

Thanks for any help that can be given...

Jonathan Greenwood
Co-op student,
email: jonathon at mgcheo.med.uottawa.ca


#! /usr/local/bin/perl -w

use strict;
use CGI qw / :standard /;
use CGI::Pretty;
use Bio::SeqFeature::Generic;
use Bio::SeqIO;
use Bio::Root::IO;
use File::Temp;

my @features = read_file(param('file'));

print header, start_html('Plasmid Feature Editor');

print start_multipart_form (),
table ({-cellpadding => 10},
TR({-class => 'resultsbody'},
	td (textarea(-name => 'editarea',
		     -values => "@features",
		     -rows   => 20,
		     -cols   => 70,
		     -override => (@features) || (param('clear')),
TR({-class => 'resultstitle'},
td (filefield(-name => 'file',
	      -length => 40),

td(submit(-name => 'submit_button',
	  -value => 'Click to display features'),
TR({-class => 'resultstitle'},
td(submit(-name => 'save_button',
	  -value => 'Click here to save your work'),

print end_html;

exit 0;

sub read_file {

my $fh = param('file');
my $gb_parser = Bio::SeqIO->new(-fh=>$fh,-format=>'Genbank');
my @features;

while (my $seq = $gb_parser-> next_seq) {
	push @features, $seq->get_SeqFeatures();
return @features;

More information about the Bioperl-l mailing list