nwalign: Needleman-Wunsch alignment.

View source: R/misc.R

nwalignR Documentation

Needleman-Wunsch alignment.

Description

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

Usage

nwalign(
  s1,
  s2,
  match = getDadaOpt("MATCH"),
  mismatch = getDadaOpt("MISMATCH"),
  gap = getDadaOpt("GAP_PENALTY"),
  homo_gap = NULL,
  band = -1,
  endsfree = TRUE,
  vec = FALSE
)

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.

match

(Optional). numeric(1). Default is getDadaOpt("MATCH"). The score of a match in the alignment.

mismatch

(Optional). numeric(1). Default is getDadaOpt("MISMATCH"). The score of a mismatch in 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). The 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 unpenalized gaps at the ends of the alignment.

vec

(Optional). logical(1). Default FALSE. Use DADA2's vectorized aligner instead of standard DP matrix. Not intended for long sequences (>1kb).

Value

character(2). The aligned sequences.

Examples

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


benjjneb/dada2 documentation built on Nov. 16, 2024, 6:45 a.m.