FASTQ format is a text-based format for storing both a biological sequence (usually nucleotide sequence) and its corresponding quality scores. Both the sequence letter and quality score are each encoded with a single ASCII character for brevity.

It was originally developed at the Wellcome Trust Sanger Institute to bundle a FASTA formatted sequence and its quality data, but has become the de facto standard for storing the output of high-throughput sequencing instruments such as the Illumina Genome Analyzer.

Format

A FASTQ file has four line-separated fields per sequence: Field 1 begins with a '@' character and is followed by a sequence identifier and an optional description (like a FASTA title line). Field 2 is the raw sequence letters. Field 3 begins with a '+' character and is optionally followed by the same sequence identifier (and any description) again. Field 4 encodes the quality values for the sequence in Field 2, and must contain the same number of symbols as letters in the sequence.

A FASTQ file containing a single sequence might look like this:

@SEQ_ID GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT + !''*((((***+))%%%++)(%%%%).1***-+*''))**55CCF>>>>>>CCCCCCC65

The byte representing quality runs from 0x21 (lowest quality; '!' in ASCII) to 0x7e (highest quality; '~' in ASCII). Here are the quality value characters in left-to-right increasing order of quality (ASCII): !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

The original Sanger FASTQ files split long sequences and quality strings over multiple lines, as is typically done for FASTA files. Accounting for this makes parsing more complicated due to the choice of "@" and "+" as markers (as these characters can also occur in the quality string). Multi-line FASTQ files (and consequently multi-line FASTQ parsers) are less common now that the majority of sequencing carried out is short-read Illumina sequencing, with typical sequence lengths of around 100bp.

Illumina sequence identifiers

Sequences from the Illumina software use a systematic identifier:

HWUSI-EAS100R the unique instrument name 6 flowcell lane 73 tile number within the flowcell lane 941 'x'-coordinate of the cluster within the tile 1973 'y'-coordinate of the cluster within the tile #0 index number for a multiplexed sample (0 for no indexing) /1 the member of a pair, /1 or /2 (paired-end or mate-pair reads only)

Versions of the Illumina pipeline since 1.4 appear to use #NNNNNN instead of #0 for the multiplex ID, where NNNNNN is the sequence of the multiplex tag.

With Casava 1.8 the format of the '@' line has changed:

EAS139 the unique instrument name 136 the run id FC706VJ the flowcell id 2 flowcell lane 2104 tile number within the flowcell lane 15343 'x'-coordinate of the cluster within the tile 197393 'y'-coordinate of the cluster within the tile 1 the member of a pair, 1 or 2 (paired-end or mate-pair reads only) Y Y if the read is filtered (did not pass), N otherwise 18 0 when none of the control bits are on, otherwise it is an even number ATCACG index sequence

Note that more recent versions of Illumina software output a sample number (defined by the order of the samples in the sample sheet) in place of an index sequence when an index sequence is not explicitly specified for a sample in the sample sheet. For example, the following header might appear in a FASTQ file belonging to the first sample of a batch of samples:

NCBI Sequence Read Archive

FASTQ files from the INSDC Sequence Read Archive often include a description, e.g.

In this example there is an NCBI-assigned identifier, and the description holds the original identifier from Solexa/Illumina (as described above) plus the read length. Sequencing was performed in paired-end mode (~500bp insert size), see SRR001666. The default output format of fastq-dump produces entire spots, containing any technical reads and typically single or paired-end biological reads.

$ fastq-dump.2.9.0 -Z -X 2 SRR001666 Read 2 spots for SRR001666 Written 2 spots for SRR001666 @SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=72 GGGTGATGGCCGCTGCCGATGGCGTCAAATCCCACCAAGTTACCCTTAACAACTTAAGGGTTTTCAAATAGA +SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=72 IIIIIIIIIIIIIIIIIIIIIIIIIIIIII9IG9ICIIIIIIIIIIIIIIIIIIIIDIIIIIII>IIIIII/ @SRR001666.2 071112_SLXA-EAS1_s_7:5:1:801:338 length=72 GTTCAGGGATACGACGTTTGTATTTTAAGAATCTGAAGCAGAAGTCGATGATAATACGCGTCGTTTTATCAT +SRR001666.2 071112_SLXA-EAS1_s_7:5:1:801:338 length=72 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII6IBIIIIIIIIIIIIIIIIIIIIIIIGII>IIIII-I)8I

Modern usage of FASTQ almost always involves splitting the spot into its biological reads, as described in submitter-provided metadata:

$ fastq-dump -X 2 SRR001666 --split-3 Read 2 spots for SRR001666 Written 2 spots for SRR001666 $ head SRR001666_1.fastq SRR001666_2.fastq ==> SRR001666_1.fastq <== @SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=36 GGGTGATGGCCGCTGCCGATGGCGTCAAATCCCACC +SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=36 IIIIIIIIIIIIIIIIIIIIIIIIIIIIII9IG9IC @SRR001666.2 071112_SLXA-EAS1_s_7:5:1:801:338 length=36 GTTCAGGGATACGACGTTTGTATTTTAAGAATCTGA +SRR001666.2 071112_SLXA-EAS1_s_7:5:1:801:338 length=36 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII6IBI

==> SRR001666_2.fastq <== @SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=36 AAGTTACCCTTAACAACTTAAGGGTTTTCAAATAGA +SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=36 IIIIIIIIIIIIIIIIIIIIDIIIIIII>IIIIII/ @SRR001666.2 071112_SLXA-EAS1_s_7:5:1:801:338 length=36 AGCAGAAGTCGATGATAATACGCGTCGTTTTATCAT +SRR001666.2 071112_SLXA-EAS1_s_7:5:1:801:338 length=36 IIIIIIIIIIIIIIIIIIIIIIGII>IIIII-I)8I

When present in the archive, fastq-dump can attempt to restore read names to original format. NCBI does not store original read names by default:

$ fastq-dump -X 2 SRR001666 --split-3 --origfmt Read 2 spots for SRR001666 Written 2 spots for SRR001666 $ head SRR001666_1.fastq SRR001666_2.fastq ==> SRR001666_1.fastq <== @071112_SLXA-EAS1_s_7:5:1:817:345 GGGTGATGGCCGCTGCCGATGGCGTCAAATCCCACC +071112_SLXA-EAS1_s_7:5:1:817:345 IIIIIIIIIIIIIIIIIIIIIIIIIIIIII9IG9IC @071112_SLXA-EAS1_s_7:5:1:801:338 GTTCAGGGATACGACGTTTGTATTTTAAGAATCTGA +071112_SLXA-EAS1_s_7:5:1:801:338 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII6IBI

==> SRR001666_2.fastq <== @071112_SLXA-EAS1_s_7:5:1:817:345 AAGTTACCCTTAACAACTTAAGGGTTTTCAAATAGA +071112_SLXA-EAS1_s_7:5:1:817:345 IIIIIIIIIIIIIIIIIIIIDIIIIIII>IIIIII/ @071112_SLXA-EAS1_s_7:5:1:801:338 AGCAGAAGTCGATGATAATACGCGTCGTTTTATCAT +071112_SLXA-EAS1_s_7:5:1:801:338 IIIIIIIIIIIIIIIIIIIIIIGII>IIIII-I)8I

In the example above, the original read names were used rather than the accessioned read name. NCBI accessions runs and the reads they contain. Original read names, assigned by sequencers, are able to function as locally unique identifiers of a read, and convey exactly as much information as a serial number. The ids above were algorithmically assigned based upon run information and geometric coordinates. Early SRA loaders parsed these ids and stored their decomposed components internally. NCBI stopped recording read names because they are frequently modified from the vendors' original format in order to associate some additional information meaningful to a particular processing pipeline, and this caused name format violations that resulted in a high number of rejected submissions. Without a clear schema for read names, their function remains that of a unique read id, conveying the same amount of information as a read serial number. See various SRA Toolkit issues for details and discussions.

Also note that fastq-dump converts this FASTQ data from the original Solexa/Illumina encoding to the Sanger standard (see encodings below). This is because the SRA serves as a repository for NGS information, rather than format. The various *-dump tools are capable of producing data in several formats from the same source. The requirements for doing so have been dictated by users over several years, with the majority of early demand coming from the 1000 Genomes Project.

Variations

Quality A quality value Q is an integer mapping of p (i.e., the probability that the corresponding base call is incorrect). Two different equations have been in use. The first is the standard Sanger variant to assess reliability of a base call, otherwise known as Phred quality score:

The Solexa pipeline (i.e., the software delivered with the Illumina Genome Analyzer) earlier used a different mapping, encoding the odds p/(1-p) instead of the probability p:

Although both mappings are asymptotically identical at higher quality values, they differ at lower quality levels (i.e., approximately p > 0.05, or equivalently, Q < 13).

At times there has been disagreement about which mapping Illumina actually uses. The user guide (Appendix B, page 122) for version 1.4 of the Illumina pipeline states that: "The scores are defined as , where is the probability of a base call corresponding to the base in question".Sequencing Analysis Software User Guide: For Pipeline Version 1.4 and CASAVA Version 1.0, dated April 2009 PDF In retrospect, this entry in the manual appears to have been an error. The user guide (What's New, page 5) for version 1.5 of the Illumina pipeline lists this description instead: "Important Changes in Pipeline v1.3 . The quality scoring scheme has changed to the Phred [i.e., Sanger] scoring scheme, encoded as an ASCII character by adding 64 to the Phred value. A Phred score of a base is: , where e is the estimated probability of a base being wrong.Sequencing Analysis Software User Guide: For Pipeline Version 1.5 and CASAVA Version 1.0, dated August 2009 PDF

Encoding Sanger format can encode a Phred quality score from 0 to 93 using ASCII 33 to 126 (although in raw read data the Phred quality score rarely exceeds 60, higher scores are possible in assemblies or read maps). Also used in SAM format.Sequence/Alignment Map format Version 1.0, dated August 2009 PDF Coming to the end of February 2011, Illumina's newest version (1.8) of their pipeline CASAVA will directly produce fastq in Sanger format, according to the announcement on seqanswers.com forum.Seqanswer's topic of skruglyak, dated January 2011 website Element Biosciences AVITI reads are encoded following the Sanger convention: Phred quality scores from 0 to 93 are encoded using ASCII 33 to 126. Raw reads typically exhibit base quality scores in the range of [0, 55]. Elembio AVITI FASTQ format specification https://docs.elembio.io/docs/bases2fastq/outputs/#quality-scores PacBio HiFi reads, which are typically stored in SAM/BAM format, use the Sanger convention: Phred quality scores from 0 to 93 are encoded using ASCII 33 to 126. Raw PacBio subreads use the same convention but typically assign a placeholder base quality (Q0) to all bases in the read.PacBio BAM format specification 10.0.0 https://pacbiofileformats.readthedocs.io/en/10.0/BAM.html#qual Oxford Nanopore Duplex reads, called using the dorado basecaller are typically stored in SAM/BAM format. After changing to a 16-bit internal quality representation, the reported base quality limit is q50 (S).Dorado duplex basecalling guide [duplex-tools: usage with dorado https://github.com/nanoporetech/duplex-tools#usage-with-dorado-recommended] Solexa/Illumina 1.0 format can encode a Solexa/Illumina quality score from -5 to 62 using ASCII 59 to 126 (although in raw read data Solexa scores from -5 to 40 only are expected) Starting with Illumina 1.3 and before Illumina 1.8, the format encoded a Phred quality score from 0 to 62 using ASCII 64 to 126 (although in raw read data Phred scores from 0 to 40 only are expected).