Convert FASTA records to GenBank and choose the molecule type for each record.
Writing FASTA records as GenBank entries
Yes, this page converts FASTA to GenBank. Because the input file does not say whether its sequences are DNA, RNA, or protein, the form asks you once, and your answer is written into every record. Lowercase letters are written in one case, and in the sample on this page the names and sequence letters come through unchanged.
What the GenBank file will and will not contain
| Data in your file | In the output | Details |
|---|---|---|
| Sequence letters | Kept in the sample | All three sequences in the sample on this page come through unchanged. |
| Lowercase (soft-masked) letters | Changed | Every letter is written in the same case, so masked regions are no longer marked. |
| Record name | Kept in the sample | seq1 to seq3 are unchanged. The name is the first word of the header line (see below). |
| Text after the name on the header line | Kept in the sample | It reads back unchanged. |
| Sequence type | Added | Your DNA, RNA, or protein choice is recorded in each record. |
In the sample output, the first line also shows values your file did not contain: the division code UNK and the date 01-JAN-1980. FASTA records carry no features, and the sample's GenBank output has none.
One sequence type for the whole upload
The question "What kind of sequence is in your file?" appears once, and the choice applies to every record in the file. One choice cannot correctly describe a file that mixes DNA and protein; if your file mixes them, split it into separate files and upload each one with its own choice.
What counts as the record name
The name is the first word after the > on the header line; the words after it are kept as the description, so a header with spaces is not refused. A header with nothing after the > is also accepted on this route: the record is written under the name "." instead of being refused, which the EMBL, NEXUS, and PHYLIP routes would do. Check the first line of the output if your headers are empty.
Going back, or choosing EMBL instead
GenBank to FASTA is available for the reverse direction; it keeps the sequence records and drops features, references, and other annotations. FASTA to EMBL asks the same sequence-type question, applies the same no-spaces rule to names, and also writes every letter in one case; the sample converts there too.
If the file is refused
If the upload cannot be read, the page says only that the file could not be read as FASTA and asks you to check that it is valid; no cause is given. Uploads are limited to 50 MB.
Run it with Biopython
For batch work, you can use Biopython's SeqIO.convert function. This output needs a sequence type, so replace the example molecule type with DNA, RNA, or protein to match your file.
from Bio import SeqIO
count = SeqIO.convert("input.fasta", "fasta",
"output.genbank", "genbank",
molecule_type="DNA")
print("Converted %i records" % count)
Sample input file: FASTA
Copy this example into a file, or download it, to try a FASTA conversion.
Download sample (sample.fasta, 210 bytes)
Samples are small illustrative files. Some come from the Biopython test suite (see the project's sample notes); they are not real study data.