Skip to main content

Read FASTA and FASTQ files efficiently

Project description

Travis PyPI

dnaio parses FASTQ and FASTA

dnaio is a Python 3 library for fast parsing of FASTQ and also FASTA files. The code was previously part of the cutadapt tool and has been improved since it has been split out.

Example usage

The main interface is the function:

import dnaio

with'reads.fastq.gz') as f:
    bp = 0
    for record in f:
        bp += len(record)
print(f'The input file contains {bp/1E6:.1f} Mbp')

Features and supported file types

  • FASTQ input and output
  • FASTA input and output
  • Compressed input and output (.gz, .bz2 and .xz, detected automatically)
  • Paired-end data in two files
  • Interleaved paired-end data in a single file
  • Files with DOS/Windows linebreaks can be read
  • FASTQ files with a second header line (after the +) are supported


  • Multi-line FASTQ files are not supported. You shouldn’t use them anyway.
  • FASTQ parsing is the focus of this library. The FASTA parser is not as optimized.


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
dnaio-0.3-cp34-cp34m-manylinux1_x86_64.whl (120.3 kB) Copy SHA256 hash SHA256 Wheel cp34
dnaio-0.3-cp35-cp35m-manylinux1_x86_64.whl (120.1 kB) Copy SHA256 hash SHA256 Wheel cp35
dnaio-0.3-cp36-cp36m-manylinux1_x86_64.whl (122.1 kB) Copy SHA256 hash SHA256 Wheel cp36
dnaio-0.3-cp37-cp37m-manylinux1_x86_64.whl (121.7 kB) Copy SHA256 hash SHA256 Wheel cp37
dnaio-0.3.tar.gz (138.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page