Learn R Programming

seqTools (version 1.6.0)

kMerIndex: kMerIndex function: Returns array index for given DNA k-mers.

Description

For each k, there exist $4^k$ DNA k-mers. Many functions inside this package return values where DNA k-mers appear as array indices. kMerIndex can be used for extraction of count values for special k-mers by provision of index values.

Usage

kMerIndex(kMers, k=nchar(kMers)[1], base=1)

Arguments

kMers
character. Vector of equal sized character strings. The number of characters in each string must be =k (i.e. all(nchar(kMers)==k))
k
integer. Length of k-mer.
base
integer. Value must be 0 or 1 (i.e. length(base)==1). For base=0 the returned index is 0-based (i.e. the index of the first k-mer (AAA..)) is 0. Otherwise the index is 1-based.

Value

.

Details

Maximal allowed value for k is 12.

Examples

Run this code
kMerIndex(c("AACC", "ATAA"))
kMerIndex(c("AA","AC"), base=1)
kMerIndex(c("AA","AC"), base=0)

Run the code above in your browser using DataLab