countPatterns - Count sequence patterns
countPatterns counts the fraction of times a set of character patterns occur
in a set of sequences.
countPatterns(seq, patterns, nt = FALSE, trim = FALSE, label = "REGION")
- character vector of either DNA or amino acid sequences.
- list of sequence patterns to count in each sequence. If the list is named, then names will be assigned as the column names of output data.frame.
seqare DNA sequences and and will be translated before performing the pattern search.
TRUEremove the first and last codon or amino acid from each sequence before the pattern search. If
FALSEdo not modify the input sequences.
- string defining a label to add as a prefix to the output column names.
A data.frame containing the fraction of times each sequence pattern was found.
seq <- c("TGTCAACAGGCTAACAGTTTCCGGACGTTC", "TGTCAGCAATATTATATTGCTCCCTTCACTTTC", "TGTCAAAAGTATAACAGTGCCCCCTGGACGTTC") patterns <- c("A", "V", "[LI]") names(patterns) <- c("ARG", "VAL", "ISO_LEU") countPatterns(seq, patterns, nt=TRUE, trim=TRUE, label="CDR3")
CDR3_ARG CDR3_VAL CDR3_ISO_LEU 1 0.1250000 0 0.0000000 2 0.1111111 0 0.1111111 3 0.1111111 0 0.0000000