[Bioperl-l] More help....

Jonathan Greenwood jegreenwood25 at hotmail.com
Thu Feb 19 13:50:05 EST 2004


Hi, this combines CGI and BioPerl, what i need to do is open a Genbank file
and then parse(write out) the features. But I need these parsed features to
go into a textbox for editing, and then be able to save the data I have just
edited...Please Help!!! Many thanks...the code is enclosed with the
email....

Jonathan Greenwood
email: jonathon at mgcheo.med.uottawa.ca

Code:
#! /usr/local/bin/perl -wT

use strict;
use CGI qw / :standard /;
use CGI::Pretty;
use Bio::SeqIO;
use Bio::SeqFeature::Generic;
use Bio::Location::Simple;
use Bio::Location::SplitLocationI;

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

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

print h1('Plasmid Feature Editor');

print p('Load up a Genbank file to work with, then edit the features in the
text box.');

print start_multipart_form(),
  table({-cellpadding => 10},
	TR({-class=> 'resultsbody'},
	   td(textarea('-name'     => 'editarea',
		       '-value'    => (@features),
		       '-rows'     => 20,
		       '-cols'     => 70,
		       '-override' => (@features) || (param('clear')),
		       ),
	     ),
	  ),
	TR({-class=>'resultstitle'},
	   td(filefield(-name    => 'uploaded_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'),
	     ),
	   td(reset(),
	     ),
	  ),
       ),
  end_form;

print end_html;

exit;

sub read_file {
my $fh = param('uploaded_file');
my $gb_parser = Bio::SeqIO->new(-fh=>$fh,-format=>'genbank');
my @features;
while (my $seq = $gb_parser->next_seq) {
	push @features,$seq->get_all_SeqFeatures();
} return @features;
}

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca



More information about the Bioperl-l mailing list