nafcodec-py

Crates.ionafcodec-py
lib.rsnafcodec-py
version0.2.0
sourcesrc
created_at2023-10-08 19:03:27.649918
updated_at2024-04-10 09:45:48.732994
descriptionPyO3 bindings and Python interface to the nafcodec crate.
homepagehttps://github.com/althonos/nafcodec
repositoryhttps://github.com/althonos/nafcodec
max_upload_size
id997381
size95,158
Martin Larralde (althonos)

documentation

README

πŸ“¦πŸ§¬ nafcodec Stars

Rust coder/decoder for Nucleotide Archive Format (NAF) files.

Actions Coverage License Docs Crate PyPI Wheel Bioconda Python Versions Python Implementations Source Mirror GitHub issues Changelog Downloads

πŸ—ΊοΈ Overview

Nucleotide Archive Format is a file format proposed in Kryukov et al.[1] in 2019 for storing compressed nucleotide or protein sequences combining 4-bit encoding and Zstandard compression. NAF files can be compressed and decompressed using the original C implementation.

This library provides PyO3 bindings to the nafcodec crate, a Rust implementation of a NAF decoder using nom for parsing the binary format, and zstd for handling Zstandard decompression. It provides a complete API that allows iterating over the contents of a NAF file.

This is the Python version, there is a Rust crate available as well.

πŸ“‹ Features

  • streaming decoder: The decoder is implemented using different readers each accessing a region of the compressed file, allowing to stream records without having to decode full blocks.
  • file-like decoding: Allow the decoder to read from a file-like object instead of expecting a path.

The following features are planned:

  • optional decoding: Allow the decoder to skip the decoding of certains fields, such as ignoring quality strings when they are not needed.
  • encoder: Implement an encoder as well, using either in-memory buffers or temporary files to grow the archive.

πŸ”Œ Usage

Use a nafcodec.Decoder to iterate over the contents of a Nucleotide Archive Format, reading from the given path-like or file-like object:

import nafcodec

decoder = nafcodec.Decoder("../data/LuxC.naf")
for record in decoder:
    print(record.id)

All fields of the obtained Record are optional, and actually depend on the kind of data that was compressed.

πŸ’­ Feedback

⚠️ Issue Tracker

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker if you need to report or ask something. If you are filing in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.

πŸ“‹ Changelog

This project adheres to Semantic Versioning and provides a changelog in the Keep a Changelog format.

βš–οΈ License

This library is provided under the open-source MIT license. The NAF specification is in the public domain.

This project is in no way not affiliated, sponsored, or otherwise endorsed by the original NAF authors. It was developed by Martin Larralde during his PhD project at the European Molecular Biology Laboratory in the Zeller team.

πŸ“š References

  • [1] Kirill Kryukov, Mahoko Takahashi Ueda, So Nakagawa, Tadashi Imanishi. "Nucleotide Archival Format (NAF) enables efficient lossless reference-free compression of DNA sequences". Bioinformatics, Volume 35, Issue 19, October 2019, Pages 3826–3828. doi:10.1093/bioinformatics/btz144
Commit count: 137

cargo fmt