FastqView
Mojo struct 🡭
FastqView
Section titled “FastqView”@register_passable_trivialstruct FastqView[mut: Bool, //, origin: Origin[mut=mut]]Zero-copy reference to a FASTQ record inside the parser’s buffer.
Lifetime: Valid only until the next parser read or buffer mutation. Do not
store in collections (e.g. List); consume or copy to FastqRecord promptly.
Not thread-safe. Use for maximum parsing throughput when processing
immediately; use FastqRecord when you need to store or reuse records.
Attributes: id, sequence, quality: Spans into the parser buffer (id is identifier without leading ’@’). phred_offset: Phred offset (33 or 64) for quality decoding.
Example:
from blazeseq import FastqParser, FileReaderfrom std.pathlib import Pathvar parser = FastqParser[FileReader](FileReader(Path("data.fastq")), "generic")for view in parser.views(): _ = view.id() _ = view.sequence()Parameters
Section titled “Parameters”- mut (
Bool) - origin (
Origin[mut=mut])
Implemented traits
Section titled “Implemented traits”AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, Sized, TrivialRegisterPassable, Writable
Methods
Section titled “Methods”__init__
Section titled “__init__”fn __init__(id: Span[UInt8, origin], sequence: Span[UInt8, origin], quality: Span[UInt8, origin], phred_offset: UInt8 = UInt8(33)) -> SelfArgs:
- id (
Span[UInt8, origin]) - sequence (
Span[UInt8, origin]) - quality (
Span[UInt8, origin]) - phred_offset (
UInt8)
Returns:
Self
sequence
Section titled “sequence”fn sequence(self) -> StringSlice[origin]Return the sequence line as a string slice (valid only while ref is valid).
Args:
- self (
Self)
Returns:
StringSlice[origin]
quality
Section titled “quality”fn quality(self) -> StringSlice[origin]Return the quality line as a string slice (valid only while ref is valid).
Args:
- self (
Self)
Returns:
StringSlice[origin]
fn id(self) -> StringSlice[origin]Return the read identifier (id without leading ’@’) as a string slice (valid only while ref is valid).
Args:
- self (
Self)
Returns:
StringSlice[origin]
definition
Section titled “definition”fn definition(self) -> DefinitionReturn Id and optional Description parsed from the id line (first token vs rest).
Args:
- self (
Self)
Returns:
Definition
__len__
Section titled “__len__”fn __len__(self) -> IntReturn the sequence length (number of bases).
Args:
- self (
Self)
Returns:
Int
byte_len
Section titled “byte_len”fn byte_len(self) -> IntReturn total byte length when written in four-line FASTQ form.
Args:
- self (
Self)
Returns:
Int
phred_scores
Section titled “phred_scores”fn phred_scores(self) -> List[UInt8]Return Phred quality scores using the record’s phred_offset.
Args:
- self (
Self)
Returns:
List[UInt8]
fn phred_scores(self, offset: UInt8) -> List[UInt8]Return Phred quality scores using the given offset (e.g. 33 or 64).
Args:
- self (
Self) - offset (
UInt8)
Returns:
List[UInt8]
fn write[w: Writer](self, mut writer: w)Write the record in standard four-line FASTQ format to writer (emits ”@” before id and ”+” for the plus line).
Parameters:
- w (
Writer)
Args:
- self (
Self) - writer (
w)
write_to
Section titled “write_to”fn write_to[w: Writer](self, mut writer: w)Required by Writable trait; delegates to write().
Parameters:
- w (
Writer)
Args:
- self (
Self) - writer (
w)