From d8245a8bd7b77af4cdb72418346e52d8834e94a6 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 12 Dec 2007 00:42:08 +0000 Subject: [PATCH] * Add --invalidate-state option to specifically invalidate a state git-svn-id: file:///srv/svn/function2gene/trunk@21 a0738b58-4706-0410-8799-fb830574a030 --- bin/function2gene | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/bin/function2gene b/bin/function2gene index ed9a38c..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 @@ -59,6 +60,14 @@ If you need to restart the process at a particular state (which has 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> Debug verbosity. (Default 0) @@ -99,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}; @@ -206,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. -- 2.39.2