Clarify the POD a bit
[bioperl-live.git] / scripts / DB / bp_biogetseq.pl
blob7c7897b3434645a4fb3cc9fdd9709a5521e08d5b
1 #!perl
3 # OBDA Registry compliant sequence retrieval script
5 # Copyright Heikki Lehvaslaiho <heikki-at-bioperl-dot-org>
6 # You may distribute this program under the same terms as perl itself
9 use Bio::DB::Registry;
10 use Bio::SeqIO;
11 use Getopt::Long;
12 use strict;
13 use warnings;
15 my ($help, $format, $namespace, $dbname) = ('', 'embl', 'acc', 'embl');
16 GetOptions ("help" => \$help, "format=s" => \$format,
17 "namespace=s" => \$namespace, "dbname=s" => \$dbname );
18 if ($help || !@ARGV) {
19 system("perldoc $0");
20 exit 0;
23 my $get_function = 'get_Seq_by_'. $namespace;
25 my $registry = new Bio::DB::Registry();
26 while (my $id = shift) {
27 my $db = $registry->get_database($dbname);
28 my $seq = $db->$get_function($id);
30 if ($seq) {
31 my $out = new Bio::SeqIO('-format' => $format);
32 $out->write_seq($seq);
33 } else {
34 print STDERR "Could not find sequence with identifier [$id]\n";
38 =head1 NAME
40 bp_biogetseq - sequence retrieval using OBDA registry
42 =head1 DESCRIPTION
44 This script retrives sequences from the source defined by users
45 registry setup. The current alternatives are from a local indexed
46 file, sql database or over the web.
48 =head1 USAGE
50 Usage: bp_biogetseq --dbname embl --format embl
51 --namespace acc id [ ids... ]
52 * dbname defaults to embl
53 * format defaults to embl
54 * namespace defaults to 'acc' ['id', 'acc', 'version']
55 * unnamed arguments are ids in the given namespace
57 =cut