kmerCounts {sarks} | R Documentation |
Counts how often a k-mer (or vector of k-mers) occurs in each element of a character vector.
kmerCounts(kmer, seqs, directional = TRUE, overlap = FALSE)
kmer |
character vector or XStringSet of k-mers to search for. |
seqs |
character vector or XStringSet of sequences in which to search for and count occurrences of kmer. |
directional |
logical value: if FALSE, counts occurrences of either kmer or its reverse-complement. Makes sense only if applying to DNA sequences! |
overlap |
logical value: should overlapping occurrences of kmer be counted as multiple hits? |
if length(kmer) is one, returns integer vector of counts; if length(kmer) is more than one, returns matrix of counts: one row per sequence in seqs, one column per expression in regex
data(simulatedSeqs) motifCounts <- kmerCounts('CATACTGAGA', simulatedSeqs) otherCounts <- kmerCounts( c('AAAAA', 'CG'), simulatedSeqs, directional = FALSE )