Skip to main content

Read and write FASTA and FASTQ files efficiently

Project description

GitHub Actions badge PyPI badge Codecov badge

dnaio processes FASTQ and FASTA files

dnaio is a Python 3.8+ library for very efficient parsing and writing of FASTQ and also FASTA files. The code was previously part of the Cutadapt tool and has been improved significantly 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")

For more, see the tutorial and API documentation.

Installation

Using pip:

pip install dnaio zstandard

zstandard can be omitted if support for Zstandard (.zst) files is not required.

Features and supported file types

  • FASTQ input and output

  • FASTA input and output

  • BAM input

  • Compressed input and output (.gz, .bz2, .xz and .zst are 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

  • FASTQ and BAM 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.

Source Distribution

dnaio-1.2.0.tar.gz (58.2 kB view hashes)

Uploaded Source

Built Distributions

dnaio-1.2.0-cp312-cp312-win_amd64.whl (85.2 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

dnaio-1.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (108.8 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

dnaio-1.2.0-cp312-cp312-macosx_10_9_x86_64.whl (93.6 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

dnaio-1.2.0-cp311-cp311-win_amd64.whl (85.8 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

dnaio-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (110.6 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dnaio-1.2.0-cp311-cp311-macosx_10_9_x86_64.whl (93.1 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dnaio-1.2.0-cp310-cp310-win_amd64.whl (86.2 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

dnaio-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (110.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dnaio-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl (92.9 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dnaio-1.2.0-cp39-cp39-win_amd64.whl (86.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

dnaio-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (111.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dnaio-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl (93.5 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

dnaio-1.2.0-cp38-cp38-win_amd64.whl (86.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

dnaio-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (112.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

dnaio-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl (92.4 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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