Align two sequences using local (Smith-Waterman) or global (Needleman-Wunsch) sequence alignment.

align(
  x1,
  x2,
  score.matrix = NULL,
  gap.score = -1,
  type = "local",
  debug = FALSE
)

Arguments

x1

pattern sequence: a character vector, scalar or AAString.

x2

subject sequence: a character vector, scalar or AAString.

score.matrix

substitution matrix.

gap.score

gap score.

type

type of alignment: global or local (default: local).

debug

logical; whether to return debugging data.

Value

AlignResult object.

Examples

library(motiftools) align("ALVDE", "AVRES", score.matrix = "BLOSUM62")
#> $alignment #> 1 2 3 4 5 #> x "A" "L" "V" "D" "E" #> y "A" "-" "V" "R" "E" #> #> $score #> [1] 26 #>