X-Git-Url: https://git.donarmstrong.com/?p=function2gene.git;a=blobdiff_plain;f=bin%2Ffunction2gene;h=c407047418332d93c80fac96b7712dae31a611e3;hp=07dd2aed5f40500c9c7fc59fbae01c8d58444b28;hb=d8245a8bd7b77af4cdb72418346e52d8834e94a6;hpb=0486e6434cd182e8b30ba008d98ad3d3f008d2ab diff --git a/bin/function2gene b/bin/function2gene index 07dd2ae..c407047 100755 --- a/bin/function2gene +++ b/bin/function2gene @@ -28,6 +28,7 @@ use Storable; --results directory to store results in --database databases to search --restart-at mode to start searching at + --invalidate-state state to invalidate --debug, -d debugging level (Default 0) --help, -h display this help --man, -m display manual @@ -56,7 +57,16 @@ databases.] =item B<--restart-at> If you need to restart the process at a particular state (which has -already been completed) specify this option. +already been completed) specify this option. Valid values are get, +parse, or combine. + +=item B<--invalidate-state> + +This is a more powerful version of --restart-at, which can +specifically invalidate a certain method,database,keyword combination. + +For example, you can request that the keyword foo be retreived again +from ncbi using --invalidate-state 'get,ncbi,foo' =item B<--debug, -d> @@ -78,6 +88,10 @@ Display this manual. echo 'transferrin' > keywords.txt function2gene --keywords keywords.txt --results keyword_results + # reparse the results + function2gene --keywords keywords.txt --results keyword_results \ + --restart-at parse + =cut @@ -94,10 +108,12 @@ my %options = (databases => [], help => 0, man => 0, results => '', + invalidate_state => [], ); GetOptions(\%options,'keywords=s@','databases=s@', 'restart_at|restart-at=s','results=s', + 'invalidate_state|invalidate-state=s@', 'debug|d+','help|h|?','man|m'); pod2usage() if $options{help}; @@ -201,6 +217,24 @@ if (exists $options{restart_at} and length $options{restart_at}) { } } +if (exists $options{invalidate_state}) { + for my $invalidate_state (@{$options{invalidate_state}}) { + my ($method,$database,$keyword) = split /,/, $invalidate_state; + if (not exists $state{done_keywords}{$method}) { + print STDERR "Method '$method' does not exist, and cannot be invalidated\n"; + } + elsif (not exists $state{done_keywords}{$method}{$database}) { + print STDERR "Database '$database' does not exist for method '$method', and cannot be invalidated\n"; + } + elsif (not exists $state{done_keywords}{$method}{$database}{$keyword}) { + print STDERR "Keyword '$keyword' does not exist for database '$database' and method '$method', and cannot be invalidated\n"; + } + else { + delete $state{done_keywords}{$method}{$database}{$keyword}; + } + } +} + # now we need to figure out what has to happen # for each keyword, we check to see if we've got results, parsed # results, and combined it. If not, we queue up those actions. @@ -287,7 +321,11 @@ if ($actions{combine}) { $state{done_keywords}{combined}{$db}{$keyword} = 1; } save_state(\%state); - ADVISE("Finished; results in $options{results}/combined_results"); + write_command_to_file('combined_results_table.txt', + "$base_dir/results_to_table", + 'combined_results.txt', + ); + ADVISE("Finished; results in $options{results}/combined_results.txt"); } else { ADVISE('Nothing to do. [Perhaps you wanted --restart-at?]');