Learn R Programming

seqinr (version 1.0-6)

count: Composition of dimer/trimer/etc nucleotides

Description

Counts the number of times dimer/trimer/etc nucleotides occurs in a sequence. Note that the oligomers are overlapping.

Usage

count(seq,word,frame=0,freq=FALSE)

Arguments

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

Value

  • This function returns a factor whose levels are all the possible oligonucleotides. All oligomers are returned, even if absent from the sequence.

Details

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.

References

citation("seqinr")

See Also

table

Examples

Run this code
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)

Run the code above in your browser using DataLab