Expand description
Safe Rust wrapper for the YARA read mapper.
This crate provides a high-level API for building and loading YARA FM indices, mapping paired-end reads in batches, and retrieving alignment results as owned Rust types — without SAM serialization/deserialization overhead.
§Example
use yara_mapper::{IndexerOptions, MapperOptions, ReadBatch, ReadEnd, 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",
ReadEnd { seq: b"ACGTACGT", qual: b"IIIIIIII" },
ReadEnd { seq: b"TGCATGCA", qual: 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);
}Structs§
- CigarOp
- A single CIGAR operation with BAM encoding.
- Indexer
Options - Options for building a YARA FM index.
- Mapper
Options - Configuration options for the YARA mapper.
- Read
Batch - A batch of paired-end reads to map.
- ReadEnd
- One end (read 1 or read 2) of a paired-end read.
- Yara
Indexer - Handle to a built YARA FM index.
- Yara
Mapper - Handle to a loaded YARA mapper with a pre-built FM index.
- Yara
Record - A single alignment record returned by the YARA mapper.
Enums§
- Secondary
Mode - How secondary alignments are reported.
- Sensitivity
- Sensitivity level for YARA’s seed-and-extend pipeline.
- Yara
Error - Errors returned by the YARA mapper.