This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to parse a dat file into FASTA format?

I downloaded the dat files from Uniprot taxonomic division and I need to use them in FASTA format. Is it complicated to convert or parse dat files into FASTA? Does anyone can know how to do it? Thanks. T_T

biopython dat file fasta uniprot

2 answers

I recommend that you have a look at these threads and the answers I gave there:

How to makeblastdb Uniprot's Taxonomic Divisions? A: How to makeblastdb Uniprot's Taxonomic Divisions?

Converting Uniprot File to a Fasta File in Perl A: Converting Uniprot File to a Fasta File in Perl

install biopython then

make the following python script dat2fasta.py file and run the script using python dat2fasta.py

script dat2fasta.py

#!/usr/bin/env python
from Bio import SeqIO
records = SeqIO.parse("uniprot_trembl_mammals.dat", "swiss")
count = SeqIO.write(records, "uniprot_trembl_mammals.fasta", "fasta")
print("Converted %i records" % count)

Log in to answer this question.