Learn R Programming

dada2 (version 1.0.3)

nwalign: Needlman-Wunsch alignment.

Description

This function performs a Needleman-Wunsch alignment between two sequences.

Usage

nwalign(s1, s2, score = getDadaOpt("SCORE_MATRIX"), gap = getDadaOpt("GAP_PENALTY"), homo_gap = NULL, band = -1, endsfree = TRUE)

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.
score
(Optional). A 4x4 numeric matrix. Default is getDadaOpt("SCORE_MATRIX"). The match/mismatch used for the alignment.
gap
(Optional). numeric(1). Default is getDadaOpt("GAP_PENALTY"). The alignment gap penalty. Should be negative.
homo_gap
(Optional). numeric(1). Default NULL (no special homopolymer penalty). The alignment gap penalty within homopolymer regions. Should be negative.
band
(Optional). numeric(1). Default -1 (no banding). This Needleman-Wunsch alignment can be banded. This value specifies the radius of that band. Set band = -1 to turn off banding.
endsfree
(Optional). logical(1). Default TRUE. Allow free gapping at the ends of sequences.

Value

character(2). The aligned sequences.

Examples

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

Run the code above in your browser using DataLab