Learn R Programming

biogram (version 1.6.3)

validate_encoding: Validate encoding

Description

Checks the structure of an encoding.

Usage

validate_encoding(x, u)

Arguments

x

encoding.

u

integer, numeric or character vector of all elements belonging to the encoding. See Details.

Value

TRUE if the x is a correctly reduced u, FALSE in any other cases.

Details

The encoding is a list of groups to which elements of an alphabet should be reduced. All elements of the alphabet (all amino acids or all nucleotides) should appear in the encoding.

See Also

calc_ed: calculate the encoding distance between two encodings. encoding2df: converts an encoding to a data frame.

Examples

Run this code
# NOT RUN {
enc1 = list(`1` = c("a", "t"), 
            `2` = c("g", "c"))
# see if enc1 is the correctly reduced nucleotide (DNA) alphabet
validate_encoding(enc1, c("a", "c", "g", "t"))

# enc1 is not the RNA alphabet, so the results is FALSE
validate_encoding(enc1, c("a", "c", "g", "u"))

# validate_encoding works also on other notations
enc2 = list(a = c(1, 4),
            b = c(2, 3))
validate_encoding(enc2, 1L:4)
# }

Run the code above in your browser using DataLab