| Title: | Native R Bindings and SIMD Dispatch for 'minibwa' |
|---|---|
| Description: | Provides native R bindings to the 'minibwa' genomic read aligner with raw-vector query input, external-pointer alignment batches, ALTREP column views, and an installed C API for downstream packages. The package builds staged Single Instruction Multiple Data ('SIMD') KSW backends and selects portable scalar, SSE4, or AVX2 code at runtime without global instruction-set compiler flags. |
| Authors: | Sounkou Mahamane Toure [aut, cre], Dana-Farber Cancer Institute [cph] (Copyright holder of upstream minibwa), Ilya Grebnov [cph] (libsais copyright holder), N. Jesper Larsson [cph] (QSufSort copyright holder), Wong Chi Kwong [cph] (BWT-SW/bwtgen copyright holder) |
| Maintainer: | Sounkou Mahamane Toure <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.0.0.9000 |
| Built: | 2026-06-23 10:39:21 UTC |
| Source: | https://github.com/sounkou-bioinfo/Rminibwa |
mb_align_col() returns ALTREP views over native alignment columns. These
views do not copy columns unless R forces materialization. C consumers should
prefer the installed Rminibwa.h API.
mb_align_n(x) mb_align_col(x, name) mb_align_cigar_words(x)mb_align_n(x) mb_align_col(x, name) mb_align_cigar_words(x)
x |
Native alignment batch returned by |
name |
Column name. |
mb_align_n() returns the number of records. mb_align_col() returns
an ALTREP integer or real vector. mb_align_cigar_words() returns a raw
debug copy of packed minibwa CIGAR words.
Builds index files at prefix using the vendored minibwa C library. The
package is GPL, so the native build includes minibwa's GPL-compatible
low-memory indexing path; low_memory = FALSE uses the default libsais
path.
mb_index_build(fasta, prefix, meth = FALSE, threads = 1L, low_memory = FALSE)mb_index_build(fasta, prefix, meth = FALSE, threads = 1L, low_memory = FALSE)
fasta |
Reference FASTA path. Gzip-compressed input is supported by minibwa/zlib. |
prefix |
Output prefix for |
meth |
Build the directional methylation index as well. |
threads |
Number of index-build threads requested by minibwa. |
low_memory |
Use minibwa's low-memory BWT builder. |
prefix, invisibly.
Names are returned as raw byte vectors to avoid forced string materialization.
mb_index_contigs(index)mb_index_contigs(index)
index |
Index handle returned by |
A list with raw-vector name entries and numeric length values.
Load a native minibwa index
mb_index_load(prefix, meth = FALSE)mb_index_load(prefix, meth = FALSE)
prefix |
Index prefix. |
meth |
Load the methylation BWT index. |
An external pointer handle to a native minibwa index.
mb_map() is pipe-friendly: the sequence bytes are the first argument.
The result is a native alignment batch external pointer. Use mb_align_col()
for ALTREP column views or pass the batch to downstream C consumers.
mb_map(x, index, opt = mb_opts(), name = NULL, meth = c("none", "c2t", "g2a"))mb_map(x, index, opt = mb_opts(), name = NULL, meth = c("none", "c2t", "g2a"))
x |
Raw vector of query sequence bytes. |
index |
Index handle returned by |
opt |
Options list from |
name |
Optional read name as raw bytes. Character names are accepted for convenience but raw bytes are preferred. |
meth |
Methylation code: |
A native alignment batch external pointer.
# See vignettes for full index-backed examples.# See vignettes for full index-backed examples.
Returns a plain list consumed by native mapping functions. Only the selected options are exposed initially; all other fields use minibwa defaults for the chosen preset.
mb_opts( preset = c("adap", "sr", "lr"), paired = NULL, methylation = NULL, out_n = NULL, min_seed_len = NULL, threads = NULL, match_score = NULL, mismatch_penalty = NULL, gap_open = NULL, gap_extend = NULL )mb_opts( preset = c("adap", "sr", "lr"), paired = NULL, methylation = NULL, out_n = NULL, min_seed_len = NULL, threads = NULL, match_score = NULL, mismatch_penalty = NULL, gap_open = NULL, gap_extend = NULL )
preset |
One of |
paired, methylation
|
Optional logical overrides for minibwa flags. |
out_n, min_seed_len, threads, match_score, mismatch_penalty, gap_open, gap_extend
|
Optional integer overrides for common minibwa fields. |
A plain list.
Test whether the minibwa CLI is available
minibwa_available(path = NULL)minibwa_available(path = NULL)
path |
Optional executable name or path. When |
TRUE when an executable can be resolved, otherwise FALSE.
Low-level helper for invoking arbitrary minibwa commands from R. Prefer
minibwa_index() and minibwa_map() for common workflows.
minibwa_cli(args = character(), stdout = TRUE, path = minibwa_path())minibwa_cli(args = character(), stdout = TRUE, path = minibwa_path())
args |
Character vector of command-line arguments passed to |
stdout |
Passed to |
path |
Executable name or path. |
If stdout = TRUE, a character vector of captured output; otherwise
an invisible process status.
Build a minibwa index through the CLI
minibwa_index( reference, prefix = NULL, threads = NULL, meth = FALSE, low_memory = FALSE, extra_args = character(), path = minibwa_path() )minibwa_index( reference, prefix = NULL, threads = NULL, meth = FALSE, low_memory = FALSE, extra_args = character(), path = minibwa_path() )
reference |
Path to a FASTA reference. |
prefix |
Optional output prefix. When |
threads |
Optional number of worker threads. |
meth |
If |
low_memory |
If |
extra_args |
Additional CLI arguments inserted before positional arguments. |
path |
Executable name or path. |
Invisibly, the expected index prefix.
Map reads through the minibwa CLI
minibwa_map( index, reads, output = NULL, format = c("sam", "paf"), threads = NULL, meth = FALSE, hic = FALSE, extra_args = character(), path = minibwa_path() )minibwa_map( index, reads, output = NULL, format = c("sam", "paf"), threads = NULL, meth = FALSE, hic = FALSE, extra_args = character(), path = minibwa_path() )
index |
Index prefix produced by |
reads |
One or more FASTA/FASTQ input paths. The common cases are one single-end file or two paired-end files. |
output |
Optional output file. When |
format |
Output format: |
threads |
Optional number of worker threads. |
meth |
If |
hic |
If |
extra_args |
Additional CLI arguments inserted before positional arguments. |
path |
Executable name or path. |
If output = NULL, captured alignment records as a character vector;
otherwise the output path, invisibly.
minibwa_path() resolves the command-line executable used by the CLI-backed
helpers. By default it returns the executable built from the vendored minibwa
sources and installed with Rminibwa. Supplying path is mainly for developer
comparisons against another minibwa build.
minibwa_path(path = NULL, must_work = TRUE)minibwa_path(path = NULL, must_work = TRUE)
path |
Optional executable name or path. When |
must_work |
If |
A scalar character path, or NA_character_ when must_work = FALSE
and no executable is found.
Rminibwa pins a specific upstream minibwa commit for native-library work.
minibwa_upstream_info() reports the installed copy of that provenance
metadata.
minibwa_upstream_info()minibwa_upstream_info()
A named list with fields such as Component, Version,
Repository, Commit, and PatchDirectory.
minibwa_upstream_info()[c("Version", "Commit")]minibwa_upstream_info()[c("Version", "Commit")]
Report the minibwa CLI version
minibwa_version(path = minibwa_path())minibwa_version(path = minibwa_path())
path |
Optional executable name or path. When |
A scalar character version string.
Report the selected SIMD backend
simd_backend()simd_backend()
A character scalar.
Report SIMD dispatch diagnostics
simd_info()simd_info()
A named list with dispatch mode, requested backend, selected backend, compiled backends, CPU-supported backends, available backends, and target.
Rminibwa compiles staged KSW backend objects and switches among them at
runtime. Use "auto" for the best available backend, or force one of
"scalar", "sse4", or "avx2" for diagnostics and benchmarks. The
"scalar" backend is the portable SIMDe baseline with native intrinsics
disabled; compilers may still lower portable vector types efficiently.
simd_set_backend(backend = "auto")simd_set_backend(backend = "auto")
backend |
Character scalar backend name. |
The selected backend, invisibly.