shave {insect} | R Documentation |
Shave ends from DNA and amino acid sequences
Description
This function uses the Viterbi algorithm to semi-globally align a motif to a DNA or AA sequence, and removes all nucleotides to the left and/or right of the motif.
Usage
shave(x, motif, direction = "both", cores = 1, ...)
Arguments
x |
an object of class |
motif |
a |
direction |
character string indicating the direction of the shave. Options are "forward" (shaves everything to the right of the motif), "backward" (shaves everything to the left of the motif) or "both" (retains the motif region only). |
cores |
integer giving the number of processors for multithreading.
Defaults to 1, and reverts to 1 if |
... |
further arguments to be passed to |
Details
This functions finds the optimal semiglobal alignment (a.k.a. "glocal"
alignment or global alignment with free end gaps) between a
sequence "x"
and a shorter sequence "motif"
, returning
the motif region of x along with the nucleotides to the left or right
if direction
is set to "reverse"
or "forward"
,
respectively.
Value
an object of class DNAbin
or AAbin
(depending on the input object).
Author(s)
Shaun Wilkinson
See Also
Examples
data(whales)
motif = char2dna("AAGTGTAGCATCACTTATTGATCCAAATT")
shave(whales, motif = motif, direction = "both")