tbl_fastq: Create a lazy table reference from a FASTQ file

View source: R/tbl.R

tbl_fastqR Documentation

Create a lazy table reference from a FASTQ file

Description

Streams a FASTQ file as rows: one row per record with columns id, desc, seq, and qual (the raw quality string, same length as seq). id and desc are split from the header as in tbl_fasta(). Records stream one batch at a time, so a read set larger than RAM never fully materializes. Gzip-compressed files (.fastq.gz, .fq.gz) are read transparently. No data is read until collect() is called.

Usage

tbl_fastq(path, batch_size = .DEFAULT_BATCH_SIZE, quiet = FALSE)

Arguments

path

Path to a .fastq/.fq file, optionally gzip-compressed.

batch_size

Number of records per batch (default 65536).

quiet

If FALSE (default), report the record count when the scan completes.

Details

Records are parsed in the standard four-line form (header, sequence, + separator, quality). A record cut short — a missing sequence, separator, or quality line, or a quality string whose length does not match the sequence — is a loud error, not a silent drop. When the scan reaches the end of the file it reports the number of records read (suppress with quiet = TRUE).

Value

A vectra_node object representing a lazy scan of the FASTQ file.

See Also

tbl_fasta(), seq_expressions

Examples

f <- tempfile(fileext = ".fastq")
writeLines(c("@r1 read one", "ACGT", "+", "IIII",
             "@r2 read two", "GGCC", "+", "!!!!"), f)
node <- tbl_fastq(f, quiet = TRUE)
node |> mutate(len = seq_length(seq)) |> collect()
unlink(f)


vectra documentation built on July 10, 2026, 5:08 p.m.