This is a lazy-but-easy way to get the dbcontext arguments. All you need to do is to invoke get_dbcontext_from_argv before using the standard Getopt. The below options will be absorbed and removed from @ARGV.
db_file, host, dbname, dbuser, dbpass, driver
Now you can take the advantage of Perl's do method to execute a file as perl script and get returned the last line of it. For your most accessed dbcontext setting, you can have a filed named, say biosql.perlobj, with the content like
use strict; # The ceiling line use Bio::DB::SimpleDBContext; use Bio::DB::BioDB; my $dbc = Bio::DB::SimpleDBContext->new( -driver => 'mysql', -dbname => 'ontology_biosql', -host => 'localhost', -user => 'root', -pass => '' ); my $adaptor = Bio::DB::BioDB->new( -database => 'biosql', -dbcontext => $dbc ); return $adaptor; # The floor line
In your command line, you just need to type like
perl clear_ontology.pl --db_file ontology_biosql.perlobj --ontology_name InterPro
rather than the classic verbose one.
Juguang XIAO, firstname.lastname@example.org