Skip to main content

YaraMapper

Struct YaraMapper 

Source
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

Source

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.

Source

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.

Source

pub fn contig_count(&self) -> usize

Number of reference contigs in the loaded index.

Source

pub fn contig_names(&self) -> Vec<String>

Reference contig names (for SAM/BAM header construction).

Source

pub fn contig_lengths(&self) -> Vec<usize>

Reference contig lengths.

Trait Implementations§

Source§

impl Drop for YaraMapper

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for YaraMapper

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.