sassy_fastx_iter() opens a FASTA or FASTQ file and returns an iterator that
yields record-count-bounded batches. Parsing is performed by the vendored
Rust needletail parser. Sequence and quality data in each batch are exposed
as read-only raw ALTREP slices over immutable native batch buffers; they are
not eagerly materialized as R strings.
Arguments
- path
Path to a FASTA/FASTQ file. Gzip-compressed input is supported by the vendored
needletailgzip backend.- batch_records
Maximum number of records returned by each
sassy_fastx_next()call.- include_qual
If
TRUE, FASTQ qualities are included asbatch$qual. IfFALSE, or for FASTA input,batch$qualisNULL.
Examples
fq <- tempfile(fileext = ".fastq")
writeLines(c("@r1", "ACGT", "+", "!!!!"), fq, useBytes = TRUE)
it <- sassy_fastx_iter(fq, batch_records = 1)
batch <- sassy_fastx_next(it)
rawToChar(batch$seq[[1]])
#> [1] "ACGT"