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