[Bioperl-l] Problem using Bio::DB::Query::GenBank;

Kevin Brown Kevin.M.Brown at asu.edu
Fri Feb 2 15:52:20 UTC 2007


It looks like you have some problems with the code you posted.

use Bio::DB::Query::GenBank;
use strict;
use warnings;

open (READER_1,"list.txt") || die "\n I can't open the file READER_1
!!\n"; my @a1=<READER_1>; close (READER_1);

for (my $i=0; $i < @a1;$i++ ) {
        
# is this necessary as you don't seem to use it anywhere later in your
code.
my @a1_s=split/\s+/,$a1[$i];

# you enclosed the variable in '' which means perl won't evaluate it
# changed the query so that perl can evaluate the variable
my $query_string = ' Homo Sapiens[Organism] AND '.$a1[$i] .' '; 
   my $query = Bio::DB::Query::GenBank->new(-db=>'Protein',

-query=>$query_string
                                            );
   my $count = $query->count;
   my @ids   = $query->ids;


print " gene: $a1[$i] first id is $ids[0]  o no? \n";

-----Original Message-----
From: bioperl-l-bounces at lists.open-bio.org
[mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of Luba Pardo
Sent: Friday, February 02, 2007 7:31 AM
To: bioperl-l at lists.open-bio.org
Subject: [Bioperl-l] Problem using Bio::DB::Query::GenBank;

Hello, (I am using bioperl-1.5.2_100, linux machine) I am trying to get
the ids of a list of genes using the module Bio::DB::Query:GenBank. I
have the following code:

use Bio::DB::Query::GenBank;
use strict;
use warnings;

open (READER_1,"list.txt") || die "\n I can't open the file READER_1
!!\n"; my @a1=<READER_1>; close (READER_1);

for (my $i=0; $i<=$#a1;$i=$i+1 ) {
        my @a1_s=split/\s+/,$a1[$i];

my $query_string = ' Homo Sapiens[Organism] AND $a1[$i] ';
   my $query = Bio::DB::Query::GenBank->new(-db=>'Protein',

-query=>$query_string
                                            );
   my $count = $query->count;
   my @ids   = $query->ids;


print " gene: $a1[$i] first id is $ids[0]  o no? \n";

I want to tell the program to get all the genes contained in the file
list.txt and to retrieve the ids from GenBank. However the program gives
me the following error:

------------EXCEPTION: Bio::Root::Exception -------------
MSG: Id list has been truncated even after maxids requested
STACK: Error::throw
STACK: Bio::Root::Root::throw
/usr/lib/perl5/site_perl/5.8.1/Bio/Root/Root.pm:359
STACK: Bio::DB::Query::WebQuery::_fetch_ids
/usr/lib/perl5/site_perl/5.8.1/Bio/DB/Query/WebQuery.pm:236
STACK: Bio::DB::Query::WebQuery::ids
/usr/lib/perl5/site_perl/5.8.1/Bio/DB/Query/WebQuery.pm:200
STACK: query.pl:27
------------------
Is that a problem if I try to use the $a1[$i] to replace the name of the
gene?
I thank before hand for the attention you may pay to this message
Regards, Luba Pardo _______________________________________________
Bioperl-l mailing list
Bioperl-l at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list