Skip to main content

Read and write FASTA and FASTQ files efficiently

Project description

https://zenodo.org/badge/DOI/10.5281/zenodo.10548864.svg GitHub Actions badge PyPI badge Codecov badge

dnaio processes FASTQ, FASTA and uBAM files

dnaio is a Python 3.9+ library for very efficient parsing and writing of FASTQ and also FASTA files. Since dnaio version 1.1.0, support for efficiently parsing uBAM files has been implemented. This allows reading ONT files from the dorado basecaller directly.

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 uBAM 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.3.tar.gz (60.3 kB view details)

Uploaded Source

Built Distributions

dnaio-1.2.3-cp313-cp313-win_amd64.whl (85.0 kB view details)

Uploaded CPython 3.13 Windows x86-64

dnaio-1.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (106.0 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

dnaio-1.2.3-cp313-cp313-macosx_11_0_arm64.whl (87.0 kB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

dnaio-1.2.3-cp313-cp313-macosx_10_13_x86_64.whl (91.9 kB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

dnaio-1.2.3-cp312-cp312-win_amd64.whl (84.9 kB view details)

Uploaded CPython 3.12 Windows x86-64

dnaio-1.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (106.3 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

dnaio-1.2.3-cp312-cp312-macosx_11_0_arm64.whl (87.9 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

dnaio-1.2.3-cp312-cp312-macosx_10_13_x86_64.whl (93.3 kB view details)

Uploaded CPython 3.12 macOS 10.13+ x86-64

dnaio-1.2.3-cp311-cp311-win_amd64.whl (85.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

dnaio-1.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (108.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dnaio-1.2.3-cp311-cp311-macosx_11_0_arm64.whl (87.4 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

dnaio-1.2.3-cp311-cp311-macosx_10_9_x86_64.whl (93.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dnaio-1.2.3-cp310-cp310-win_amd64.whl (85.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

dnaio-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (108.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dnaio-1.2.3-cp310-cp310-macosx_11_0_arm64.whl (87.4 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

dnaio-1.2.3-cp310-cp310-macosx_10_9_x86_64.whl (92.8 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dnaio-1.2.3-cp39-cp39-win_amd64.whl (86.2 kB view details)

Uploaded CPython 3.9 Windows x86-64

dnaio-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (110.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dnaio-1.2.3-cp39-cp39-macosx_11_0_arm64.whl (87.9 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

dnaio-1.2.3-cp39-cp39-macosx_10_9_x86_64.whl (93.4 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file dnaio-1.2.3.tar.gz.

File metadata

  • Download URL: dnaio-1.2.3.tar.gz
  • Upload date:
  • Size: 60.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for dnaio-1.2.3.tar.gz
Algorithm Hash digest
SHA256 aad456d9f6272339958b2c5af32fd64d77a50aca12e394e7a143b4129d49b0b9
MD5 c12a55c1690af057baa4c57269c01f11
BLAKE2b-256 ca231afaeadecfe4712769db4b609ca4aeb4246f6a47a9ab39801cb6a5aa8c2e

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: dnaio-1.2.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 85.0 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for dnaio-1.2.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 acc683a09afd9aef6ffa1d6c76a60a66830f82405d3320330e54565a847b628b
MD5 f37183cb457c1dff74cf6b831a886b97
BLAKE2b-256 6416a16271fe647795d18d31b02370e9caf7f3f7004aac657fcf42adc601cc71

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 54d831754ea8f068ddde43e58ba3b7a47128298b3996614f343709084bddb517
MD5 9754a14fec90dfdc913a51b817635d4d
BLAKE2b-256 987b915cff94cafad8f48ad783c2662935019373c0d9f2b2597a21ac8de1ab11

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29a198dd72360c6b94cd81ff8885df5236479902c1bf3b5d0528999213d2a64d
MD5 9325c2dca99da44388ff61ca85835c74
BLAKE2b-256 b4cbe3f281981f585684cbb66470ce325f2f35792b7d7d5922e13b3eee6cbaf7

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a7e0a9e66ccae3ab936b80305a27b29a282e8b0756d000fa5ce88cb782cb8a7a
MD5 345a211fc59c3c6ef58d4a5d25700aa9
BLAKE2b-256 b9773a8cf4df3395d57c153dbbd6be98553aca2d57863036db4bccabf63b9915

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: dnaio-1.2.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 84.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for dnaio-1.2.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 027f1510cc23dd5e7bdab79101b5d3f052176b7ea9f583149812cc2c37cc02cb
MD5 04945c63ddbb6a955108a4d034fa1820
BLAKE2b-256 a26041e30a9079315380128d9a89e17d3995a20d0d836d99a11d382685f55fc0

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58e7fdb533d3794fb26f49b0c84f3b97c2a85be8cad6078abdfd76726b4f1109
MD5 29a8da7241e486746ac8df050d2f9810
BLAKE2b-256 88d207d75bdafa79502638266304e6d8f1e8eb51d16503041e48951d32582a9a

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f43d36490361bf35a90b0735fe235a423337cfa96d291f50e3cbf6ad3b2d26a2
MD5 baeb9b40de4ad69d34974d2f2c21d76f
BLAKE2b-256 00b513d00b6346d2e0771f51905299a4ae40ba5525fa5660da6345ef3225fff6

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 68a1c0acd6b5e7ca8bb6e6b29156f3e140c5fbbdfca9976eae64a709e95f0888
MD5 7f5bd4e4e2ec1b74758bed478d4cf1d8
BLAKE2b-256 2313421faa3b909df1a74dbaae841c83e9cf60be9e4d2abbf75b8174d564dc21

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: dnaio-1.2.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 85.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for dnaio-1.2.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9bd4a9398919e84eff095db850cf106017c9ddb66ff421fd2626512f072362eb
MD5 35deb2d56dad62961c23d9392003ed27
BLAKE2b-256 13af463515b4b5ac529ad136d02f14987193a5844c6253eedc27a4fb2febc9b5

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d712301c0eeff8f93bb2c01faadf0d9b8439fd3164ef15d6b4a4f7cdddcf906
MD5 03d2b5d49f1b2fd17f9a799e7aa8817f
BLAKE2b-256 adc1c4fe96f1416f8796614bf58817e004ad87bbdc80357e9b23f5d0f117114a

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b2a96134264b18d8c6edc7755326aa44cc262b5a0274b28d6f6b28d620ca843
MD5 2eb652ae94773f01355d718341e81e51
BLAKE2b-256 9f91e3492f3570c97eed7d278707576547f0fa929bec39e1a66086e04b6e9ca0

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 de46e4323c7b2516c4b4fdd5738e73853a1b4238880f772e78d819a8bb55fc82
MD5 e4edaa925aaa0eb11a92a77f9387032b
BLAKE2b-256 bb0d02d3f027f3772e34680c00b0d9779e588f77bc80c7835ca37e630a721fb9

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: dnaio-1.2.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 85.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for dnaio-1.2.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9e24efa2db5618bf11fbd51ea8d482a911afbee2655d76328cd6874af2a1cb71
MD5 ebc1faad06a0fa8473ee53beccc7c93d
BLAKE2b-256 7baf0c4bb00d2c9b5e516e2ce646b20493bb026beb6d8daacc003130813f865a

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 178bfef7a27851ef3859b6d32869a583d455fc35ab604824ad280eceedb84e72
MD5 65a59e1d80edc2b0218c9b20a044f30b
BLAKE2b-256 a23684af8d908f4106685934c8ac0b662502a89e849bff3e8802c91a518dfeef

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 700e7f0e7173aa99b2c0fcd2dc95846410113ae2a30d2f5d7fa3908622836f3d
MD5 201959fd29baaee9c196e8a38fd305f5
BLAKE2b-256 662b9f9a5df2375bd9d54cbb4d1671c9ccc7938d5d7d1619b49230e4ab20d04c

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5f837e739c3d11bee85d99587e38c87a1d9714b1801bb440d6a6d91ac5ccd27e
MD5 9ca949403267f99951f42822f539fa2b
BLAKE2b-256 31c43c2884fd414565a16f3eb45844abf331699f7e832181755e90cc0c66932a

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: dnaio-1.2.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 86.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for dnaio-1.2.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 54949388265c5270c51261d31ffe432618cf5f303acbb7fd6a2a79c9f7e56fa2
MD5 9f8fef7545c8b11b76b1b6b1e92f5ddb
BLAKE2b-256 e00d957e35b479bcc0ff2589f1847b18935a8da4c9ba3c9e656fa6ec8d37a8d0

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e95a6c391b9cd2cefb8aee04fe59fee9de64bbe2a4e8d18d0d4d33a6f5045b6c
MD5 ecece6864aa3c8a280dde1b43d671c4b
BLAKE2b-256 7316ddde6c927eee55128695aa6ff8d9f2a6bb3f0be61a86d91c307f0d7a2cd2

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6b5e6c72221f09a087079161aa045770465e0b787ad7a5cd3868116443c97a9
MD5 859482609d3bc776ad09b6b5d7a3f240
BLAKE2b-256 fad42d93f010d2d9471eadd0c11ef8e15786f3500a5128daeb271694b637d34d

See more details on using hashes here.

File details

Details for the file dnaio-1.2.3-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b61eb54d3dbf66069af3d37981f50af84e3fe1301ca20218cbab5b515a32c45b
MD5 dc1fe91a65b797273570ae29a211d2ad
BLAKE2b-256 e87ec841f01be5a7a92d2ed871b0d0304f229e2280319e1deb5857670f3e68be

See more details on using hashes here.

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