count {seqinr} | R Documentation

## 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

### 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.

### Value

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

### Author(s)

D. Charif

### References

`citation("seqinr")`

### See Also

`table`

### Examples

    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)

[Package seqinr version 1.0-4 Index]