Subsample Reads

Randomly select a representative subset of reads from a FASTQ file

Supported formats: FASTQ, FQ and compressed FASTQ files (.fastq.gz, .fq.gz) (Maximum size: 500 MB)

Subsample Reads

Function

Randomly selects a fraction of reads from a FASTQ file to generate a smaller but representative dataset. An optional random seed allows reproducible sampling.


Input Format

  • FASTQ files (.fastq, .fq)
  • Compressed FASTQ files (.fastq.gz, .fq.gz)
  • Sampling fraction between 0 and 1
  • Optional random seed

Output Format

  • FASTQ file containing a randomly selected subset of reads.
  • Original read structure and quality scores are preserved.

Applications

  • Pipeline testing.
  • Reducing computational requirements.
  • Benchmarking workflows.
  • Quality-control spot checks.
  • Normalizing sequencing depth between samples.

SeqKit Example

seqkit sample \
-p 0.1 \
-s 42 \
input.fastq.gz \
-o subsampled.fastq.gz

SeqTK Example

seqtk sample \
-s 42 \
input.fastq.gz \
0.1 > subsampled.fastq

Paired-End Example

seqtk sample -s 42 R1.fastq.gz 0.1 \
> R1_sub.fastq

seqtk sample -s 42 R2.fastq.gz 0.1 \
> R2_sub.fastq

Suggested Reading


Important Notes:
  • The same seed and fraction should be used for paired-end files to preserve read pairing.
  • Different seeds will generate different subsets.
  • The actual read count may vary slightly because sampling is random.
  • Subsampling does not alter sequence or quality information.
  • Keep the original FASTQ file if the complete dataset may be needed later.