[Bioperl-l] problem with bioperl on UNIX

Jason Stajich jason at cgt.mc.duke.edu
Thu Feb 6 14:01:02 EST 2003


It is possible genbank is/was rejecting queries - I am able to execute
your query on a linux box.  I had trouble yesterday  trying to run your
code though.  It is possible that GenBank was having problems when you
last tried to execute your code.

#!/usr/bin/perl -w
use strict;
use Bio::DB::Query::GenBank;

my $query_string = 'Gallus gallus[organism]';

my $query = Bio::DB::Query::GenBank->new(-db   => 'protein',
				      -query=>$query_string);
my $count = $query->count;
print "COUNT is $count\n";

I get:

COUNT is 7742


-jason

On Thu, 6 Feb 2003, Prachi Shah wrote:

> Thanks Simon and Matthew for your tips. dos2unix did
> not make a difference. I am using perl 5.6.0 with
> bioperl 1.2, so its the latest. No proxy on the
> machine and the strange thing is.....when I use LWP
> useragent directly to connect to NCBI Entrez, it
> works. But with Bio::DB::Query::GenBank it still gives
> me the error:
>
> Use of uninitialized value in concatenation (.) at
> tryBioPerl.pl line 18.
> COUNT
> Can't use an undefined value as an ARRAY reference at
> /home/pss11/Perl/bioperl-1.2/lib/site_perl/5.6.0/Bio/DB/Query/WebQuery.pm
> line 204.
>
> Any more ideas are very welcome...
> Thanks,
> Prachi.
>
> # In case you need the code....see at the end.
>
> --- "simon andrews (BI)" <simon.andrews at bbsrc.ac.uk>
> wrote:
> >
> > > -----Original Message-----
> > > From: Prachi Shah
> > > Subject: [Bioperl-l] problem with bioperl on UNIX
> > >
> > > It works perfectly fine on the Win perl setup,
> > > but when I use it on the UNIX system it gives me
> > the
> > > following error:
> > >
> >
> > I just ran your code directly on our system, and it
> > worked fine; not so much as a warning.  This was
> > using BioPerl 1.2 under Linux, Perl 5.6.0.
> >
> > It looks as though your query setup is going wrong.
> > Your first error:
> >
> > > Use of uninitialized value in concatenation (.) at
> > > tryBioPerl.pl line 18.
> >
> > ..comes from $count being undef, which means that
> > the $query->count didn't return anything.  The call
> > to Bio::DB::Query must have worked though otherwise
> > you'd have got a warning saying "can't call count on
> > an undefined value", so your problem is that your
> > query worked, but no hits were returned.  There are
> > a couple of potential reasons for this;
> >
> > 1) Genbank wasn't working properly when you tried
> > it.  Try it again and see if it works now!
> >
> > 2) Your network setup on your unix box isn't
> > allowing you to connect to the genbank site
> > properly.  This is usually because your connection
> > must pass through a proxy server to access the
> > internet, and you haven't given Perl the details of
> > this proxy.  The easiest way to do this is to set
> > the 'http_proxy' environment variable in your shell
> > (or within your script using the %ENV hash).
> >
> > $ENV{'http_proxy'}='http://my.proxy.address:port';
> >
> > You might also want to try upgrading your BioPerl to
> > the latest version in case you are hitting a problem
> > with an older version.
> >
> > Hope this helps
> >
> > Simon.
>
>
>
> ###### code starts here ####
>
> #! /usr/bin/perl -w
>
> use lib qw(
> /home/pss11/Perl/bioperl-1.2/lib/site_perl/5.6.0
> /home/pss11/Perl/IO-String-1.02/lib/site_perl/5.6.0
> /home/pss11/Perl/libwww-perl-5.69/lib/site_perl/5.6.0
> /home/pss11/Perl/URI-1.23/lib/site_perl/5.6.0);
>
> use IO::String;
> use strict;
> use Bio::DB::GenBank;
> use Bio::DB::Query::GenBank;
>
> my $query_string = 'Gallus gallus[organism]';
> my $query = Bio::DB::Query::GenBank->new(
> -db=>'protein',  -query=>$query_string);
> my $count = $query->count;
> print "COUNT $count\n";
>
> my @ids   = $query->ids;
>
> open(OUT,">/home/pss11/AutoBlast-GI-UNIX/queryout");
>
> while(@ids)
> {
>         my $prt = shift @ids;
>         print OUT "$prt \n";
> }
> close(OUT);
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>

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


More information about the Bioperl-l mailing list