Gono has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, by using the following code, I want printed data to be displayed in the text box...but all that I get within the textbox is the following: Bio::SeqFeature::Generic=HASH(0x6547e0), etc. Please Help!
Many thanks! Code: #! /usr/local/bin/perl -wT use strict; use CGI qw / :standard /; use CGI::Pretty; use Bio::SeqIO; use Bio::Root::IO; use Bio::SeqFeature::Generic; use Bio::Location::Simple; use Bio::Location::SplitLocationI; use File::Temp; my @features = read_file(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 i +n the text box.'); print <<END; <BODY BGCOLOR = "#ffffcc"> END 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 => '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 <<FINISH; </BODY> FINISH 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_all_SeqFeatures(); } return @features; }

Edited by Chady -- added code tags.

Replies are listed 'Best First'.
Re: Displaying data?
by Happy-the-monk (Canon) on Mar 10, 2004 at 18:50 UTC

    it seems that where you do the
    push @features, $seq->get_all_SeqFeatures();
    part, you are pushing a hash reference onto the array, but you thought it was some string data.

    you should find out:

    use Data::Dumper; # goes somewhere at the top of the script. then... print Dumper \@features; # goes right before the return @features;stat +ement.

    Sören