#![allow(non_camel_case_types)]
use std::os::raw::{c_char, c_int};
#[repr(C)]
pub struct YaraMapperHandle {
_opaque: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Clone)]
pub struct YaraMapperOptions {
pub error_rate: f32,
pub strata_rate: f32,
pub strata_count: i32,
pub sensitivity: i32,
pub threads: i32,
pub secondary_mode: i32,
pub align_secondary: i32,
pub verify_matches: i32,
pub verbose: i32,
pub library_length: i32,
pub library_dev: i32,
}
#[repr(C)]
#[derive(Debug)]
pub struct YaraReadBatch {
pub names: *const *const c_char,
pub r1_seqs: *const *const c_char,
pub r1_quals: *const *const c_char,
pub r2_seqs: *const *const c_char,
pub r2_quals: *const *const c_char,
pub count: usize,
}
#[repr(C)]
#[derive(Debug, Clone)]
#[allow(clippy::pub_underscore_fields)]
pub struct YaraAlignmentRecord {
pub read_pair_index: u32,
pub is_read1: u8,
pub contig_id: u32,
pub pos: u32,
pub is_reverse: u8,
pub is_secondary: u8,
pub is_unmapped: u8,
pub mapq: u8,
pub nm: u8,
pub x0: u16,
pub x1: u16,
pub mate_contig_id: u32,
pub mate_pos: u32,
pub tlen: i32,
pub flag: u16,
pub cigar: *mut u32,
pub cigar_len: u32,
pub seq: *const c_char,
pub qual: *const c_char,
pub seq_len: u32,
pub xa: *const c_char,
pub _pool_managed: u8,
}
unsafe extern "C" {
pub fn yara_mapper_open(
index_prefix: *const c_char,
opts: *const YaraMapperOptions,
error_buf: *mut c_char,
error_buf_len: usize,
) -> *mut YaraMapperHandle;
pub fn yara_mapper_map_paired(
handle: *mut YaraMapperHandle,
reads: *const YaraReadBatch,
out: *mut YaraAlignmentRecord,
out_capacity: usize,
error_buf: *mut c_char,
error_buf_len: usize,
) -> i64;
pub fn yara_mapper_contig_count(handle: *const YaraMapperHandle) -> usize;
pub fn yara_mapper_contig_name(handle: *const YaraMapperHandle, idx: usize) -> *const c_char;
pub fn yara_mapper_contig_length(handle: *const YaraMapperHandle, idx: usize) -> usize;
pub fn yara_mapper_close(handle: *mut YaraMapperHandle);
pub fn yara_mapper_free_records(records: *mut YaraAlignmentRecord, count: usize);
pub fn yara_mapper_free_record(record: *mut YaraAlignmentRecord);
}
#[repr(C)]
pub struct YaraIndexerHandle {
_opaque: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct YaraIndexerOptions {
pub output_prefix: *const c_char,
pub tmp_dir: *const c_char,
pub verbose: c_int,
}
unsafe extern "C" {
pub fn yara_indexer_build(
fasta_path: *const c_char,
opts: *const YaraIndexerOptions,
error_buf: *mut c_char,
error_buf_len: usize,
) -> *mut YaraIndexerHandle;
pub fn yara_indexer_contig_count(handle: *const YaraIndexerHandle) -> usize;
pub fn yara_indexer_contig_name(handle: *const YaraIndexerHandle, idx: usize) -> *const c_char;
pub fn yara_indexer_contig_length(handle: *const YaraIndexerHandle, idx: usize) -> usize;
pub fn yara_indexer_close(handle: *mut YaraIndexerHandle);
}