degenerate {biogram} | R Documentation |
Degenerate protein sequence
Description
'Degenerates' amino acid or nucleic sequence by aggregating elements to bigger groups.
Usage
degenerate(seq, element_groups)
Arguments
seq |
|
element_groups |
encoding of elements: list of groups to which elements of sequence should be aggregated. Must have unique names. |
Value
A character
vector or matrix (if input is a matrix)
containing aggregated elements.
Note
Characters not present in the element_groups
will be converted to NA with a
warning.
See Also
l2n
to easily convert information stored in biological sequences from
letters to numbers.
calc_ed
to calculate distance between encodings.
Examples
sample_seq <- c(1, 3, 1, 3, 4, 4, 3, 1, 2)
table(sample_seq)
# aggregate sequence to purins and pyrimidines
deg_seq <- degenerate(sample_seq, list(w = c(1, 4), s = c(2, 3)))
table(deg_seq)
[Package biogram version 1.6.3 Index]