#! /usr/bin/perl
-# parse_ncbi_results retreives files of search results from ncbi,
+# parse_ncbi_results parses search results retrieved from ncbi,
# and is released under the terms of the GPL version 2, or any later
# version, at your option. See the file README and COPYING for more
# information.
-# Copyright 2004 by Don Armstrong <don@donarmstrong.com>.
+# Copyright 2005,7 by Don Armstrong <don@donarmstrong.com>.
-# $Id: ss,v 1.1 2004/06/29 05:26:35 don Exp $
use warnings;
man => 0,
dir => '.',
keyword => undef,
+ keywords => 0,
);
-GetOptions(\%options,'keyword|k=s','debug|d+','help|h|?','man|m');
+GetOptions(\%options,'keyword|k=s','debug|d+','help|h|?','man|m',
+ 'keywords'
+ );
pod2usage() if $options{help};
'Char' => \&tag_content
);
+print STDOUT join(",", map {qq("$_");} qw(Name RefSeq Location Alias Function Description Keyword DBName Filename)),qq(\n);
for (@ARGV) {
$file_name = $_;
- ($keyword) = $options{keyword} || $file_name =~ m#(?:^|/)([^\/]+?)[\s-]+AND[\s\-].+_results.xml$#;
- print STDOUT join(",", map {qq("$_");} qw(Name RefSeq Location Alias Function Description Keyword DBName Filename)),qq(\n);
+ if ($options{keywords}) {
+ $keyword = $_;
+ $file_name = "ncbi_${keyword}_results.xml";
+ }
+ else {
+ ($keyword) = $options{keyword} || $file_name =~ m#(?:^|/)([^\/]+?)[\s-]+AND[\s\-].+_results.xml$#;
+ }
my $file = new IO::File $file_name, 'r' or die "Unable to open file $file_name $!";
$parser->parse($file);