count {seqinr} | R Documentation |
Counts the number of times dimer/trimer/etc nucleotides occurs in a sequence. Note that the oligomers are overlapping.
count(seq,word,frame=0,freq=FALSE)
seq |
a vector of chars |
word |
an integer giving the size of word (n-mer) to count |
frame |
an integer (0,1,2,...) giving the frame (starting position) |
freq |
if TRUE, word frequencies are computed instead of counts |
count
counts the occurence of all words by moving a window of
length word
. The window step is always an unit. frame
controls the starting position in the sequence for the count.
This function returns a factor whose levels are all the possible oligonucleotides. All oligomers are returned, even if absent from the sequence.
D. Charif
citation("seqinr")
a=s2c("acgggtacggtcccatcgaa") ##To count dinucleotide occurrences in sequence a: count(a,2) ##To count trinucleotide occurrences in sequence a, in frame 2: count(a,3,2) ##To count dinucleotide frequencies in sequence a: count(a,2,freq=TRUE)