Another option to convert UniProt text format into FASTA format (with the "official" UniProt FASTA headers):
Install the Swissknife PERL module (http://swissknife.sourceforge.net/docs/) and then run one of the following 2 programs (both do require Swissknife):
1) For a simple fasta conversion that only includes canonical sequences:
run the attached script as follows:
perl sp_to_fasta uniprot_bacteria.dat > uniprot_bacteria.fasta
2) For a fasta file that includes alternative isoforms, download ftp://ftp.ebi.ac.uk/pub/software/uniprot/varsplic/varsplic.pl and run it locally, e.g. with a command line such as
perl varsplic.pl -input uniprot_bacteria.dat -check_vsps -crosscheck -error varsplic.err -fasta varsplic_bacteria.fasta -which full
sp_to_fasta:
# Purpose:
# Read a file in SP format, write it in FASTA format.
#
# Usage:
# sp_to_fasta SP_file > FASTA_file
use strict;
use IO::File;
use SWISS::Entry;
my $inputfile = @ARGV[0];
my $fh = new IO::File $inputfile or
die "Cannot open input file $inputfile: $!";
$/ = "\n\/\/";
while(<$fh>) {
s/\r//g;
(my $entry_txt = $_) =~ s/^\s+//;
next unless $entry_txt;
$entry_txt .= "\n";
my $entry = SWISS::Entry->fromText( $entry_txt );
print $entry->toFasta();
}