X-Git-Url: https://git.donarmstrong.com/?p=function2gene.git;a=blobdiff_plain;f=bin%2Fparse_ncbi_results;h=eb82b3c3389dceb34b910a30354a220e7a1a1dc1;hp=51d339db66e38bb02918c5d0c3ce94f760558b30;hb=3f759318c3a4c283f19113827dbaf206cb0f0252;hpb=d09b67e0af77d6f2818e41d6b4d648cff651c79d diff --git a/bin/parse_ncbi_results b/bin/parse_ncbi_results index 51d339d..eb82b3c 100755 --- a/bin/parse_ncbi_results +++ b/bin/parse_ncbi_results @@ -1,13 +1,12 @@ #! /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 . +# Copyright 2005,7 by Don Armstrong . -# $Id: ss,v 1.1 2004/06/29 05:26:35 don Exp $ use warnings; @@ -77,9 +76,12 @@ my %options = (debug => 0, 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}; @@ -179,10 +181,16 @@ $parser->setHandlers('Start' => \&tag_start, '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);