name => 'ncbi_${search}_results.$format',
terms => '-',
orgn => 'homo',
- pubmed_site => 'http://www.ncbi.nlm.nih.gov',
- pubmed_search_url => '/entrez/query.fcgi?cmd=search&doptcmdl=Brief&dispmax=1000',
- pubmed_get_url => '/entrez/query.fcgi?cmd=Text',
+ ncbi_site => 'http://www.ncbi.nlm.nih.gov',
+ ncbi_search_url => '/entrez/query.fcgi?cmd=search&doptcmdl=Brief&dispmax=1000',
+ ncbi_get_url => '/entrez/query.fcgi?cmd=Text',
);
GetOptions(\%options,'format|f=s','database|b=s','name|n=s',
chomp;
my $search = $_;
my $format = $options{format};
- my $uri = URI->new($options{pubmed_site}.$options{pubmed_search_url});
+ my $uri = URI->new($options{ncbi_site}.$options{ncbi_search_url});
$uri->query_form($uri->query_form(),
term => $search.' AND '.$options{orgn}.'[Orgn]',
db => $options{database},
my @current_ids;
print {$xml_file} "<opt>\n";
while (@current_ids = splice(@gene_ids,0,5)) {
- $uri = URI->new($options{pubmed_site}.$options{pubmed_get_url});
+ $uri = URI->new($options{ncbi_site}.$options{ncbi_get_url});
$uri->query_form($uri->query_form(),
dopt => uc($options{format}),
db => $options{database},
print STDERR "url: $url\n";
$mech->get($url);
my $response = $mech->content;
+ my $retry_count=5;
+ while ($response =~ /Error reading from remote server/ and $retry_count > 0) {
+ $mech->get($url);
+ $response = $mech->content;
+ $retry_count--;
+ }
+ if ($rety_count <= 0) {
+ die 'Unable to retreive ids ['.join(',',@current_ids).'] because of a remote server error';
+ }
# For some dumb reason, they send us xml with html
# entities. Ditch them.
#$response = decode_entities($response);