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 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.4.tar.gz (60.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dnaio-1.2.4-cp314-cp314t-win_amd64.whl (94.4 kB view details)

Uploaded CPython 3.14tWindows x86-64

dnaio-1.2.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (105.9 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dnaio-1.2.4-cp314-cp314t-macosx_11_0_arm64.whl (90.6 kB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

dnaio-1.2.4-cp314-cp314-win_amd64.whl (81.8 kB view details)

Uploaded CPython 3.14Windows x86-64

dnaio-1.2.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (106.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dnaio-1.2.4-cp314-cp314-macosx_11_0_arm64.whl (86.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

dnaio-1.2.4-cp313-cp313-win_amd64.whl (80.4 kB view details)

Uploaded CPython 3.13Windows x86-64

dnaio-1.2.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (105.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dnaio-1.2.4-cp313-cp313-macosx_11_0_arm64.whl (85.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

dnaio-1.2.4-cp312-cp312-win_amd64.whl (80.6 kB view details)

Uploaded CPython 3.12Windows x86-64

dnaio-1.2.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (106.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dnaio-1.2.4-cp312-cp312-macosx_11_0_arm64.whl (85.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dnaio-1.2.4-cp311-cp311-win_amd64.whl (81.0 kB view details)

Uploaded CPython 3.11Windows x86-64

dnaio-1.2.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (106.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dnaio-1.2.4-cp311-cp311-macosx_11_0_arm64.whl (86.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dnaio-1.2.4-cp310-cp310-win_amd64.whl (81.1 kB view details)

Uploaded CPython 3.10Windows x86-64

dnaio-1.2.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (105.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

dnaio-1.2.4-cp310-cp310-macosx_11_0_arm64.whl (85.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: dnaio-1.2.4.tar.gz
  • Upload date:
  • Size: 60.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnaio-1.2.4.tar.gz
Algorithm Hash digest
SHA256 a7570311f29e8b3c1ea39a60f57b7baf8dad8f2508595c58d4278c5571463166
MD5 1a879c3c1abb6cf20203da4bda1e3dcd
BLAKE2b-256 a9f23b4d7f4ac4fc25742fde4c5b50ed1bc60ab731cf8cabd3089dd11e4ea1c9

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: dnaio-1.2.4-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 94.4 kB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnaio-1.2.4-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 a0dbcdddd14d946a03f4ad617d3b4630808295eecd9a38f670786675a8059606
MD5 d8cceae9c9660739d18b034b9f662258
BLAKE2b-256 178de545eb8680442e78e016e57ae82f50ce062efc56275ffd16c284cbbebd72

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c8a8e1cba7ba300c48f4dda78c1d5dd2402762aa3454c0fcbd46d0d487d0df22
MD5 6941732ea0deb8ecb7f01f4636243a51
BLAKE2b-256 d1ce82036b1bdba0a4284da08a62af85b952095dcad97e7a1d2c0e4843c49d44

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.4-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87e1a2eaf55a9bdbf3f3ee0b7fb0b9fc94ced8b226023dc3db300dbee26b8e39
MD5 409f0049cc890f4695552f53ade362b4
BLAKE2b-256 8dc833dbd77f8c6dd3bd6a6c7473a2f9d5b70c8c1d50529750a3e82e013eab36

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: dnaio-1.2.4-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 81.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnaio-1.2.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f620efbe299f6a32218e2eba36d1f550cf10eacbe7a42d9c590a7e6ac220980f
MD5 4a50627f564636c2111b1a2a99931340
BLAKE2b-256 d13ab1f2095d7950679b7018edac59465fc0dff1493e8542f8c0644351716a95

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d176d4127c05cb808b956e05d3939edfc436f89671e62488fcb05b887cf57e7e
MD5 002391c8ad2a360b3b698c7426e5fa2a
BLAKE2b-256 c187383393bcf0ee017f147054731d4f09dd4319e86c7ab037b7e6e3477fdf45

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cef3a9aff9a240a51fea13571f1efcf0c7a4f9a4878bdda8a362a95d529befe
MD5 a98c071ca6d6cd080efc77f05de020c8
BLAKE2b-256 4319fe78c25785d293932b54c73ed6833538f8a541e4ebd25c14a0f56bda359f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dnaio-1.2.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 80.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnaio-1.2.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c14c75b890a21559b416e77a82dad078ff73fb4e05e39b4b45ee0f315b455063
MD5 2299e481d3b4c4f0ac74f26d8d1313b9
BLAKE2b-256 fbe98508eeadb3573e4c6008d78cec006aa9f9615a16262fd25b7dbaa3775ed6

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 660f84e462a9db574180b47cdf0bb7cb40b33842b86eec93f5c0e3c1b8df0d08
MD5 25b20df27ff52b2af056ba66902eff51
BLAKE2b-256 99debd4f173510ada57e874955dfae42051a6155b8297d5f7c0135bfe454106b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 264c11503c41934f2d8fe97fdd67ffb508081a424a576cac576ec3a4dfa2c41f
MD5 3ec68aa75c98f8938a34a65af46aa8f7
BLAKE2b-256 10a82bff6f94930f4307f7488cc0f36e13cff20b26ff0ce90f8ca3d7569956fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dnaio-1.2.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 80.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnaio-1.2.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 791bf2a1d377933c84b1e3c22d1b4b39608a85a17f613ce006256df267a28d69
MD5 dc3617af6e16b7c45e69fe2500d1f7b5
BLAKE2b-256 df315aaa21f15ea149d9b95ab0c555abc29841b9209d93d5536065ef8684f47d

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5deda100d355f5275948d1863a199996a1a22077f147ca99514c24de87588250
MD5 3fb1cc8d5c23baf44faa125c7c97b1eb
BLAKE2b-256 b399a041618c65bf31c1d8c5fd966aad0e7a9e86c43624743c62bbb4a944d106

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a55541a857fa1329cf600890ecedc605fa6963268500b1fcf5ee51d6c3c57cdc
MD5 543e7ef7acf311564d10d9b9112b2f76
BLAKE2b-256 8ba04ddde293003c52256ce8e80a797e08467e9550d7487af8b6a7d76c7b2356

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dnaio-1.2.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 81.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnaio-1.2.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ebac5241acfb9a391562ee1b7f9ae6857fbfd22411c73077a25d8f011957fc3c
MD5 f4de7270806c2f64d9e8d054c7d76726
BLAKE2b-256 b802b236c8aeb2e3d11d1a4f239977e7f541ee84c1bc2175be2176da8b60a65f

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8355670a175d96714f0ed693dbb64b79f1abe52f2b852c37459ce5cbdbd734ec
MD5 54036e7aaf5df2842c7cf243d34bb75a
BLAKE2b-256 3e16e627a013e7624bdd76df644ed2b146d4a15c18a2a8946a1db0cc306a3846

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 33c66997f160e848bea8357632d4b230eb57e986b349573cb4acdbb68ddd3d0f
MD5 d7a7fba1362011010d3130cbdaf701cb
BLAKE2b-256 100e8683f546df26000b1e79bbe480dbeb997ef19a854391f148907592779f31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dnaio-1.2.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 81.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnaio-1.2.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1274bf0940757f977c81474bfcc74668795da9ec10d0bddaef281d8a178b6233
MD5 70389c8c23bfe4907906d938fa2151d6
BLAKE2b-256 5a60be168dec299e33cd3ec7a8d2fa67127d3bfc3c1a1d2353a9a1acddfde344

See more details on using hashes here.

File details

Details for the file dnaio-1.2.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e348490366b0153e7b94abacb9eab4ea6c7e35245c74ab2bc564bbdea0a5c9f
MD5 9e150edb2355df1cdf693b8f5b6fabf0
BLAKE2b-256 8242a04973947faedc3ed8a4c7dbb69b7c5ce824f68a61ee385b254605158763

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16b79adb559229663735394ad219a7a2b7c21f075326125e4a8f70d54cc07d1f
MD5 3fe7337bb65ebaa30f1e18beeefb269d
BLAKE2b-256 89159ac0fd41330e0c68b93ecb0682a08bbb4efbd1a28b88f46856f94beb3770

See more details on using hashes here.

Supported by

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