Learn R Programming

dada2 (version 1.0.3)

nwhamming: Hamming distance after Needlman-Wunsch alignment.

Description

This function performs a Needleman-Wunsch alignment between two sequences, and then counts the number of mismatches and indels in that alignment. End gaps are not included in this count.

Usage

nwhamming(s1, s2, ...)

Arguments

s1
(Required). character(1). The first sequence to align. A/C/G/T only.
s2
(Required). character(1). The second sequence to align. A/C/G/T only.
...
(Optional). Further arguments to pass on to nwalign.

Value

integer(1). The total number of mismatches and gaps, excluding gaps at the beginning and end of the alignment.

Examples

Run this code
 sq1 <- "CTAATACATGCAAGTCGAGCGAGTCTGCCTTGAAGATCGGAGTGCTTGCACTCTGTGAAACAAGATA"
 sq2 <- "TTAACACATGCAAGTCGAACGGAAAGGCCAGTGCTTGCACTGGTACTCGAGTGGCGAACGGGTGAGT"
nwhamming(sq1, sq2)
nwhamming(sq1, sq2, band=16)

Run the code above in your browser using DataLab