Toolyard

How to Convert GenBank to FASTA

The formats

  • FASTA is a title line starting with >, followed by the sequence. Almost every program reads it.
  • GenBank records, from NCBI, have a header, a FEATURES table describing genes and other parts, and the sequence after ORIGIN, with // at the end.
  • EMBL records, from ENA, hold the same information with a two-letter code at the start of every line and the sequence after SQ.

Convert the whole sequence

  1. Open GenBank and EMBL to FASTA.
  2. Paste the record, or several one after another.
  3. Copy or download the FASTA. The accession and description become the title line.

Take out one gene

A genome record can hold thousands of features. The GenBank Feature Extractor writes the DNA of every CDS, gene, rRNA or other feature type you choose as its own FASTA entry. It follows join() for genes split into exons and complement() for genes on the other strand, so the sequence comes out in the right order and orientation.

Get the protein

For coding sequences, the protein is usually written in the record already, in the /translation qualifier. The GenBank Translation Extractor lists those proteins as FASTA without translating anything again.

What changes

The sequence in a GenBank record is stored in numbered blocks of ten bases after ORIGIN:

ORIGIN
        1 atggtgagca agggcgagga gctgttcacc ggggtggtgc
//

In FASTA, the numbers and spaces are removed and the bases joined into one string under a title line:

>title from the record
atggtgagcaagggcgaggagctgttcaccggggtggtgc

Common problems

  • Lowercase letters. GenBank writes bases in lowercase. Most programs ignore case, but some genome tools treat lowercase as "masked" repeats. Convert to uppercase if a program needs it.
  • Partial features. A location like <1..>500 means the gene continues past the ends of the record, so the extracted sequence is incomplete.
  • Several records pasted together. Each record, ending in //, becomes its own FASTA entry. A missing // merges two records into one.

Tools in this guide

More guides