/usr/share/doc/bioperl/examples/db/get_seqs.pl is in bioperl 1.7.2-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #!/usr/bin/perl
use strict;
use vars qw($USAGE);
use Carp;
use Getopt::Long;
use Bio::SeqIO;
$USAGE = "get_seqs.pl\t[--db=DBNAME] [--format=FORMAT] \n\t\t[--output=FILENAME] [--proxy=PROXY] accession1, accession2, ...\n Defaults: db=GenBank format=fasta output=STDOUT proxy=none\n See LWP::UserAgent for more information on proxy syntax";
my %dbs = (
'genbank' => 'Bio::DB::GenBank',
'embl' => 'Bio::DB::EMBL',
'swissprot' => 'Bio::DB::SwissProt',
);
my ($db,$format,$file,$proxy,$help) = ( 'genbank', 'fasta' );
&GetOptions
(
'db:s' => \$db,
'f|format:s' => \$format,
"file|out|output:s" => \$file,
'proxy:s' => \$proxy,
"h|\?|help" => \$help ,
);
if( $help ) { print $USAGE, "\n";exit; }
if( $db =~ /gb|gen|genbank/i ) {
$db = 'genbank';
} elsif( $db =~ /embl|em|e/i ) {
$db = 'embl';
} elsif( $db =~ /swiss|sp/i ) {
$db = 'swissprot';
} else {
croak("Unknown db parameter '$db' valid parameters are (" . join(',', keys %dbs) . ")");
}
my %params = ( '-format' => $format );
if( defined $file ) {
$params{'-file'} = ">$file";
} else {
$params{'-fh'} = \*STDOUT;
}
my $seqio = new Bio::SeqIO(%params);
my $remotedb;
eval {
my $filename = "$dbs{$db}.pm";
$filename =~ s!::!/!g;
require $filename;
$remotedb = "$dbs{$db}"->new();
};
die($@) unless ! $@;
if( defined $proxy ) { $remotedb->proxy($proxy); }
my $stream;
if( $remotedb->can('get_Stream_by_batch') ) {
$stream = $remotedb->get_Stream_by_batch(@ARGV);
} else {
$stream = $remotedb->get_Stream_by_acc(\@ARGV);
}
while( my $seq = $stream->next_seq ) {
$seqio->write_seq($seq);
}
|