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

by the way I hate this Bioperl stuff but I'm having problem making a Genbank file into a hash using bioperl, this is what I have
use Bio::SeqIO; use strict; my $seqio= ''; my $seqobj= ''; my $seq_stats= ''; my %hash=(); my $seq=''; my $seqio = Bio::SeqIO ->new(-file=> "GenBank_Records.txt", -format => 'genbank'); print "Enter Acc number"; $acc=<STDIN>; chomp $acc; $hash{$seq->accession_number}= $seq->seq; print $hash{$acc}; exit;

Replies are listed 'Best First'.
Re: bioperl genbank into a hash
by NetWallah (Canon) on Aug 15, 2011 at 02:05 UTC
    $seq is a scalar that has been assigned the value of an empty string.

    Your code is attempting to access $seq as an object.

    I think what you need to do is to use the object $seqio instead, so your code should read:

    $hash{ $seqio->accession_number() }= $seqio->seq();
    Also - it would be helpful to indicate what error you are getting. "I'm having a problem" is rather imprecise.

                "XML is like violence: if it doesn't solve your problem, use more."

Re: bioperl genbank into a hash
by Cristoforo (Curate) on Aug 15, 2011 at 00:07 UTC
    I am not famailiar with Bio modules, but found some here that may get the accession number you want to find.
Re: bioperl genbank into a hash
by pvaldes (Chaplain) on Aug 15, 2011 at 10:41 UTC
    ...and Global symbol "$acc" requires explicit package name: my $acc=<STDIN>; What's the problem exactly?