Skip to content

marcelm/dnaio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

213563e · Nov 12, 2024
Nov 11, 2024
Nov 2, 2023
Apr 8, 2022
Nov 11, 2024
Nov 4, 2024
Nov 10, 2020
Jun 26, 2019
Sep 26, 2023
Jun 26, 2019
Apr 8, 2022
Aug 31, 2023
Nov 12, 2024
Jan 22, 2024
Nov 20, 2023
Nov 8, 2024
Nov 8, 2024
Sep 17, 2023
Nov 8, 2024

Repository files navigation

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

Links

About

Efficiently read and write sequencing data from Python

Topics

Resources

License

Citation

Stars

Watchers

Forks