GenBank to FASTA

Reads GenBank and EMBL, writes FASTA. Paste a record or choose a file; nothing is uploaded.

FASTA

How do I convert a GenBank or EMBL record to FASTA?

Paste the record, drop the file on the box or choose it from your device. The format is read from the file: a GenBank record begins with LOCUS and holds its sequence underORIGIN, an EMBL record begins with ID and holds its sequence under SQ. Both end with a line of two slashes, and a file may hold any number of records. The tool says which format it found, so nothing has to be chosen by hand.

  • Whole sequence writes the sequence of each record as one FASTA record, headed by the accession with its version and the definition line.
  • Features cuts the pieces named in the feature table out of that sequence: CDS, gene, exon, mRNA, tRNA, rRNA, or every feature in the record, including source and misc_feature, with "All features".

Reading feature locations

The location decides which bases a feature is made of, and it is where converters usually go wrong. All coordinates are 1-based and both ends are included, so 19..201 is 183 bases.

LocationMeaningWhat is written
19..201positions 19 to 201, plus strand183 bases
complement(100..204)minus strandreverse complement of those 105 bases
join(271..300,1..60)two pieces read in that order, here across the origin of a circular recordthe pieces joined, 90 bases
complement(join(11..60,101..160))joined first, then read on the minus strandreverse complement of the joined 110 bases
<1..500the start is missing, the feature began before position 1from position 1
500..>800the end is missing, the feature goes on past 800to position 800, or to the last base if the record stops earlier
102^103a site between two basesnothing, there is no sequence
J00194.1:1..80a piece of another entryskipped, with a warning

order(...) is treated like join(...), and a location that cannot be read at all is reported with its text instead of being silently dropped.

Worked example

"Try an example" on the Features tab loads a 300 bp circular plasmid record,PBT0001. With the feature type on CDS the result is 3 records, 246 bp:repA from join(271..300,1..60), 90 bp read across the origin;tetR from complement(100..204), 105 bp reverse complemented; and orfX from 210..>260, 51 bp of a feature whose end is marked as missing. Tick "Translate CDS to protein" and the same three become 29, 34 and 17 amino acids, 80 aa in all, each translated with table 11 because the record says/transl_table=11. Choose "All features" and the source feature and the tetR gene feature are written too, five records in all.

On the Whole sequence tab the example is an EMBL record, detected from its ID and SQ lines and written as one record of 240 bp headed>AB123456.1 Petunia hybrida partial mRNA for chalcone synthase (chs gene).

Translating CDS features

With "Translate CDS to protein" ticked, every CDS is translated after it has been cut out and, where needed, reverse complemented:

protein = translate(feature sequence from base /codon_start, genetic code /transl_table)

/codon_start is 1, 2 or 3 and says which base of the feature begins the first full codon; it is 2 or 3 for a CDS whose start is missing, marked < in the location./transl_table names the NCBI genetic code, for example 11 for bacteria and plastids, 2 for vertebrate mitochondria, 5 for invertebrate mitochondria. Without it the standard code is used. A trailing stop codon is left off the protein, and a stop in the middle is reported, because it usually means the location, the reading frame or the code is not what the tool assumed. Bases that do not make a full codon at the end are ignored, and an ambiguous codon becomes X.

What goes into the FASTA header?

In Whole sequence mode: the accession with its version if the record has one, otherwise the LOCUS or ID name, then the definition line. In Features mode: the feature name, its type, its location and the accession it came from, for example>tetR CDS complement(100..204) [PBT0001.1]. The name comes from/gene, then /locus_tag, then /product, or from the qualifier you pick; spaces become underscores and a repeated name gets a number, so every record stays unique.

After the conversion

Tidy headers, line width or stray characters with theFASTA cleaner, check lengths and GC with thesequence statistics tool, translate extracted genes yourself with the translation tool, or cut further pieces out by position with the range extractor.

Frequently asked questions

How do I convert a GenBank file to FASTA?

Paste the record or choose the .gb, .gbk or .embl file. The format is detected from the file itself, the sequence under ORIGIN or SQ is written as one FASTA record, and the header is built from the accession and the definition line. Press Copy or Download. Several records in one file are converted in one go.

How do I extract CDS sequences from a GenBank record?

Switch to the Features tab and leave the feature type on CDS. Every CDS in the record is cut out of the sequence according to its location, reverse complemented when the location says complement, and written as its own FASTA record named after /gene, /locus_tag or /product. Tick "Translate CDS to protein" to get the amino acid sequence instead.

What do complement, join and the signs < and > mean in a location?

complement(100..204) means the feature is on the minus strand, so its sequence is the reverse complement of those positions. join(271..300,1..60) means the feature is made of two pieces read in that order, which is how spliced genes and features crossing the origin of a circular record are written. A < or > marks a partial end: the feature carries on beyond the position given. Only the bases the location names are written, cut back to fit the sequence in the file.

Does it use the /translation qualifier?

No. The protein is translated from the extracted nucleotides, using /codon_start to set the first codon and /transl_table to choose the genetic code, so what you get matches the sequence in the file. A protein that differs from /translation, or that has a stop codon in the middle, usually means the record uses an unusual code or a /transl_except, and the tool says so.

How large a GenBank file can it convert?

Files up to 50 MB are fine, and several records in one file are converted together. The record is parsed by the browser on your own device. For a whole bacterial genome flat file with thousands of features, a command-line tool such as seqret or Biopython is quicker.