[Bioperl-l] Bio::DB::DBFetch question

Jason Stajich jason at cgt.duhs.duke.edu
Thu May 27 11:57:17 EDT 2004


Sean - I think there is something wrong with Heikki's module code - the
hosts hash is not setup and there doesn't even seem to be reference to how
to delegate to the proper server.  I don't know what happened but Heikki
will have to look at it to figure out

I would do what you want instead using Bio::DB::EMBL.

#!/usr/bin/perl -w
use strict;
use Bio::DB::DBFetch;
use Bio::DB::EMBL;
use Bio::SeqIO;

open (IN, "est-id.txt") || die "can't open input file $! \n";
# get filehandle to file containing list of id's

my $db = Bio::DB::EMBL->new();    # make a new connection to EMBL

my @list;
while(<IN>) {
    my ($id) = split;
    push @list, $id;
}
my $seqio = $db->get_Stream_by_id(\@list);    # get stream obj using arrayref

my $out = Bio::SeqIO->new(-file => ">est-id.fa", -format => 'Fasta'); # specify output format

while ( my $seq = $seqio->next_seq() ) {
    $out->write_seq($seq);
}  # do the conversion

On Thu, 27 May 2004, Sean O'Keeffe wrote:

> Hi There,
> I'm trying to convert a list of genbank/est ids to fasta sequences. I
> want to use the Bio::DB::DBFetch module.
> Script I have written/plagiarised is as follows:
>
> #!/usr/bin/perl
>
> use lib "/usr/local/ensembl-20/bioperl-live";
> use Bio::DB::DBFetch;
> use Bio::SeqIO;
>
> open (IN, "est-id.txt") || die "can't open input file $! \n";     # get
> filehandle to file containing list of id's
>
> my $db = Bio::DB::DBFetch->new();    # make a new connection to DBFetch
>
> my $seqio = $db->get_Stream_by_id(<IN>);    # get stream obj using
> filehandle
>
> my $out = Bio::SeqIO->new(-file => ">est-id.fa", -format => 'Fasta');
> # specify output format
>
> while ( my $seq = $seqio->next_seq() ) {$out->write_seq($seq); }    # do
> the conversion
>
>
>
>
> Error to stdout is as follows:
>
> "Can't use string ("") as a HASH ref while "strict refs" in use at
> /usr/local/ensembl-20/bioperl-live/Bio/DB/DBFetch.pm line 286, <IN> line
> 4515188."
>
>
> I've used the filename, filehandle (as shown) as well as an array
> reference to the id list.
> A sample of the file list is below
>
> AA000575
> AA001887
> AA002222
> AA003931
> AA004784
> AA009419
> AA009723
> AA010084
> AA010160
> AA010193
> AA010220
> AA010230
> AA012989
> AA014259
> AA018136
> AA018184
> AA018858
> AA019868
> AA020505
> AA022701
> AA023333
>
> Can anyone open my eyes?
> Thanks,
> Sean.
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list