[Bioperl-l] EUtils at NCBI

CHALFANT_CHRIS_M@Lilly.com CHALFANT_CHRIS_M@Lilly.com
Wed, 08 May 2002 16:34:25 -0500


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