11 bp_meta_gff.pl - Get/set Bio::DB::GFF meta-data
15 # set the following meta data values
16 % bp_meta_gff.pl -d testdb tag1=value1 tag2=value2
18 # get the indicated meta data value
19 % bp_meta_gff.pl -d testdb tag1 tag2
23 This script gets or sets metadata in a Bio::DB::GFF database. Not all
24 adaptors support this operation! To set a series of tags, pass a set
25 of tag=value pairs to the script. To get the contents of a series of
26 tags, pass the bare tag names.
28 The output from the get operation will be an easily parseable set of
29 tag=value pairs, one per line.
31 =head1 COMMAND-LINE OPTIONS
33 Command-line options can be abbreviated to single-letter options.
34 e.g. -d instead of --database.
36 --database <dsn> Mysql database name (default dbi:mysql:test)
37 --adaptor <adaptor> Mysql adaptor (default dbi::mysqlopt)
38 --user <user> Username for mysql authentication
39 --pass <password> Password for mysql authentication
47 Lincoln Stein, lstein@cshl.org
49 Copyright (c) 2002 Cold Spring Harbor Laboratory
51 This library is free software; you can redistribute it and/or modify
52 it under the same terms as Perl itself. See DISCLAIMER.txt for
53 disclaimers of warranty.
57 my ($DSN,$ADAPTOR,$USER,$PASSWORD);
59 GetOptions
('database:s' => \
$DSN,
60 'adaptor:s' => \
$ADAPTOR,
62 'password:s' => \
$PASSWORD,
63 ) or (system('pod2text', $0), exit -1);
65 $DSN ||= 'dbi:mysql:test';
66 $ADAPTOR ||= 'dbi::mysqlopt';
69 push @args,(-user
=>$USER) if defined $USER;
70 push @args,(-pass
=>$PASSWORD) if defined $PASSWORD;
72 my $db = Bio
::DB
::GFF
->new(-adaptor
=>$ADAPTOR,-dsn
=> $DSN,@args)
73 or die "Can't open database: ",Bio
::DB
::GFF
->error,"\n";
75 for my $pair (@ARGV) {
76 my ($tag,$value) = split /=/,$pair;
77 if ($value) { # set operation
78 $db->meta($tag,$value);
79 unless ($db->meta($tag) eq $value) {
80 print STDERR
"value for '$tag' not set; perhaps this adaptor does not support meta data?\n";
83 print "$tag=",$db->meta($tag),"\n";