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.8+ 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.2.tar.gz (59.4 kB view details)

Uploaded Source

Built Distributions

dnaio-1.2.2-cp312-cp312-win_amd64.whl (86.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

dnaio-1.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (109.6 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

dnaio-1.2.2-cp312-cp312-macosx_11_0_arm64.whl (90.1 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

dnaio-1.2.2-cp312-cp312-macosx_10_9_x86_64.whl (95.9 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

dnaio-1.2.2-cp311-cp311-win_amd64.whl (86.5 kB view details)

Uploaded CPython 3.11 Windows x86-64

dnaio-1.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (111.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dnaio-1.2.2-cp311-cp311-macosx_11_0_arm64.whl (89.2 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

dnaio-1.2.2-cp311-cp311-macosx_10_9_x86_64.whl (95.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dnaio-1.2.2-cp310-cp310-win_amd64.whl (86.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

dnaio-1.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (111.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dnaio-1.2.2-cp310-cp310-macosx_11_0_arm64.whl (89.4 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

dnaio-1.2.2-cp310-cp310-macosx_10_9_x86_64.whl (95.3 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dnaio-1.2.2-cp39-cp39-win_amd64.whl (87.5 kB view details)

Uploaded CPython 3.9 Windows x86-64

dnaio-1.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (113.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dnaio-1.2.2-cp39-cp39-macosx_11_0_arm64.whl (89.9 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

dnaio-1.2.2-cp39-cp39-macosx_10_9_x86_64.whl (95.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

dnaio-1.2.2-cp38-cp38-win_amd64.whl (87.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

dnaio-1.2.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (113.4 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

dnaio-1.2.2-cp38-cp38-macosx_11_0_arm64.whl (89.6 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

dnaio-1.2.2-cp38-cp38-macosx_10_9_x86_64.whl (95.2 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: dnaio-1.2.2.tar.gz
  • Upload date:
  • Size: 59.4 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.2.tar.gz
Algorithm Hash digest
SHA256 55e1c8e5b86056ce3bb3a3eff643ebc9910a5d6d0d5c10a27eb4d5b6525117d5
MD5 ec05efc4d2a10825dda0ee6a317ad948
BLAKE2b-256 1e69b11040d6cb619f2c879904dfd5f703c15d5ed05d20afc556318de9bc476b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dnaio-1.2.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 86.1 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 da150b6c0f1b2be99043c8419b78dfb1f8f04be5eb5f79c54d348c7e3767ea50
MD5 b818cf1159bfba45dd93b4b50bafce7b
BLAKE2b-256 cd68a9225743569c47d17639170ec9ed4cc2d8981bd81a8422698d8ca354754c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7ddeb623635b1f7e0b0cdae3178cbade72bea82a06883e972a0a1759c56ce341
MD5 0c5fec6949b15b6809e9c2cbd3e14917
BLAKE2b-256 a03b5594918803a9166b9f86b4a7222bddb07578a99ca94d7372a2df7482c67a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6b1b1da334cec3d2e9dca4b932219c3b9d1c11dc667914427f29d60e3860427e
MD5 e69c5082945dbebc9a1147bf227b6337
BLAKE2b-256 4e0a8d688f7f0a5af3df34da27196b1bd330d7b6d7b1908765cdb8b9d8c1c515

See more details on using hashes here.

File details

Details for the file dnaio-1.2.2-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.2-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2004eeb7e181176b626fbe24f3aae0d6fd869a33f295abf7d21943c3d0044aa8
MD5 c1c7b4c4715dbdeb26dbfea00dc2dc2a
BLAKE2b-256 32356f133979177ac7af62a238bc92b8224543f473d6fb5928974563835cff82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dnaio-1.2.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 86.5 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5423faa0aaf85be6a62ab81dc4f4724d666a5958e27fc61a10e3dbd1e3bf0b47
MD5 6c485cf0827f62dbf56cb0c2ff27b76e
BLAKE2b-256 b07ea3a730467a14c827da8ee5114472f74b3831b64e6e2f6e5e2365a266cf96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ffbea274e89572852c89b6603ef2340ee0deb067cca9ce3cbfb6841de6646df9
MD5 6f2f749008604640e15abe9fac19722c
BLAKE2b-256 ee79928db2f4895998c57d1b573e046f071f77017e2d2def3d18b38d8336a902

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f92cde6b13837ab1beb589e1341410ad9989b2097c2276a03ab32d0e258a236a
MD5 464c8b549ced0b16966b5cc0cb677611
BLAKE2b-256 666da52e0d870bc17068279225aa04cbb255c5e80a2e34597b97646a7c20907b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4cbddc72d5934fa0276458f1b5bb3bf7feabea5c615b30717efbd5f24251c508
MD5 5eca7a5311a22ad8fd676ccf015fd201
BLAKE2b-256 a364c066368cc5e388a8369920ed04fb523b6accc1442f627b49f54677f2dd44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dnaio-1.2.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 86.9 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c559ad1b65fd442188b06271bae53bf093691d96e484be9c9bfa62cff8bc4fc4
MD5 4636d3ab64cdfa69511d206c8a7cbe37
BLAKE2b-256 9b0f9e3992f124f02c5ce212e42c8ff78908be490354dc7f3775bba0c49af5eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa1aa5878780e0b4a015184e0569edf64d6092e17bd55eaec0236eb3d6935e41
MD5 e5b70db246a5b2a88e0e5a0ad79f8664
BLAKE2b-256 ad79cafd59e190a73694fa92911ade89a4306a1cbbf6a8be8bc26828e7ac19bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1302e1e81fc7cee58d9e21b5c41238bc40d7b2973fe286520754640dd2f598b
MD5 3af67fc0d23211cdd8d1172954d4cfe8
BLAKE2b-256 b265ba782ba6fd5a3d46f2fad62921c493c2fc0f2797b2994a4d7cfe651c4632

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 001dd5813defa78b5c15f0ce98c43ad6c92847c19196fe0afea5b4ce8e6ec394
MD5 f4f97aa745776be30ae0810cf883e087
BLAKE2b-256 d2bc3cd5661fa92fce24e4efeb170f6369f94a2fffcbf83285c8c8a3f8ce33f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dnaio-1.2.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 87.5 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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b17503b7cc12f5e0dd888bf9952ead282a0736405d399b4c74b2cbcf1ea6e4ba
MD5 d60cc0ea1ac7764b3a5afef79eb03bfa
BLAKE2b-256 181088b40963a0ecf338d84afce6461f37c6e284aad25c1becf449bfc52c9134

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8793b3b0cb549b71a2d96f89c86bd1b7e3bd807944b3a5adbf2315bf163c4e05
MD5 3268ab6ff9c0dd04240e2bc998d9447c
BLAKE2b-256 29ac96141db0734fc9fcdf663d13631fb804d49bb396bae25c7e1ade5dc36f31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83d0659bc238cc1dfd4495b2a6f624fb41d00d853041cbdd05f5f9095408cba1
MD5 c48f718df93b0c745363b2d6d1b2a2a7
BLAKE2b-256 217a14a86f6f50b516676045e1e3f022675220bf1589439f993c29ec566c95af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnaio-1.2.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bdd63ba357800e89af51cc77d98f43431d4bfe19368ecfc4f9f984ad1f1e2f76
MD5 a0a82b3addbdffc470e906e1ce6d8ecf
BLAKE2b-256 fe7efe2dab24367eadbf56a31a5c3120fd979c3b58c1a38e746769e0da7a0349

See more details on using hashes here.

File details

Details for the file dnaio-1.2.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: dnaio-1.2.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 87.6 kB
  • Tags: CPython 3.8, 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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 79104ce5d2fa61c6c75f6bbfe13b69f93d746f98c0536efe815b62dbb910c7b5
MD5 6883bb2a2456e7e81de8ed125fb59db9
BLAKE2b-256 6b7bc1e4600481b42a4ab64c97f69d21ee4ee0bf80eefa8905d19d90a69d9a8c

See more details on using hashes here.

File details

Details for the file dnaio-1.2.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b6f101ecadc008563f5a2eb3fe4279a773da87e7721c2432e9c496429e789d7f
MD5 7f543e371cb6af3d5023a1f420c34513
BLAKE2b-256 9d8fdd65cbe229b3081735cc5cc3bf01fcf1b5b0b6560f2d11dd6f0a5b482f88

See more details on using hashes here.

File details

Details for the file dnaio-1.2.2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 941aed9d7a2041f35c15c685740d1742a8e62578f766fe52cc3efebdd86e07f0
MD5 540a971805afee38dc115980626f828c
BLAKE2b-256 29983c4fd28e499cd0f0fabaf6d9b4fdd05ae9a7459b4e22ad42a3e9911ec7e3

See more details on using hashes here.

File details

Details for the file dnaio-1.2.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dnaio-1.2.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e00e778a88b8fe31d27578e61a89541e1b71fda2a4a8b6027b568b0bdb980e95
MD5 c293f5a5bc6b18696eb3a943cc40070c
BLAKE2b-256 40ed0a0138a970de13e39fbb3a11309d044be684e07ac82fa6d0734eb9ebc32a

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