yara_mapper/lib.rs
1//! Safe Rust wrapper for the YARA read mapper.
2//!
3//! This crate provides a high-level API for building and loading YARA FM
4//! indices, mapping paired-end reads in batches, and retrieving alignment
5//! results as owned Rust types — without SAM serialization/deserialization
6//! overhead.
7//!
8//! ## Example
9//!
10//! ```no_run
11//! use yara_mapper::{IndexerOptions, MapperOptions, ReadBatch, ReadEnd, YaraIndexer, YaraMapper};
12//!
13//! // Build an index from a FASTA file.
14//! let indexer = YaraIndexer::build("ref.fasta", "ref", &IndexerOptions::default()).unwrap();
15//! println!("Indexed {} contigs", indexer.contig_count());
16//!
17//! // Open the index and map reads.
18//! let mapper = YaraMapper::open("ref", &MapperOptions::default()).unwrap();
19//! let mut batch = ReadBatch::new();
20//! batch.push(
21//! "read1",
22//! ReadEnd { seq: b"ACGTACGT", qual: b"IIIIIIII" },
23//! ReadEnd { seq: b"TGCATGCA", qual: b"IIIIIIII" },
24//! ).unwrap();
25//! let records = mapper.map_paired(&batch).unwrap();
26//! for rec in &records {
27//! println!("contig={} pos={} mapq={}", rec.contig_id, rec.pos, rec.mapq);
28//! }
29//! ```
30
31mod error;
32mod ffi_helpers;
33mod indexer;
34mod mapper;
35mod options;
36mod record;
37
38pub use error::YaraError;
39pub use indexer::{IndexerOptions, YaraIndexer};
40pub use mapper::{ReadBatch, ReadEnd, YaraMapper};
41pub use options::{MapperOptions, SecondaryMode, Sensitivity};
42pub use record::{CigarOp, YaraRecord};