slidingWindow: Create windows along an alignment

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/slidingWindow.R

Description

Creates windows of a specified width along a DNA alignment.

Usage

1
slidingWindow(DNAbin, width, interval = 1)

Arguments

DNAbin

A DNA alignment of class ‘DNAbin’.

width

Width of each window.

interval

Numeric or option of "codons". This sets interval between windows. Default of 1. Setting the option to "codons" gives an interval of 3.

Details

Sliding window analyses are often used to determine the variability along sequences. This can be useful for investigating whether there is evidence for recombination, developing shorter genetic markers, or for determining variation within a gene.

Analyses can be conducted on each window using lapply.

Value

A list of ‘DNAbin’ objects, with each alignment being width bases in length. The list has length of the DNA alignment minus the width. The positions covered by each window can be retreived with attr(x, "window").

Author(s)

Samuel Brown <[email protected]>

See Also

lapply, slideAnalyses, slideBoxplots.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(woodmouse)
woodmouse <- woodmouse[,1:20]
win1 <- slidingWindow(woodmouse, width = 10)
length(win1)

win2 <- slidingWindow(woodmouse, width = 10, interval = 2)
length(win2)

win3 <- slidingWindow(woodmouse, width = 10, interval = "codons")
length(win3)

win4 <- slidingWindow(woodmouse, width = 15)
length(win4)
attr(win4[[1]], "window")
attr(win4[[2]], "window")

spider documentation built on Feb. 17, 2018, 1:02 a.m.