Learn R Programming

text.alignment (version 0.1.4)

smith_waterman_misaligned: Extract misaligned elements

Description

Extract misaligned elements from the Smith-Waterman alignment, namely

  • before_alignment: Sections in a or b which were occurring before the alignment

  • wrong_alignment: Sections in a or b which were mismatched in the alignment

  • after_alignment: Sections in a or b which were occurring after the alignment

Usage

smith_waterman_misaligned(x, type = c("a", "b"))

Value

a list of character vectors of misaligned elements

  • before_alignment: Sections in a or b which were occurring before the alignment

  • wrong_alignment: Sections in a or b which were mismatched in the alignment

  • after_alignment: Sections in a or b which were occurring after the alignment

  • combined: The combination of before_alignment, wrong_alignment and after_alignment

  • partial: Logical, where TRUE indicates that there is at least a partial alignment and FALSE indicating no alignment between a and b was done (alignment score of 0)

Arguments

x

an object of class smith_waterman as returned by smith_waterman

type

either 'a' or 'b' indicating to return elements misaligned from a or from b

Examples

Run this code
sw <- smith_waterman("ab test xy", "cd tesst ab", type = "characters")
sw
misses <- smith_waterman_misaligned(sw, type = "a")
str(misses)
misses <- smith_waterman_misaligned(sw, type = "b")
str(misses)

a <- system.file(package = "text.alignment", "extdata", "example1.txt")
a <- readLines(a)
a <- paste(a, collapse = "\n")
b <- system.file(package = "text.alignment", "extdata", "example2.txt")
b <- readLines(b)
b <- paste(b, collapse = "\n")
sw <- smith_waterman(a, b, type = "characters")
smith_waterman_misaligned(sw, type = "a")
smith_waterman_misaligned(sw, type = "b")

Run the code above in your browser using DataLab