# Clustal

Clustal is a computer program used for multiple sequence alignment in bioinformatics. The software and its algorithms have gone through several iterations, with ClustalΩ (Omega) being the latest version as of 2011. It is available as standalone software, via a web interface, and through a server hosted by the European Bioinformatics Institute.
Clustal has been an important bioinformatic software, with two of its academic publications amongst the top 100 papers cited of all time, according to Nature in 2014.

## History
### Version history

* Clustal: The original software for multiple sequence alignments, created by Des Higgins in 1988, was based on deriving a guide tree from pairwise sequences of amino acids or nucleotides.
* ClustalV: The second generation of Clustal, released in 1992. It introduced the ability to create new alignments from existing alignments in a process known as phylogenetic tree reconstruction. ClustalV also added the option to create trees using the neighbor joining method.
* ClustalW: The third generation, released in 1994. It improved upon the progressive alignment algorithm, including sequence weighting options based on similarity and divergence. Additionally, it added the option to run Clustal in batch mode from the command line.
* ClustalX: Released in 1997, this was the first version to have a graphical user interface.
* Clustal2: This updated both ClustalW and ClustalX with higher accuracy and efficiency in 2007.
* ClustalΩ (Omega): The current version, released in 2011.

### Name origin

The guide tree in the initial versions of Clustal was constructed via a UPGMA cluster analysis of the pairwise alignments, hence the name CLUSTAL.$^{cf.}$ The first four versions of Clustal were numbered using Arabic numerals (1 to 4), whereas the fifth version uses the Roman numeral V.$^{cf.}$ The next two versions proceed alphabetically using the Latin alphabet, with W standing for weighted and X for X Window to represent the changes introduced.$^{cf.}$ The name Omega was chosen to mark a change from the previous iterations.

## Function

Clustal aligns sequences using a heuristic that progressively builds a multiple sequence alignment from a set of pairwise alignments. This method works by analyzing the sequences as a whole and using the UPGMA/neighbor-joining method to generate a distance matrix. A guide tree is calculated from the scores of the sequences in the matrix, then subsequently used to build the multiple sequence alignment by progressively aligning the sequences in order of similarity.
Clustal creates multiple sequence alignments through three main steps:
* Complete a pairwise alignment using the progressive alignment method.
* Create a guide tree (or use a user-defined tree).
* Use the guide tree to carry out a multiple alignment.
These steps are carried out automatically by the function "Do Complete Alignment". Other options are "Do Alignment from guide tree and phylogeny" and "Produce guide tree only".

### Input/Output

This program accepts a wide range of input formats, including NBRF/PIR, FASTA, EMBL/Swiss-Prot, Clustal, GCC/MSF, GCG9 RSF, and GDE.
The output format can be one or many of the following: Clustal, NBRF/PIR, GCG/MSF, PHYLIP, GDE, or NEXUS.
Reading Multiple Sequence Alignment Output :
| Symbol | Definition | Meaning |
| * | asterisk | positions that have a single and fully conserved residue |
| : | colon | conserved: conservation between groups of strongly similar properties (score > 0.5 on the PAM 250 matrix) |
| . | period | semi-conserved: conservation between groups of weakly similar properties (score ≤ 0.5 on the PAM 250 matrix) |
| | blank | non-conserved |
The same symbols are shown for both DNA/RNA alignments and protein alignments, so while * (asterisk) symbols are useful for both, the other consensus symbols should be ignored for DNA/RNA alignments.

### Settings

The gap opening penalty and gap extension penalty parameters can be adjusted by the user.

## Clustal and ClustalV
### Brief summary

The original Clustal software was developed in 1988 as a computational method for generating multiple sequence alignments on personal computers. ClustalV was released 4 years later and greatly improved upon the original software, adding and altering few key features. It was a full re-write, written in C instead of Fortran.

### Algorithm

Both versions use the same fast approximate algorithm to calculate the similarity scores between sequences, which in turn produces the pairwise alignments. The algorithm works by calculating the similarity scores as the number of k-tuple matches between two sequences, accounting for a set penalty for gaps. The more similar the sequences, the higher the score. Once the sequences are scored, a dendrogram is generated through the UPGMA to generate an ordering of the multiple sequence alignment. Sequences are aligned in descending order by set order. This algorithm allows for very large data sets and is fast. However, the speed is dependent on the range of k-tuple matches selected for the particular sequence type.

### Notable ClustalV improvements

Some of the most notable additions in ClustalV are profile alignments, and full command line interface options. The ability to use profile alignments allows the user to align two or more previous alignments or sequences to a new alignment and move misaligned sequences (low scored) further down the alignment order. This gives the user the option to gradually and methodically create multiple sequence alignments with more control than the basic option. The option to run from the command line expedites the multiple sequence alignment process. Sequences can be run with a simple command,
or
and the program will determine what type of sequence it is analyzing. When the program is completed, the output of the multiple sequence alignment as well as the dendrogram go to files with .aln and .dnd extensions respectively. The command line interface uses the default parameters, and doesn't allow for other options.

## ClustalW
### Brief summary

ClustalW, like other Clustal versions, is used for aligning multiple nucleotide or protein sequences efficiently. It uses progressive alignment methods, which prioritize sequences for alignment based on similarity until a global alignment is returned. ClustalW is a matrix-based algorithm, whereas tools like T-Coffee and Dialign are consistency-based. ClustalW is efficient, with competitive in comparison with similar software. This program requires three or more sequences in order to calculate a global alignment. For binary sequence alignment, other tools such as EMBOSS or LALIGN should be used.

### Algorithm

ClustalW uses progressive alignment algorithms. In these, sequences are aligned in most-to-least alignment score order. This heuristic is necessary to restrict the time- and memory-complexity required to find the globally optimal solution.
First, the algorithm computes a pairwise distance matrix between all pairs of sequences (pairwise sequence alignment). Next, a neighbor-joining method uses midpoint rooting to create an overall guide tree. A diagram of this method is illustrated to the right. Finally, the guide tree is used as an approximate template to generate a global alignment.

### Time complexity

ClustalW has a time complexity of $O(N^{2})$ because of its use of the neighbor-joining method.
ClustalW2 added an option to use UPGMA instead which is faster for large input sizes. The command line flag in order to use it instead of neighbor-joining is:
As an approximate example, while a 10,000 sequences input would take over an hour for neighbor-joining, UPGMA would complete in less than a minute.
ClustalW2 also added an iterative alignment accuracy. This option does not increase efficiency, but it does offer the ability to increase alignment accuracy. This can be especially useful for small datasets.
The following flags activate iterative alignment:
The first option refines the final alignment. The second option incorporates the scheme in the progressive alignment step. The third specifies the number of iteration cycles, where the default value is set to 3.

### Accuracy and Results

The algorithm ClustalW uses is nearly optimal. It is most effective for datasets with a large degree of variance. On such datasets, the process of generating a guide tree is less sensitive to noise. ClustalW was one of the first multiple sequence alignment algorithms to combine pairwise alignment and global alignment to increase speed, but this decision reduces result accuracy.
When multiple sequence alignment algorithms were compared in 2014, ClustalW was one of the fastest that was able to produce results at the desired level of accuracy. However, it was not as accurate as consistency-based competitors such as T-Coffee. Out of MAFFT, T-Coffee, and Clustal Omega, ClustalW has the lowest accuracy for full-length sequences, but its accuracy is still considered acceptable. Additionally, ClustalW was the most memory-efficient algorithm of those studied. Continued updates to the software have made ClustalW2 more accurate while maintaining this speed.

## Clustal Omega
### Brief summary

ClustalΩ (alternatively written as Clustal O and Clustal Omega) is a fast and scalable program written in C and C++ used for multiple sequence alignment. It uses seeded guide trees and a new HMM engine that focuses on two profiles to generate these alignments. The program requires three or more sequences in order to calculate the multiple sequence alignment. Clustal Omega is consistency-based and is widely viewed as one of the fastest online implementations of all multiple sequence alignment tools and still ranks high in accuracy, among both consistency-based and matrix-based algorithms.

### Algorithm

Clustal Omega has five main steps in order to generate the multiple sequence alignment.
* A pairwise alignment is produced using the k-tuple method.This is a heuristic method that isn't guaranteed to find an optimal solution, but is more efficient than using dynamic programming.
* Sequences are clustered using the modified mBed method. The mBed method calculates pairwise distance using sequence embedding.
* The k-means clustering method is applied.
* A guide tree is constructed using the UPGMA method. In the figure to the right, this is shown as multiple guide tree steps leading into one final guide tree construction because of the agglomerative nature of UPGMA. At each step (diamonds in the flowchart), the nearest two clusters are combined. This is repeated until a final, global tree can be assessed.
* The final multiple sequence alignment is produced with the HHAlign package from the HH-Suite using two profile HMM's. A profile HMM is a linear state machine consisting of a series of nodes, each of which corresponds roughly to a position (column) in the alignment from which it was built.

### Time complexity

The time complexity of exactly computing an optimal alignment of $N$sequences of length $L$ is $O(L^{N})$ which is prohibitive for even a small number of sequences. To manage this, Clustal Omega uses a modified version of mBed which has a complexity of $O(N\log N)$, and produces guide trees that are as accurate as those from conventional methods. The speed and accuracy of the guide trees in Clustal Omega is attributed to the implementation of a modified mBed algorithm. It also reduces the computational time and memory requirements to complete alignments on large datasets.

### Accuracy and results

The accuracy of Clustal Omega on a small number of sequences is, on average, very similar to what are considered high quality sequence aligners. On extremely large datasets with hundreds of thousands of input sequences, Clustal Omega outperforms all other algorithms in time, memory, and accuracy of results. It is capable of running 100,000+ sequences on one processor in a few hours.
Clustal Omega uses the HHAlign package of the HH-Suite, which aligns two profile Hidden Markov Models instead of a profile-profile comparison. This improves the quality of the sensitivity and alignment significantly. This, combined with the mBed method, gives Clustal Omega its advantage over other sequence aligners.
On data sets with non-conserved terminal bases, Clustal Omega can be more accurate than Probcons or T-Coffee, despite the fact that both are consistency-based algorithms. On an efficiency test with programs that produce high accuracy scores, MAFFT was the fastest, closely followed by Clustal Omega. Both were faster than T-Coffee, however MAFFT and Clustal Omega required more memory to run.

## Clustal2 (ClustalW/ClustalX)

Clustal2 is the packaged release of both the command-line ClustalW and graphical Clustal X. Neither are new tools, but are updated and improved versions of the previous implementations seen above. Both downloads come pre-compiled for many operating systems like Linux, Mac OS X and Windows (both XP and Vista). This release was designed to make the website more organized and user friendly, as well as updating the source codes to their most recent versions. Clustal2 is version 2 of both ClustalW and ClustalX, which is where it gets its name. Past versions can still be found on the website, however, every pre-compilation is now up to date.