#!/usr/local/bin/perl -w ############################################################################### # Mike Galsworthy's "Free Text to MeSH" converter # # # # # # PROGRAM 1 : Retrieving PubMed articles in Medline format # # # # (credit to Oleg Khovayko for key Medline download parts of script) # # # # # ############################################################################### #### PART 1. SETTING COMMAND-LINE TERMS ####################################### use Getopt::Long; my ($term, $keep, $retmax); GetOptions ("query:s" => \$term, "records=i" => \$keep, "batch=i" => \$retmax); if (!($term)) { die "No query term given. Use the --query 'term here' option.\n"; } #### PART 2. E-SEARCH ON THE QUERY TERM (USING "HISTORY") ##################### use LWP::Simple; $base = "http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?". "db=Pubmed". "&". "retmax=100". "&". "usehistory=y". "&". "term="; $signature = '&tool=bitola_medsum&email=mike_galsworthy@yahoo.co.uk'; $esearch = get($base . $term . $signature); $esearch =~ m|(\d+).*(\d+).*(\S+)|s; my $Count = $1; my $QueryKey = $2; my $WebEnv = $3; print ''; print "Your query is: $term\n
"; print "And it found $Count results\n
"; if ($Count<1501) { print "Yes, I can PROFILE that in one go."; print "\n
"; } if ($Count>1500) { print "NOTE: That will take too long for one PROFILE summary - I can only process 1500 at a time.\n
"; print "Please modify your query, or run several queries and with each: "; print "limit by year"; print ".
However, if you want to run Timeline, the number of records is not a limiting factor.\n
"; }