-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpubmed_trend.pl
executable file
·43 lines (35 loc) · 1.09 KB
/
pubmed_trend.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/perl -w
#
# sex_diff_pain.pl
#
# Created by David Ruau on 2011-02-17.
# Department of Pediatrics/Div. System Medicine Stanford University.
#
##################### USAGE #########################
#
# Query PubMed with Eutils tools
#
#####################################################
use Bio::TGen::EUtils;
use strict;
my $queryString = $ARGV[0];
## query info
my $eu = Bio::TGen::EUtils->new( 'tool' => 'pubmed_trend.pl',
'email' => 'REPLACE_ME@gmail.com' );
## EFetch
my $query = $eu->esearch( db => 'pubmed',
term => $queryString,
usehistory => 'n' );
$query->write_raw( file => 'tempfile.xml' );
if (-z 'tempfile.xml') {
# one more time
my $query = $eu->esearch( db => 'pubmed',
term => $queryString,
usehistory => 'n' );
$query->write_raw( file => 'tempfile.xml' );
if (-z 'tempfile.xml') {
open (FILE, '>', 'tempfile.xml') or die 'Could not open file, $!';
print FILE "<begin>hello world</begin>";
close (FILE);
}
}