How to cluster peptide/protein sequences using cd-hit software?

in Softwares/Tools by

Cd-hit is one of the most widely used programs to cluster biological sequences [1]. It helps in removing the redundant sequences and provides better results in the sequence analyses. Cd-hit is used for sequence-based clustering by making clusters of a particular cut off provided as an input. It uses a single linkage clustering and finds a representative sequence for each cluster. In this article, we will learn how to cluster a set of protein sequences using cd-hit software.

Cd-hit package has many programs for clustering different kinds of sequences. For example, the cd-hit program is used to cluster peptide sequences, cd-hit-est is used to cluster nucleotide sequences, and even this package can compare two different databases using cd-hit-2d and cd-hit-est-2d to compare peptide and nucleotide databases respectively [1]. In this tutorial, we are using cd-hit program which is used to cluster a group of peptide sequences. The complete package of cd-hit can be downloaded from here.

Prepare input file

The input file consists of all the peptide or protein sequences in FASTA format. There is no need to format the FASTA header of the sequences. The software manages it on its own.

Basic commands

$ cd-hit -i input.fasta -o db100 -c 1.00 -n 5 -M 2000


-i = input

-o = output

-c = cut-off

-n = word size:

n=5 for thresholds 0.7 ~ 1.0

n=4 for thresholds 0.6 ~ 0.7

n=3 for thresholds 0.5 ~ 0.6

n=2 for thresholds 0.4 ~ 0.5

-M = maximum available memory

T0 cluster the sequences at 97% similarity cut-off

$ cd-hit -i input.fasta -o db90 -c 0.97 -n 5 -M 2000


The output of cd-hit provides two different files:

1. A FASTA file of the representative sequences of all the clustered sequences.

2. A text file listing all the clusters showing a representative sequence signified with a ‘*’ at the end of the header of the sequence.

There are many other options which you can define in the command line including -G to use global sequence identity, -t to set tolerance for redundancy, -l to set length of throw_away_sequences, and -d to adjust the description of sequences in the .clstr output file. You can read about the command-line options either in the user guide provided at the cd-hit website ( or by entering the help command ($ cd-hit --help).


  1. Li, W., & Godzik, A. (2006). Cd-hit: a fast program for clustering and comparing large sets of protein or nucleotide sequences. Bioinformatics22(13), 1658-1659.
Download PDF

Leave a Reply