Fastx::Fasta::Reader
Inherits Reference < Object
Constructors
Creates a new FASTA reader for the specified file. Automatically detects gzip compression from .gz extension.
Creates a new FASTA reader for an already opened IO stream. IO-based readers do not perform gzip auto-detection. The reader takes ownership of the IO and closes it when the reader is closed.
Class methods
Opens a FASTA file, yields the reader to the block, and automatically closes it.
Opens a FASTA stream, yields the reader to the block, and automatically closes it.
Instance methods
Iterates over each FASTA record, yielding name and sequence as owned
String copies that remain valid after iteration.
Iterates over each FASTA record, yielding name and sequence as borrowed
Bytes (Slice(UInt8)).
The yielded slices point into internal buffers that are reused on every
iteration. They are backed by reader-owned reusable buffers, not
guaranteed zero-copy views of the input stream, and are only valid until
the next record is read. To keep a value beyond the current iteration,
copy it (String.new(bytes) or bytes.dup) or use #each.
Iterates over FASTA records while streaming sequence lines without accumulating the full sequence in memory. This is the lowest-memory FASTA reading API.
The yielded name is an owned String. SequenceLines#each yields
borrowed Bytes slices into an internal buffer; each slice is only valid
until the next line is read. Copy it (String.new(bytes) or bytes.dup)
to keep it.
The specific method name leaves #each_record available for a possible
future record-oriented API.