rust-yara
Rust FFI bindings for the YARA read mapper.
Overview
rust-yara provides safe Rust bindings for the YARA read mapper, a fast and accurate read mapper based on the SeqAn2 C++ library. The workspace supports both building FM indices from FASTA reference files and mapping paired-end reads against a pre-built index — all from Rust, without SAM serialization/deserialization overhead.
Crate Structure
| Crate | Description |
|---|---|
yara-seqan2-sys |
Vendored SeqAn2 headers for the YARA read mapper |
yara-mapper-sys |
Low-level FFI bindings to the YARA read mapper (SeqAn2) |
yara-mapper |
Safe Rust wrapper for the YARA read mapper |
Prerequisites
- Rust stable toolchain (see
rust-toolchain.tomlfor the pinned version) - zlib development headers
- OpenMP:
- macOS:
brew install libomp - Linux:
libgomp(typically included with GCC; installlibomp-devif using Clang)
- macOS:
Quick Start
Add yara-mapper to your Cargo.toml:
Build an index and map reads:
use ;
// Build an index from a FASTA file.
let indexer = build.unwrap;
println!;
// Open the index and map reads.
let mapper = open.unwrap;
let mut batch = new;
batch.push.unwrap;
let records = mapper.map_paired.unwrap;
for rec in &records
Examples
Build an FM index from a FASTA reference:
Map reads against a pre-built index:
Building from Source
To use a local SeqAn2 checkout instead of the vendored headers, set SEQAN_DIR:
License
This project is licensed under the MIT License.
The vendored SeqAn2 headers and
YARA application sources
are licensed under the BSD 3-Clause License — see
yara-seqan2-sys/vendor/include/seqan/LICENSE
and
yara-seqan2-sys/vendor/apps/yara/LICENSE.
Contributing
See CONTRIBUTING.md for development setup and guidelines.