{"id":16916941,"url":"https://github.com/althonos/nafcodec","last_synced_at":"2025-09-07T17:31:48.530Z","repository":{"id":198794297,"uuid":"701562441","full_name":"althonos/nafcodec","owner":"althonos","description":"Rust coder/decoder for Nucleotide Archival Format (NAF) files.","archived":false,"fork":false,"pushed_at":"2025-01-31T14:20:04.000Z","size":3180,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-19T18:20:41.370Z","etag":null,"topics":["bioinformatics","naf","nom-parser","nucleotide-sequences","rust-library"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/althonos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-06T23:26:37.000Z","updated_at":"2025-01-31T15:51:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f274b57-de94-46c7-8204-954936638b6f","html_url":"https://github.com/althonos/nafcodec","commit_stats":{"total_commits":138,"total_committers":1,"mean_commits":138.0,"dds":0.0,"last_synced_commit":"6c109949d51f16a412c35e3d94d2df0eb5277c24"},"previous_names":["althonos/naf.rs","althonos/nafcodec"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/althonos/nafcodec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fnafcodec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fnafcodec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fnafcodec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fnafcodec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/althonos","download_url":"https://codeload.github.com/althonos/nafcodec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fnafcodec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274068110,"owners_count":25216848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bioinformatics","naf","nom-parser","nucleotide-sequences","rust-library"],"created_at":"2024-10-13T19:31:31.862Z","updated_at":"2025-09-07T17:31:47.348Z","avatar_url":"https://github.com/althonos.png","language":"Rust","readme":"# 📦🧬 `nafcodec` [![Stars](https://img.shields.io/github/stars/althonos/nafcodec.svg?style=social\u0026maxAge=3600\u0026label=Star)](https://github.com/althonos/nafcodec/stargazers)\n\n*Rust coder/decoder for [Nucleotide Archive Format (NAF)](https://github.com/KirillKryukov/naf) files*.\n\n[![Actions](https://img.shields.io/github/actions/workflow/status/althonos/nafcodec/rust.yml?branch=main\u0026style=flat-square\u0026maxAge=600)](https://github.com/althonos/nafcodec/actions)\n[![Codecov](https://img.shields.io/codecov/c/gh/althonos/nafcodec/master.svg?style=flat-square\u0026maxAge=600)](https://app.codecov.io/gh/althonos/nafcodec)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square\u0026maxAge=2678400)](https://choosealicense.com/licenses/mit/)\n[![Source](https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=2678400\u0026style=flat-square)](https://github.com/althonos/nafcodec)\n[![Mirror](https://img.shields.io/badge/mirror-EMBL-009f4d?style=flat-square\u0026maxAge=2678400)](https://git.embl.de/larralde/nafcodec/)\n[![Crate](https://img.shields.io/crates/v/nafcodec.svg?maxAge=600\u0026style=flat-square)](https://crates.io/crates/nafcodec)\n[![Documentation](https://img.shields.io/badge/docs.rs-latest-4d76ae.svg?maxAge=2678400\u0026style=flat-square)](https://docs.rs/nafcodec)\n[![Changelog](https://img.shields.io/badge/keep%20a-changelog-8A0707.svg?maxAge=2678400\u0026style=flat-square)](https://github.com/althonos/nafcodec/blob/master/CHANGELOG.md)\n[![GitHub issues](https://img.shields.io/github/issues/althonos/nafcodec.svg?style=flat-square\u0026maxAge=600)](https://github.com/althonos/nafcodec/issues)\n\n\n## 🗺️ Overview\n\n[Nucleotide Archive Format](https://github.com/KirillKryukov/naf) is a file\nformat proposed in Kryukov *et al.*[\\[1\\]](#ref1) in 2019 for storing\ncompressed nucleotide or protein sequences combining 4-bit encoding and\n[Zstandard](https://github.com/facebook/zstd) compression. NAF files can\nbe compressed and decompressed using the\n[original C implementation](https://kirill-kryukov.com/study/naf).\n\nThis crate provides a Rust implementation of a NAF decoder, from scratch,\nusing [`nom`](https://crates.io/crates/nom) for parsing the binary format, \nand [`zstd`](https://crates.io/crates/zstd) for handling Zstandard \ndecompression. It provides a complete API that allows iterating over\nthe contents of a NAF file.\n\n*This is the Rust version, there is a [Python package](https://pypi.org/project/nafcodec) available as well.*\n\n### 📋 Features\n\n- **streaming decoder**: The decoder is implemented using different readers\n  each accessing a region of the compressed file, allowing to stream records\n  without having to decode full blocks.\n- **optional decoding**: Allow the decoder to skip the decoding of certains\n  fields, such as ignoring quality strings when they are not needed.\n- **flexible encoder**: The encoder is implemented using an abstract storage\n  interface for temporary data, which allows to keep sequence in memory or\n  inside a temporary folder.\n\n### 🔌 Usage\n\nUse a [`Decoder`](https://docs.rs/nafcodec/latest/nafcodec/struct.Decoder.html) \nto iterate over the contents of a Nucleotide Archive Format,\nreading from any [`BufRead`](https://doc.rust-lang.org/nightly/std/io/trait.BufRead.html) +\n[`Seek`](https://doc.rust-lang.org/nightly/std/io/trait.Seek.html) implementor:\n\n```rust\nlet mut decoder = nafcodec::Decoder::from_path(\"../data/LuxC.naf\")\n    .expect(\"failed to open nucleotide archive\");\n\nfor result in decoder {\n    let record = result.unwrap();\n    // .. do something with the record .. //\n}\n```\n\nAll fields of the obtained [`Record`](https://docs.rs/nafcodec/latest/nafcodec/data/struct.Record.html) \nare optional, and actually depend on the kind of data that was compressed. \nThe decoder can be configured through a \n[`DecoderBuilder`](https://docs.rs/nafcodec/latest/nafcodec/struct.DecoderBuilder.html) \nto ignore some fields to make decompression faster, even if they are present \nin the source archive:\n\n```rust\nlet mut decoder = nafcodec::DecoderBuilder::new()\n    .quality(false)\n    .with_path(\"../data/phix.naf\")\n    .expect(\"failed to open nucleotide archive\");\n\n// the archive contains quality strings...\nassert!(decoder.header().flags().test(nafcodec::Flag::Quality));\n\n// ... but we configured the decoder to ignore them\nfor result in decoder {\n    let record = result.unwrap();\n    assert!(record.quality.is_none())\n}\n```\n\n\u003c!-- ## 🔍 See Also --\u003e\n\n## 💭 Feedback\n\n### ⚠️ Issue Tracker\n\nFound a bug ? Have an enhancement request ? Head over to the \n[GitHub issue tracker](https://github.com/althonos/nafcodec/issues) if you \nneed to report or ask something. If you are filing in on a bug, please include \nas much information as you can about the issue, and try to recreate the same \nbug in a simple, easily reproducible situation.\n\n\u003c!-- ### 🏗️ Contributing\n\nContributions are more than welcome! See [`CONTRIBUTING.md`](https://github.com/althonos/nafcodec/blob/master/CONTRIBUTING.md) for more details. --\u003e\n\n\n## 📋 Changelog\n\nThis project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)\nand provides a [changelog](https://github.com/althonos/nafcodec/blob/master/CHANGELOG.md)\nin the [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) format.\n\n## ⚖️ License\n\nThis library is provided under the open-source\n[MIT license](https://choosealicense.com/licenses/mit/). The\n[NAF specification](https://github.com/KirillKryukov/naf/blob/master/NAFv2.pdf)\nis in the public domain.\n\n*This project is in no way not affiliated, sponsored, or otherwise endorsed\nby the [original NAF authors](https://github.com/KirillKryukov). It was\ndeveloped by [Martin Larralde](https://github.com/althonos/) during his PhD\nproject at the [European Molecular Biology Laboratory](https://www.embl.de/)\nin the [Zeller team](https://github.com/zellerlab).*\n\n## 📚 References\n\n- \u003ca id=\"ref1\"\u003e\\[1\\]\u003c/a\u003e 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](https://doi.org/10.1093/bioinformatics/btz144)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falthonos%2Fnafcodec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falthonos%2Fnafcodec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falthonos%2Fnafcodec/lists"}