X-Git-Url: https://git.donarmstrong.com/?p=function2gene.git;a=blobdiff_plain;f=bin%2Fparse_ncbi_results;h=1e2b8d4f4dd72989d809d4e7a546b6eb1b501d66;hp=51d339db66e38bb02918c5d0c3ce94f760558b30;hb=79c0f28d89ba108bcfca68a8b5d4f0e3855455dc;hpb=672a430873e686b884bccb1b027321658c541b25 diff --git a/bin/parse_ncbi_results b/bin/parse_ncbi_results index 51d339d..1e2b8d4 100755 --- a/bin/parse_ncbi_results +++ b/bin/parse_ncbi_results @@ -77,9 +77,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 +182,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);