Learn R Programming

biogram (version 1.6.3)

degenerate: Degenerate protein sequence

Description

'Degenerates' amino acid or nucleic sequence by aggregating elements to bigger groups.

Usage

degenerate(seq, element_groups)

Arguments

seq

character vector or matrix representing single sequence.

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.

See Also

l2n to easily convert information stored in biological sequences from letters to numbers. calc_ed to calculate distance between encodings.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab