Retrieving sequences from Swiss-Prot

The following script retrieves a sequence from Swiss-Prot:

#!/usr/bin/perl
use strict;
use Bio::Perl;

# it retrieves sequences from swissprot and generates fasta output
# this script will not work if you are not connected to the Internet

my $s = get_sequence('swiss',$ARGV[0]);
write_sequence(">$ARGV[1]",'fasta',$s);

usage:

$ perl get_swissprot_sequence.pl P11217 a.fasta
$ perl get_swissprot_sequence.pl PYGM_HUMAN b.fasta

Perl commandline parameters are stored in the @ARGV array. The first argument $ARGV[0] stores the Swiss-Prot accession number or identifier. The second argument $ARGV[1] defines the output file.

For more on use SeqIO with files, please refer to http://www.bioperl.org/wiki/Sequence_formats