Get current parsing metrics for telemetry and performance monitoring
Provides insights into parser behavior and performance:
Copy of current parsing metrics
const parser = new FastqParser();
// ... parse some files ...
const metrics = parser.getMetrics();
console.log(`Fast path used: ${metrics.fastPathCount} times`);
console.log(`State machine used: ${metrics.stateMachineCount} times`);
console.log(`Last format detected: ${metrics.lastDetectedFormat}`);
console.log(`Detection confidence: ${metrics.lastConfidence}`);
Reset parsing metrics to initial state
Clears all accumulated metrics, useful for:
const parser = new FastqParser();
// Benchmark fast path
parser.resetMetrics();
await processFile('simple.fastq', { parsingStrategy: 'fast' });
const fastMetrics = parser.getMetrics();
// Benchmark state machine
parser.resetMetrics();
await processFile('simple.fastq', { parsingStrategy: 'state-machine' });
const smMetrics = parser.getMetrics();
Parse FASTQ sequences from a string with intelligent path selection
Automatically detects format complexity and chooses the optimal parser:
The parser selection can be controlled via parsingStrategy option:
'auto' (default): Automatic detection based on format analysis'fast': Force fast path parser (fails on complex formats)'state-machine': Force state machine parser (handles all formats)FASTQ format string
Parse multi-line FASTQ sequences using state machine Provides full FASTQ specification compliance for wrapped sequences
Parse FASTQ sequences from a file using streaming I/O with intelligent path selection
Samples the beginning of the file to detect format complexity, then uses the appropriate parser for optimal performance. Large files are processed in a memory-efficient streaming manner.
Path to FASTQ file to parse (can be compressed)
Optionaloptions: FileReaderOptionsFile reading options for performance tuning
// Parse with auto-detection
const parser = new FastqParser();
for await (const sequence of parser.parseFile('/path/to/reads.fastq')) {
console.log(`${sequence.id}: ${sequence.length} bp`);
}
// Force specific strategy for known format
const parser = new FastqParser({ parsingStrategy: 'fast' });
for await (const seq of parser.parseFile('illumina.fastq.gz')) {
// Process Illumina reads with fast parser
}
Parse FASTQ sequences from a ReadableStream
FASTQ format parser with intelligent path selection and quality score handling
Automatically detects FASTQ format complexity and chooses the optimal parsing strategy:
Features:
Example
Since
v0.1.0