Filter Sequences by Length

Retain only sequences within a specified length range

Supported formats: FASTQ, FQ, FASTA, FA, FNA and compressed files (.gz) (Maximum size: 500 MB per file)

Filter Sequences by Length

Function

Filters FASTQ or FASTA sequences based on user-defined minimum and maximum length thresholds. Reads outside the specified range are removed from the output.


Input Format

  • FASTQ files (.fastq, .fq)
  • FASTA files (.fasta, .fa, .fna)
  • Compressed files (.gz)
  • User-defined minimum and/or maximum sequence length.

Output Format

  • Filtered FASTQ or FASTA file.
  • Output format remains identical to the input format.
  • Only sequences within the selected length range are retained.

Applications

  • Remove short low-information reads.
  • Eliminate extremely long outlier reads.
  • Prepare datasets for assembly.
  • Standardize read lengths.
  • Select reads matching expected amplicon or feature sizes.

Example

Input Reads

25 bp
80 bp
150 bp
400 bp

Minimum Length = 50
Maximum Length = 300

↓

Retained Reads

80 bp
150 bp

SeqKit Example

seqkit seq \
-m 50 \
-M 300 \
input.fastq.gz \
-o filtered.fastq.gz

FASTA Example

seqkit seq \
-m 50 \
-M 300 \
input.fasta \
-o filtered.fasta

Suggested Reading


Important Notes:
  • Length filtering does not consider quality scores.
  • Reads shorter than the minimum threshold are removed.
  • Reads longer than the maximum threshold are removed.
  • Use quality filtering tools such as fastp, NanoFilt, or Filtlong when quality-based filtering is also required.
  • Choose thresholds appropriate for your sequencing platform.