locateClusters {sarks} | R Documentation |
Find locations of matches of list of character vectors of k-mers in each element of a named character vector. Not case sensitive.
locateClusters(clusters, seqs, directional = TRUE, showMatch = FALSE)
clusters |
list of character vectors or XStringSet objects of k-mers to search for |
seqs |
character vector or XStringSet of sequences in which to locate kmer |
directional |
logical value: if FALSE, counts occurrences of either k-mers within each cluster or their reverse-complements. Makes sense only if applying to DNA sequences! |
showMatch |
logical value; if true add additional column to output indicating what the exact regex match for each occurrence (can be slow) |
data.frame with three columns: ‘seqid’ containing the name of the sequence from seqs in which the match was found; ‘cluster’ indicating the cluster from wich a k-mer was located; and ‘location’ giving the 1-based position at which the match was found.
seqs <- c( line1 = "My mind's got a mind of its own", line2 = "Takes me out to parties when I'd rather be alone", line3 = "Takes me out a-walkin' when I'd rather be at home" ) clusters <- list( antisocial = c('alone', 'at home'), mind = 'mind' ) clusterLoci <- locateClusters(clusters, seqs)