# FASTA vs FASTQ, GenBank, and GFF vs GTF

> FASTA stores sequences, FASTQ adds a quality score to every base, GenBank wraps a sequence in its annotation, and GFF and GTF keep annotation in a separate table. We sampled real Illumina reads and the Ensembl yeast genome files to show what each format cannot tell you, including the 3 bases GTF and GFF3 disagree on for every yeast protein.

## What is the difference between FASTA and FASTQ?

A FASTA file stores sequences, each under one header line that starts with `>`. A FASTQ file stores sequencing reads, and for every base it adds a quality score: the sequencer's estimate of how likely that base call is to be wrong. Assemblies, genes, proteins and reference genomes travel as FASTA. Raw reads come off the instrument as FASTQ.

The quality line is not as self-describing as it looks. A read we sampled from a NovaSeq 6000 run of sake yeast has a quality line made almost entirely of the letter `F`. In the Phred+33 encoding that both runs sampled here use, `F` means Q37, about one wrong call in 5,000. In the Phred+64 encoding that older Illumina pipelines used, the same `F` means Q6, one wrong call in four. Nothing in the file says which encoding it uses.

That pattern repeats across the formats in this article. FASTQ adds per-base confidence to FASTA. GenBank wraps a sequence in its annotation, with every gene and coding sequence given as coordinates in the same record. GFF3 and GTF hold annotation in a separate table that points at a sequence held elsewhere, usually a FASTA genome. Which one you need depends on what the next program reads, and each format drops something the others keep.

## What a FASTQ record holds

Each FASTQ record has four lines: a header starting with `@`, the sequence, a separator line starting with `+`, and a quality string exactly as long as the sequence. This is the first read of the NovaSeq run, unedited:
```text
@DRR256905.1 A00609:58:H2GVHDSXY:2:1101:5927:1016/1
GAACAAACTCGTTATTGGCCATAGGTTCAGCCGGAAAGCTTGTTGAATGATGATATATTGGACCATCATACTGATACGAGGAATCGGCACGCAGTTTATACGCTTTCTCTTTTTCTTTATCCGGCGAGGAACTCGTACTATTGGGGGTAG
+
FFFFFF::FFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFF:FFFFFFFF,:FFFFFFFFF
```
Each character is one Phred score, $Q = -10 \log_{10} P$, where $P$ is the probability that the base is wrong. Subtract 33 from the character's ASCII code to get Q: `F` is 70, so Q37, and `:` is 58, so Q25, about one error in 316. Cock and colleagues documented the three encodings in use by 2010: Sanger (Phred+33), Solexa (a different score with an offset of 64) and Illumina 1.3 and later (Phred+64).

You can usually tell the encoding from the characters, and the NovaSeq file shows how. It contains `#`, ASCII 35, which under Phred+64 would be Q−29, an impossible score, so the file must be Phred+33. A file whose lowest character is `@` or above is ambiguous. FastQC and most trimmers guess from the character range, and a wrong guess shifts every score by 31.

The `@` character causes a second problem. It is a legal quality value (Q31 in Phred+33), so a quality line can begin with it, and a script that treats every line starting with `@` as a header will split records in the wrong place. In 10,000 MiSeq reads of a yeast strain, 267 quality lines started with `@`. Parse FASTQ four lines at a time, never by searching for `@`.

### Binned quality scores hold less than they show

A quality string looks like a precise measurement per base. On current Illumina instruments it is a choice between three values. Illumina says the NovaSeq 6000, NextSeq 1000 and 2000 and iSeq "all use a three-bin Q-score table", with bins such as 3 to 17, 18 to 29 and 30 or above, which shrinks FASTQ and BAM files by as much as 50%. Older instruments such as the MiSeq wrote scores at whole-number resolution.

We counted every quality value in the first 10,000 reads of the two yeast runs. The NovaSeq reads used four values in 1.5 million bases: Q37 for 94.1%, Q25 for 4.0%, Q11 for 2.0%, and Q2 for exactly two bases, both of them `N` calls. The MiSeq reads used 28 distinct values.

![Bar chart on a logarithmic percentage axis comparing quality score distributions. MiSeq bars appear at 28 quality values from Q2 to Q38, highest at Q38 with 69.3 percent. NovaSeq 6000 bars appear only at Q2, Q11, Q25 and Q37, with Q37 holding 94.1 percent.](/images/charts/fastq-quality-score-bins.webp "**Figure 1. Quality values in 10,000 reads from a MiSeq run and a NovaSeq 6000 run.** Share of all bases at each Phred score, on a logarithmic axis so the rare values stay visible. Both runs are whole-genome sequencing of Saccharomyces cerevisiae (ENA DRR049502 and DRR256905, read 1, the first 10,000 reads). Our count.")

Binning changes what the file costs and what it can say. Compressed with gzip, the NovaSeq quality lines took about 0.65 bits per base and the MiSeq quality lines 1.73 bits, close to the 2.46 bits the MiSeq bases themselves took.

So a gzipped NovaSeq FASTQ was only 1.30 times the size of the same reads as FASTA, against 1.65 times for MiSeq; uncompressed, both were 1.7 to 1.8 times larger. Binning does not make the reads less accurate, and Illumina reports minimal difference in variant calls. It does mean a Q37 is a label for "30 or better", not a measurement of 37.

Converting FASTQ to FASTA throws the scores away, and nothing can recover them. Converting the other way, as [FASTA to FASTQ](/app/fasta-to-fastq) does for tools that only accept FASTQ, writes placeholder scores, and a read mapper will trust them as if the sequencer had measured them. How much the real scores are worth on each instrument is covered in [DNA sequencing accuracy](/guides/dna-sequencing-accuracy).

## FASTA vs GenBank

A FASTA record is a header and a sequence, and nothing else is defined. The header is free text after `>`, so the name, accession and description in it follow whatever convention the source used. [Making a FASTA file](/guides/how-to-make-a-fasta-file) by hand is easy for exactly that reason.

A GenBank flat file is a whole database record. It opens with a `LOCUS` line giving the length, molecule type and topology, then fields such as `DEFINITION`, `ACCESSION`, `SOURCE` and the references, then a `FEATURES` table, and only then the sequence after `ORIGIN`, in numbered lines of 60 bases, ending with `//`. The feature table is the point: every gene, mRNA and coding sequence is listed with a location and qualifiers such as `/gene`, `/product` and `/translation`.

Locations follow the INSDC feature table rules. `53260..54377` is a 1-based, inclusive range; `join()` strings ranges together into one feature, such as a coding sequence split by an intron; `complement()` puts the feature on the reverse strand; and `<` or `>` marks an end that lies beyond the known boundary. A CDS location includes the stop codon.

We downloaded the yeast actin gene, ACT1, both ways from the RefSeq record for chromosome VI, as the region 53,260 to 54,696. The GenBank file was 10,194 bytes, the FASTA file 1,548 bytes, for the same 1,437 bases. Most of the difference is the CDS entry, with 17 experimental evidence qualifiers and the 375-residue translation.

The FASTA file loses more than metadata. ACT1 sits on the reverse strand, so the region FASTA begins `TTAGAAACAC`: the reverse complement of the gene's last codons, starting with its `TAA` stop codon read backwards. Nothing in the file says the gene runs the other way, where its 309-base intron is, or that its first 10 coding bases sit at the far end of the file, past the intron. The GenBank record says `complement(join(1..1118,1428..1437))`.

![Screenshot of the ProteinIQ GenBank to FASTA converter with the ACT1 region record uploaded as input and Translated proteins selected. The output pane shows one FASTA entry for NP_116614.1, actin, with its location complement(join(1..1118,1428..1437)) in the header and a sequence starting MDSEVAALVIDNGSGM.](/images/guides/fasta-vs-fastq/genbank-to-fasta-act1.webp "**Figure 2. Extracting the actin protein from the ACT1 GenBank record.** The ACT1 region of RefSeq NC_001138.5 uploaded to GenBank to FASTA with Translated proteins selected. The converter reads the /translation qualifier of the CDS, so the output is the 375-residue protein deposited with the record, and the header keeps the location that FASTA itself cannot carry.")

So the direction of conversion matters. GenBank to FASTA is lossy but easy: [GenBank to FASTA](/app/genbank-to-fasta) writes the full sequence, each coding sequence spliced and reverse-complemented from its `join` and `complement` locations, or each protein. FASTA to GenBank is not a conversion at all, because the annotation has to come from somewhere. For a genome, it usually comes from a GFF3 or GTF file.

## GFF vs GTF

GFF3 and GTF both describe features as rows of nine tab-separated columns: sequence name, source, feature type, start, end, score, strand, phase and attributes. Both use 1-based, inclusive coordinates, like GenBank. Neither contains the sequence itself (GFF3 allows an optional `##FASTA` section at the end, which the Ensembl files do not use). The first eight columns of an Ensembl GTF and GFF3 line for the same exon are identical.

The difference is in column 9 and in what the rows are allowed to mean. These are the first CDS rows for ACT1 in Ensembl release 116, which publishes both formats for the same yeast annotation:
```text
GFF3: VI  sgd  CDS  53260  54377  .  -  2  ID=CDS:YFL039C;Parent=transcript:YFL039C_mRNA;protein_id=YFL039C
GTF:  VI  sgd  CDS  53263  54377  .  -  2  gene_id "YFL039C"; transcript_id "YFL039C_mRNA"; exon_number "2"; gene_name "ACT1"; ...
```
GFF3 writes attributes as `tag=value` pairs and links features into a tree with `ID` and `Parent`: CDS and exons point to an mRNA, the mRNA points to a gene, and one exon may list several parent transcripts. Types come from the Sequence Ontology, so Ensembl's yeast GFF3 separates `gene` from `ncRNA_gene`, `tRNA`, `snoRNA` and `transposable_element_gene`.

GTF writes `key "value";` pairs and requires every row to carry a `gene_id` and a `transcript_id`, so grouping is flat: a row belongs to whatever gene and transcript its IDs name. Ensembl's GTF calls every locus a `gene` and moves the type into a `gene_biotype` attribute.

The coordinates differ too. The GTF2.2 specification is explicit: "Unlike Genbank annotation, the stop codon is not included in the CDS for the terminal exon," and it gets its own `stop_codon` row. GFF3 says the opposite, that the start and stop codons are included in the CDS. So the two ACT1 rows above end at 53,263 and 53,260.

This is not an ACT1 quirk. We summed CDS lengths per transcript in both Ensembl yeast files: for all 6,600 protein-coding transcripts, the GFF3 coding sequence is exactly 3 bases longer than the GTF one, and the GTF carries 6,600 `stop_codon` rows to make up the difference. Translate GTF CDS rows and you get proteins without a stop; count codons from GFF3 and the last one is a stop. Table 1 lists the other differences.

  <caption><strong>Table 1. GFF3 and GTF compared on the same Ensembl annotation.</strong> Format rules from the GFF3 1.26 and GTF2.2 specifications; file figures are our counts on the Ensembl release 116 files for Saccharomyces cerevisiae R64-1-1, uncompressed.</caption>
  <thead>
    <tr>
      <th scope="col">Property</th>
      <th scope="col">GFF3</th>
      <th scope="col">GTF</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Column 9 syntax</td>
      <td>`ID=gene:YFL039C;Name=ACT1`</td>
      <td>`gene_id "YFL039C"; gene_name "ACT1";`</td>
    </tr>
    <tr>
      <td>How features are grouped</td>
      <td>`ID` and `Parent` tree, several parents allowed</td>
      <td>Flat, by `gene_id` and `transcript_id` on every row</td>
    </tr>
    <tr>
      <td>Feature types</td>
      <td>Sequence Ontology terms (`ncRNA_gene`, `tRNA`, `mRNA`)</td>
      <td>`gene`, `transcript`, `exon`, `CDS` and codon rows in Ensembl's file, with the type in `gene_biotype`</td>
    </tr>
    <tr>
      <td>Stop codon</td>
      <td>Inside the CDS</td>
      <td>Outside the CDS, as a `stop_codon` row</td>
    </tr>
    <tr>
      <td>Feature rows in the yeast file</td>
      <td>28,695, plus 7,167 directive and comment lines</td>
      <td>41,879</td>
    </tr>
    <tr>
      <td>Size of the yeast file</td>
      <td>5.9 MB</td>
      <td>10.5 MB, as every row repeats the gene and transcript attributes</td>
    </tr>
  </tbody>

Most RNA-seq software was written for GTF, and that is where the formats bite in practice. STAR builds transcripts from exon rows using the `transcript_id` attribute by default, and its manual says GFF3 needs `--sjdbGTFtagExonParentTranscript Parent`.

None of the 7,507 exon rows in the Ensembl yeast GFF3 carries a `transcript_id`. The [RNA-seq workflow from FASTQ to counts](/guides/rna-seq-workflow-fastq-to-counts) uses a GTF for that reason, and quantifiers such as [Salmon](/app/salmon) take a transcriptome FASTA built from it.

The sequence names in column 1 must also match the FASTA genome exactly. The STAR manual warns that Ensembl names chromosomes `1`, `2` and so on while UCSC uses `chr1`, `chr2`, so an Ensembl GTF and a UCSC genome "cannot be mixed together" unless one is renamed. A mismatch need not stop the run; it can instead produce a count table in which no read lands on any gene.

## One yeast gene in four formats

ACT1 makes a good test because it has everything that trips up conversions: it is on the reverse strand, it has an intron, and its first exon holds only 10 coding bases. Figure 3 follows its coding sequence through the four formats.

![Diagram of the yeast ACT1 gene on the reverse strand of chromosome VI, with a 10-base first exon at 54,687 to 54,696, a 309-base intron and a 1,118-base second exon at 53,260 to 54,377. Below it, four rows show how each format records the coding sequence: GenBank as complement of a join ending at 53,260, GFF3 as two CDS rows ending at 53,260, GTF as two CDS rows ending at 53,263 plus a separate stop codon row at 53,260 to 53,262, and FASTA as a plain strand of sequence with no coordinates. The 3-base TAA stop codon, drawn enlarged, is filled in the GenBank and GFF3 rows and sits outside the GTF coding rows, and the FASTA strand begins with TTA, its reverse complement.](/images/guides/fasta-vs-fastq/act1-four-formats.webp "**Figure 3. The coding sequence of yeast ACT1 as GenBank, GFF3, GTF and FASTA record it.** Coordinates are on chromosome VI of the R64 assembly, from RefSeq NC_001138.5 and the Ensembl release 116 GFF3 and GTF files. Exon, intron and codon widths are not to scale; the stop and start codons are drawn wide so the 3 bases where GTF disagrees with the other two formats stay visible.")

The four records agree on where ACT1 is and disagree on how to say it. GenBank gives the coding sequence as one location, `complement(join(53260..54377,54687..54696))`, and includes the stop codon. GFF3 gives the same span as two CDS rows with a shared parent. GTF gives two CDS rows that stop 3 bases short, plus `start_codon` and `stop_codon` rows.

The coding-sequence FASTA from RefSeq has 1,128 bases, starting `ATG` and ending `TAA`, already spliced and reverse-complemented; it has no coordinates at all.

Two of those differences cause real errors. Take the region FASTA and translate it in the forward frame, and you translate the wrong strand straight through the intron. Compute a coding length from GTF and compare it with one from GenBank or GFF3, and every gene is 3 bases, one codon, short. Neither mistake raises an error. Each one gives a plausible answer that is wrong for every gene in the genome.

## Which format should you use?

The choice is made by the next program, not by preference. Table 2 pairs the usual tasks with the format that program expects, what that format cannot tell you, and the check that catches the problem early.

  <caption><strong>Table 2. Choosing a sequence or annotation format.</strong> The format each task usually expects, what the format leaves out, and a check to run before the analysis.</caption>
  <thead>
    <tr>
      <th scope="col">Task</th>
      <th scope="col">Format</th>
      <th scope="col">What it cannot tell you</th>
      <th scope="col">Check first</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Trim, map or assemble sequencing reads</td>
      <td>FASTQ</td>
      <td>The quality encoding, and on binned instruments any score finer than three levels</td>
      <td>Lowest quality character: below `@` means Phred+33</td>
    </tr>
    <tr>
      <td>Search, align or fold a sequence</td>
      <td>FASTA</td>
      <td>Strand, coordinates, features and quality</td>
      <td>That the header carries an accession you can trace</td>
    </tr>
    <tr>
      <td>Work with one annotated sequence, such as a plasmid or a viral genome</td>
      <td>GenBank</td>
      <td>Nothing about the sequence, but feature locations are relative to the record, not the chromosome, when you download a region</td>
      <td>Whether coordinates start at 1 or at the chromosome position</td>
    </tr>
    <tr>
      <td>Count RNA-seq reads per gene or build an aligner index</td>
      <td>GTF</td>
      <td>The stop codon inside the CDS, and ontology types for non-coding genes</td>
      <td>Chromosome names match the genome FASTA, same release</td>
    </tr>
    <tr>
      <td>Load a genome annotation into a browser or an annotation pipeline</td>
      <td>GFF3</td>
      <td>Nothing a GTF holds, but many RNA-seq tools need extra options to read it</td>
      <td>Which attribute links exons to transcripts (`Parent`)</td>
    </tr>
  </tbody>

The habit that prevents most of these problems is to keep the annotation and the sequence from the same release and the same source, and to check one gene by hand before running the whole genome. Pick a gene on the reverse strand with an intron, find it in every file, and confirm that its coordinates, strand and coding length agree. If they do not, the file you just converted is the one to look at.

The GenBank row is the one people miss. The region download of ACT1 renumbers the record, so the gene that sits at 53,260 to 54,696 on chromosome VI appears at 1 to 1,437, while the same region in GFF3 keeps chromosome coordinates. Mixing the two puts every feature 53,259 bases off.

## Sequence file tools on ProteinIQ

Conversion usually runs in one direction, from the richer format to the leaner one, and these tools cover each step in the browser:

- [FASTQ to FASTA](/app/fastq-to-fasta): drop quality lines when a tool only takes sequences
- [FASTA to FASTQ](/app/fasta-to-fastq): add placeholder quality scores for tools that only accept FASTQ
- [GenBank to FASTA](/app/genbank-to-fasta): write the full sequence, each coding sequence or each protein from a GenBank record
- [GenBank feature extractor](/app/genbank-feature-extractor): pull out individual genes, CDS or other features with their locations
- [FASTA converter](/app/fasta-converter): turn GenBank, EMBL, FASTQ or alignment files into FASTA
- [Reverse complement](/app/reverse-complement): flip a region FASTA onto the strand a reverse-strand gene is read from

## Frequently asked questions

### What is the main difference between FASTA and FASTQ?

FASTQ stores a quality score for every base and FASTA does not. A FASTQ record takes four lines (header starting with `@`, sequence, `+` line, quality string), while a FASTA record is a `>` header and the sequence. Sequencers write FASTQ; references, genes and proteins are kept as FASTA.

### How do I know if a FASTQ file is Phred+33 or Phred+64?

Look at the lowest quality character in the file. Any character below `@` (ASCII 64), such as `#` or `5`, can only be valid in Phred+33, the Sanger encoding. If every character is `@` or higher the file is ambiguous, and you should check the instrument and pipeline version in the run metadata.

### Can I convert FASTA to FASTQ?

Only by inventing quality scores. A FASTA file has no per-base quality, so a converter writes the same placeholder score for every base, and downstream tools will treat it as measured. Use it when a tool insists on FASTQ input, not to recover lost information.

### Is GenBank the same as FASTA?

No. A GenBank flat file is a full record with a `FEATURES` table giving the location and translation of every annotated gene and coding sequence, followed by the sequence after `ORIGIN`. FASTA keeps only a header line and the sequence. For the 1,437-base yeast ACT1 region, the GenBank file was 10,194 bytes and the FASTA 1,548 bytes.

### What is the difference between GFF and GTF?

Both are nine-column, tab-separated annotation tables with 1-based coordinates. GFF3 writes attributes as `tag=value` and links features with `ID` and `Parent`; GTF writes `key "value";` and requires `gene_id` and `transcript_id` on every row. GTF also leaves the stop codon out of the CDS, so in the Ensembl yeast files every one of 6,600 coding sequences is 3 bases shorter in GTF than in GFF3.

### Should I use GTF or GFF3 for RNA-seq?

GTF, unless your tool documents GFF3 support. Aligners and quantifiers such as STAR link exons to transcripts through `transcript_id` by default, and STAR needs `--sjdbGTFtagExonParentTranscript Parent` to read GFF3. Take the GTF from the same release and source as the genome FASTA so the chromosome names match.
