Repository navigation
Releases
z-fastq 0.2.1
Faster gzip input, from Zipir 0.3.0's rebuilt DEFLATE decoder: count, stats, and check take 15 to 18% less CPU time on gzip files. process can now move a UMI from the start of the reads into their names, as fastp does. Output bytes, JSON documents, and exit statuses are unchanged, apart from the report fields the UMI options add and the fixes below.
Added
- UMIs.
process --umi-length N --umi-mates 1|2|bothmoves an N-base unique molecular identifier from the start of mate 1, mate 2, or both into the names of both mates, in fastp's@NAME:UMI1_UMI2form, and--umi-skip Sremoves the S spacer bases that follow it. Trimming, filters, insert sizes, and the retained statistics see the read after the spacer; the raw statistics and the pair duplication rate see it as read. A pair in which a UMI mate has no base left is dropped as too short. The written records are those fastp 1.4.0 writes with--umi --umi_loc per_read(orread1,read2), except that z-fastq places the UMI before a trailing/1or/2and before a tab, updates a header repeated on the plus line, and drops a pair that fastp keeps as a one-base read.- The
z-fastq/process-v1report gains the optionsumi_length,umi_skip, andumi_mates, and aumiobject with the pairs whose UMI holds a base other than A, C, G, or T in either case and the short pairs; each isnullwithout the options. Without them, outputs, QC tables, and the QC summary are unchanged.
- The
Changed
- Speed. gzip input decodes through Zipir 0.3.0, whose rebuilt DEFLATE decoder takes 15 to 18% less CPU time for
count,stats, andcheckon gzip input.processwith gzip input and output takes about the same time as before, because compression and trimming dominate it. Output bytes, JSON documents, exit statuses, and peak memory are unchanged.
Fixed
- Outputs after a failed write. When a write to one
deinterleaveoutput fails, the records already buffered for the other output are written before the command exits with status3, asprocessdoes; they were dropped. When theprocessreport itself cannot be written, the incomplete file is removed, as the QC summary is, instead of being left as truncated JSON. - QC table folders. A failed
processrun removes the QC table folders it created, so a rerun is not blocked by them; folders that existed before are kept.
z-fastq 0.2.0
A process command that validates, trims, and filters paired reads into two plain or gzip outputs with a JSON report, faster record handling in every command, AVX2 kernels selected at run time on CPUs that have them, bounded memory for stats and paired sampling on long reads, and stricter handling of standard input and output. Output bytes, JSON documents, and exit classes are unchanged except where a fix below says so.
Added
- Commands.
processreads two mate files pair by pair and writes them to two new files.- It validates every pair as
check --paireddoes and writes the accepted pairs, plain or gzip (--gzip, Zipir'sfastpreset by default,--gzip-preset evenordensefor smaller files).--max-pairs Nstops after the first N pairs. The same inputs and options give byte-identical outputs and report. - Trimming, each step off unless its options are given:
--adapter1with--adapter2removes adapters and mate overlaps,--trim-poly-g Nremoves 3' poly-G runs, and--trim-tail-window Wwith--trim-tail-quality Qremoves low-quality 3' ends. Trimming uses the same fixed memory at any read length. - Filtering, each filter off unless given:
--low-quality Qwith--max-low-quality-percent P,--max-n N, and--min-length Ndrop a pair when either mate fails. With any trim or filter option, a pair with a mate trimmed to nothing, or an adapter dimer, is dropped too. The written records are those fastp 1.1.0 writes with the matching options. Dropped pairs never change the exit status. --reportwrites az-fastq/process-v1JSON document, and only with it or the two files below are statistics computed: per-mate statistics and FastQC's core quality modules, computed as FastQC 0.13.0 computes them, for the reads as read and as written; terminal poly-G and poly-A counts; FastQC's Adapter Content for its bundled adapter list, raw and retained; insert sizes from the mate overlap as fastp counts them, with the count of overlapping pairs, peak, and median; FastQC's Sequence Duplication Levels and Overrepresented sequences, raw and retained, and its Per tile sequence quality from Illumina read headers, with each sequence's source named from a FastQC contaminant list given with--contaminants; fastp's pair duplication rate with--pair-duplication; the reads and bases each trimming step removed; the dropped pairs and failed reads by reason; and any failure.--qc-tables DIRand--qc-summary PATHwrite the same measurements in formats MultiQC reads: QC tables in FastQC'sfastqc_data.txtlayout per mate for the reads as read and, when trimming or filtering changes them, as written, each module with the status FastQC gives it at its default limits; and a JSON summary in fastp's report layout with the run's totals, filter counts, and per-cycle curves. Both are written only when the run succeeds. The wiki page References names the tools whose rules and formats they follow.
- It validates every pair as
- Library.
FileSink.initStreamingwrites at the file handle's current position, for standard output and pipes.Stats.ratiosreturns each ratio ofStatsResultas an exact numerator and denominator, so callers can round without floating point.
- Build.
- Linux aarch64 is supported:
-Dtarget=aarch64-linuxbuilds it, and release builds are static for the requested architecture. It uses the portable kernels; the AVX2 object is x86-64 only. -Dstripsets whether debug information is stripped; it defaults to on for ReleaseFast, so a profiling build can keep its symbols.zig build test-<suite>runs a single test binary, such astest-reader, ortest-srcfor the in-file tests;zig build -llists them.
- Linux aarch64 is supported:
- Releases. Each GitHub release carries static, stripped Linux binaries for x86-64 and aarch64 and the source package a Zig dependent fetches, with SHA-256 checksums and build provenance attestations. Both are tested before they are published: each binary is smoke-tested on every command after unpacking, on its own architecture, and the source package is fetched into a fresh package and tested there.
Changed
- Speed.
sample,interleave, anddeinterleavetake complete records straight from the read buffer and write output in whole pages, which roughly halves their time on plain input without raising peak memory beyond a few KiB.- Interleaved fraction sampling, exact-count sampling in every mode, and
check --pairedand--interleavedtake records the same way, and the exact-count output pass skips unselected records with less work: 5 to 20% less time on plain input. - On CPUs with AVX2, builds whose target lacks AVX2 select 32-byte kernels at run time for newline search past the first 1 KiB of a line, validation of sequences of 1 KiB or more (about a third less time for
checkon PacBio reads, 15 to 20% forcheckandsampleon ONT reads), validation of lines longer than the read buffer, andstatscounting on reads of 1 KiB or more (about a quarter less time on long reads). - Fraction sampling validates the records it does not select without copying them: 5 to 25% less time for
sampleand single-filecheckon long reads, with no change in memory.
- Memory.
statsstreams a record larger than the read buffer instead of copying it, so its peak memory no longer grows with read length (about 0.8 MiB on every input shape in the stats benchmark, from up to 1.8 MiB on 300 kb reads), long reads take 5 to 25% less time, andstatsallocates nothing per record.- Paired and interleaved fraction sampling draw each pair before reading it and validate unselected pairs without keeping them: on 300 kb read pairs, peak memory for
sample --pairedfalls from 2.3 MiB to 0.8 MiB when few pairs are selected.check --interleavedanddeinterleaveread a mate whose partner already failed only far enough to report it.
- Library.
FileSinkwrites whole pages and keeps a partial last page buffered until the next write orflush. - Build.
-Dkernel-backend=portablebuilds no AVX2 object and selects no kernel at run time; z-fastq's own kernels then use only the instructions of the build target, as Zipir's do.- Debug builds compile with LLVM, as release builds do. With Zig 0.16's own x86-64 code generator, a Debug build on a CPU with PCLMUL could corrupt state after the gzip CRC32 kernel, and an unrelated test then failed.
Fixed
- Standard input and output.
count,stats, andcheckreject standard output appended to one of their inputs (count a.fastq b.fastq >> b.fastq) with status2before reading anything, assampleandinterleavealready did; the input is no longer changed.- Standard input named twice, as
- /dev/stdinor/dev/stdin /dev/stdin, is rejected when it is a pipe or FIFO instead of being read once and reported as zero records for the second name. - A pipe closed by its reader ends every command with status
3anderror: standard output: I/O error, as documented, instead of a SIGPIPE status of 141;sample,stats,count, and the JSON forms print that message on any standard-output failure.
- Inputs and outputs.
- A directory given as an input is reported as
input is a directorybefore anything is read, instead ofI/O error;deinterleavethen creates no output files. deinterleaveremoves the empty--out1it created when--out2cannot be created, so a rerun is not blocked by it.- Exact-count sampling of a FIFO or directory exits with status
2, as for standard input, instead of3.
- A directory given as an input is reported as
- Options and limits.
- A value option given twice (
--count 1 --count 2) fails with status2andmay appear only once, as--out1and--out2already did, instead of keeping the last value. sample --interleavedanddeinterleaveaccept every--max-line-bytesvalue the other commands accept, instead of exiting with status4before reading for values of 2^62 - 1 and above, sometimes with no message.statsreports an input location past the supported limit asinput location exceeds supported limit, as the other commands do.
- A value option given twice (