BioCodeKb - Bioinformatics Knowledgebase

Two sequences can be aligned globally using different algorithms. Needleman-Wunsch algorthim is one of the best algorithm for global alignment, which can be performed using the online tool EMBOSS Needle (European Molecular Biology Open Software Suite). It reads two input sequences and writes their optimal global sequence alignment to file.

Needle reads two input sequences and writes their optimal global sequence alignment to file. It uses the Needleman-Wunsch alignment algorithm to find the optimum alignment (including gaps) of two sequences along their entire length and also calculate the best score and alignment of two sequences in the order of mn steps, where n and m are the sequence lengths. The algorithm uses a dynamic programming method to ensure the alignment is optimum, by exploring all possible alignments and choosing the best. A scoring matrix is read that contains values for every possible residue or nucleotide match. Needle finds the alignment with the maximum possible score where the score of an alignment is equal to the sum of the matches taken from the scoring matrix, minus penalties arising from opening and extending gaps in the aligned sequences. The substitution matrix and gap opening and extension penalties are user-specified.

An important problem in this is the treatment of gaps, i.e., spaces inserted to optimise the alignment score. A penalty is subtracted from the score for each gap opened (the 'gap open' penalty) and a penalty is subtracted from the score for the total number of gap spaces multiplied by a cost (the 'gap extension' penalty). Typically, the cost of extending a gap is set to be 5-10 times lower than the cost for opening a gap.

Penalty for a gap of n positions is calculated using the following formula:

           gap opening penalty + (n - 1) * gap extension penalty

The Results page consists of three tabs namely Alignment, Submission details and submit another job.

The Alignment tab shows the alignment of the two sequences, with all the described parameters, used scoring matrices and Gap penalty scored values.

The Alignment tab has an option for the user to download the entire alignment file by clicking on the button “View Alignment File”

The gaps are represented with ‘-‘. If a match is there between the two nucleotide there is a symbol ‘|’ and the mismatch is represented with a dot ‘.’ in the alignment.

In a Needleman-Wunsch global alignment, the entire length of each sequence is aligned. The sequences might be partially overlapping or one sequence might be aligned entirely internally to the other. There is no penalty for the hanging ends of the overlap. In bioinformatics, it is usually reasonable to assume that the sequences are incomplete and there should be no penalty for failing to align the missing bases.

Need to learn more about NEEDLE and much more?

To learn Bioinformatics, analysis, tools, biological databases, Computational Biology, Bioinformatics Programming in Python & R through interactive video courses and tutorials, Join BioCode.

Get in touch with us

Tel: +44 7518 945488


  • Black Instagram Icon
  • Facebook


4 Mann Island, Liverpool, Merseyside, United Kingdom

Qurtaba Heights, Islamabad, Pakistan

© Copyright 2020 BioCode Ltd. - All rights reserved.