pub struct YaraMapper { /* private fields */ }Expand description
Handle to a loaded YARA mapper with a pre-built FM index.
The mapper is configured at construction time and can be used to map multiple batches of reads. The FM index stays loaded in memory for the lifetime of this handle.
§Thread safety
The underlying C++ mapper uses OpenMP internally but is not safe for
concurrent map_paired calls. YaraMapper is Send but not
Sync.
Implementations§
Source§impl YaraMapper
impl YaraMapper
Sourcepub fn open<P: AsRef<Path>>(
index_prefix: P,
options: &MapperOptions,
) -> Result<Self, YaraError>
pub fn open<P: AsRef<Path>>( index_prefix: P, options: &MapperOptions, ) -> Result<Self, YaraError>
Open a pre-built YARA index and create a mapper.
index_prefix is the path prefix used when building the index (e.g.,
ref/hla.fasta if the index files are ref/hla.fasta.yara.*).
§Errors
Returns YaraError::IndexOpen if the index files cannot be found or
loaded, or if index_prefix contains non-UTF-8 characters or null bytes.
Sourcepub fn map_paired(
&self,
reads: &ReadBatch,
) -> Result<Vec<YaraRecord>, YaraError>
pub fn map_paired( &self, reads: &ReadBatch, ) -> Result<Vec<YaraRecord>, YaraError>
Map a batch of paired-end reads and return alignment records.
The returned records include primary and (depending on options) secondary alignments, plus unmapped entries for reads that could not be aligned.
§Errors
Returns YaraError::Mapping if the underlying C++ mapper encounters
an error during alignment.
Sourcepub fn contig_count(&self) -> usize
pub fn contig_count(&self) -> usize
Number of reference contigs in the loaded index.
Sourcepub fn contig_names(&self) -> Vec<String>
pub fn contig_names(&self) -> Vec<String>
Reference contig names (for SAM/BAM header construction).
Sourcepub fn contig_lengths(&self) -> Vec<usize>
pub fn contig_lengths(&self) -> Vec<usize>
Reference contig lengths.