[Bioperl-l] EUtils at NCBI

Brian Osborne brian_osborne@cognia.com
Tue, 21 May 2002 16:56:03 -0400


Chris,

Right. In addition, from NCBI:

URLs using the original utilities will continue to work until December 2002
by which time your transition to these new utilities [the eutils] should be
complete.

Brian O.


-----Original Message-----
From: bioperl-l-admin@bioperl.org [mailto:bioperl-l-admin@bioperl.org]On
Behalf Of CHALFANT_CHRIS_M@lilly.com
Sent: Wednesday, May 08, 2002 5:34 PM
To: bioperl-l@bioperl.org
Subject: [Bioperl-l] EUtils at NCBI

Has anyone looked into using eutils
(http://www.ncbi.nlm.nih.gov/entrez/eutils) at NCBI for the
Bio::DB::NCBIHelper module?  The efetch script seems to
work great and does not seem to have the limitations of
/htbin-post/entrez/query script.

Here's an example script I whipped up:

#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use File::Basename;

my $base_url = "http://www.ncbi.nlm.nih.gov/entrez/eutils";

my @ids;
while (<>) {
  chomp;
  push @ids, $_;
}

my $ua = new LWP::UserAgent;

my %params = (
              email => 'cchalfant@lilly.com',
              tool => basename($0),
              db => 'nucleotide',
              id => join(',', @ids),
              rettype => 'gb',
             );

my $param_str = join '&', map {"$_=$params{$_}"} keys %params;
my $url = "$base_url/efetch.fcgi?$param_str";

my $request = new HTTP::Request('GET', $url);
my $response = $ua->request($request);
if ($response->is_success) {
    print $response->content;
} else {
    print $response->error_as_HTML;
}

Chris

Chris Chalfant
Bioinformatics
Eli Lilly and Company
317-433-3407
_______________________________________________
Bioperl-l mailing list
Bioperl-l@bioperl.org
http://bioperl.org/mailman/listinfo/bioperl-l