Skip to content

Getting Started

github-actions[bot] edited this page Oct 31, 2026 · 1 revision

Getting started

This is the path I recommend for a first look: a tiny file, and one command at a time, so you can see exactly what each one does. It takes a few minutes, and assumes z-fastq is on your PATH (Installation).

1. Make a file

Save this as reads.fastq. It holds two records, one of five bases and one of three:

@read-1
ACGTN
+
IIIII
@read-2
GGC
+
III

2. Check it

z-fastq check reads.fastq

Nothing is printed. For check, silence and exit status 0 mean the file is valid, which is exactly what a script wants. Validation explains what is checked.

3. Count and summarize it

z-fastq count reads.fastq
z-fastq stats reads.fastq

count prints 2. stats adds bases, lengths, base composition, GC, and quality; Counting and statistics explains each number.

4. Read gzip and pipes

gzip -c reads.fastq > reads.fastq.gz
z-fastq stats reads.fastq.gz
gzip -dc reads.fastq.gz | z-fastq count -

z-fastq recognizes gzip by its first bytes rather than by the .gz name, and reads standard input only when you write - (Input and output).

5. Take a sample

z-fastq sample --fraction 0.5 --seed 3 reads.fastq > sample.fastq

With seed 3 it keeps one of the two records. Run it again: the same seed and input always give the same records. Sampling also covers exact counts and pairs.

Where next

Clone this wiki locally