yara-seqan2-sys 0.1.1

Vendored SeqAn2 headers for the YARA read mapper
Documentation
  • Coverage
  • 100%
    1 out of 1 items documented0 out of 0 items with examples
  • Size
  • Source code size: 14.98 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 970.32 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • fulcrumgenomics/rust-yara
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nh13

Build Status crates.io docs.rs License: MIT

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.toml for the pinned version)
  • zlib development headers
  • OpenMP:
    • macOS: brew install libomp
    • Linux: libgomp (typically included with GCC; install libomp-dev if using Clang)

Quick Start

Add yara-mapper to your Cargo.toml:

cargo add yara-mapper

Build an index and map reads:

use yara_mapper::{IndexerOptions, MapperOptions, ReadBatch, YaraIndexer, YaraMapper};

// Build an index from a FASTA file.
let indexer = YaraIndexer::build("ref.fasta", "ref", &IndexerOptions::default()).unwrap();
println!("Indexed {} contigs", indexer.contig_count());

// Open the index and map reads.
let mapper = YaraMapper::open("ref", &MapperOptions::default()).unwrap();
let mut batch = ReadBatch::new();
batch.push("read1", b"ACGTACGT", b"IIIIIIII", b"TGCATGCA", b"IIIIIIII").unwrap();
let records = mapper.map_paired(&batch).unwrap();
for rec in &records {
    println!("contig={} pos={} mapq={}", rec.contig_id, rec.pos, rec.mapq);
}

Examples

Build an FM index from a FASTA reference:

cargo run --example build_index -- ref.fasta ref

Map reads against a pre-built index:

cargo run --example align -- ref

Building from Source

cargo build                  # debug build
cargo clippy --all-targets   # lint
cargo fmt --check            # format check

To use a local SeqAn2 checkout instead of the vendored headers, set SEQAN_DIR:

export SEQAN_DIR=/path/to/seqan

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.