Skip to main content

Read and write FASTA and FASTQ files efficiently

Project description

.. image:: https://github.com/marcelm/dnaio/workflows/CI/badge.svg :alt: GitHub Actions badge

.. image:: https://img.shields.io/pypi/v/dnaio.svg?branch=main :target: https://pypi.python.org/pypi/dnaio :alt: PyPI badge

.. image:: https://codecov.io/gh/marcelm/dnaio/branch/master/graph/badge.svg :target: https://codecov.io/gh/marcelm/dnaio :alt: Codecov badge

===================================== dnaio processes FASTQ and FASTA files

dnaio is a Python 3.7+ library for very efficient parsing and writing of FASTQ and also FASTA files. The code was previously part of the Cutadapt <https://cutadapt.readthedocs.io/>_ tool and has been improved significantly since it has been split out.

Example usage

The main interface is the dnaio.open <https://dnaio.readthedocs.io/en/latest/api.html>_ 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")

See the documentation <https://dnaio.readthedocs.io/>_ for more.

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.
  • FASTQ parsing is the focus of this library. The FASTA parser is not as optimized.

Links

  • Documentation <https://dnaio.readthedocs.io/>_
  • Source code <https://github.com/marcelm/dnaio/>_
  • Report an issue <https://github.com/marcelm/dnaio/issues>_
  • Project page on PyPI <https://pypi.python.org/pypi/dnaio/>_

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.9.0.tar.gz (41.1 kB view hashes)

Uploaded source

Built Distributions

dnaio-0.9.0-cp310-cp310-win_amd64.whl (55.4 kB view hashes)

Uploaded cp310

dnaio-0.9.0-cp39-cp39-win_amd64.whl (57.0 kB view hashes)

Uploaded cp39

dnaio-0.9.0-cp38-cp38-win_amd64.whl (56.9 kB view hashes)

Uploaded cp38

dnaio-0.9.0-cp37-cp37m-win_amd64.whl (56.5 kB view hashes)

Uploaded cp37

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page