Skip to main content

Read FASTA and FASTQ files efficiently

Project description

Travis PyPI Codecov

dnaio parses FASTQ and FASTA

dnaio is a Python 3.5+ 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 dnaio.open function:

import dnaio

with dnaio.open('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

Limitations

  • 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.

Links

Project details


Download files

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

Source Distribution

dnaio-0.4.4.tar.gz (125.6 kB view hashes)

Uploaded Source

Built Distributions

dnaio-0.4.4-cp39-cp39-manylinux1_x86_64.whl (119.6 kB view hashes)

Uploaded CPython 3.9

dnaio-0.4.4-cp38-cp38-manylinux1_x86_64.whl (120.0 kB view hashes)

Uploaded CPython 3.8

dnaio-0.4.4-cp37-cp37m-manylinux1_x86_64.whl (116.9 kB view hashes)

Uploaded CPython 3.7m

dnaio-0.4.4-cp36-cp36m-manylinux1_x86_64.whl (117.1 kB view hashes)

Uploaded CPython 3.6m

dnaio-0.4.4-cp35-cp35m-manylinux1_x86_64.whl (115.8 kB view hashes)

Uploaded CPython 3.5m

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page